projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add DBG_VALUE handling for byval parameters; this
[oota-llvm.git]
/
lib
/
CodeGen
/
OptimizeExts.cpp
diff --git
a/lib/CodeGen/OptimizeExts.cpp
b/lib/CodeGen/OptimizeExts.cpp
index 096f9d4ab46d0b27c5d4771f96fd5994d58e8e30..41fc204074410c144140afac9df3edd72a4ebe3b 100644
(file)
--- a/
lib/CodeGen/OptimizeExts.cpp
+++ b/
lib/CodeGen/OptimizeExts.cpp
@@
-73,6
+73,9
@@
FunctionPass *llvm::createOptimizeExtsPass() { return new OptimizeExts(); }
/// the source, and if the source value is preserved as a sub-register of
/// the result, then replace all reachable uses of the source with the subreg
/// of the result.
/// the source, and if the source value is preserved as a sub-register of
/// the result, then replace all reachable uses of the source with the subreg
/// of the result.
+/// Do not generate an EXTRACT that is used only in a debug use, as this
+/// changes the code. Since this code does not currently share EXTRACTs, just
+/// ignore all debug uses.
bool OptimizeExts::OptimizeInstr(MachineInstr *MI, MachineBasicBlock *MBB,
SmallPtrSet<MachineInstr*, 8> &LocalMIs) {
bool Changed = false;
bool OptimizeExts::OptimizeInstr(MachineInstr *MI, MachineBasicBlock *MBB,
SmallPtrSet<MachineInstr*, 8> &LocalMIs) {
bool Changed = false;
@@
-84,17
+87,17
@@
bool OptimizeExts::OptimizeInstr(MachineInstr *MI, MachineBasicBlock *MBB,
TargetRegisterInfo::isPhysicalRegister(SrcReg))
return false;
TargetRegisterInfo::isPhysicalRegister(SrcReg))
return false;
- MachineRegisterInfo::use_
iterator UI = MRI->use
_begin(SrcReg);
- if (++UI == MRI->use_end())
+ MachineRegisterInfo::use_
nodbg_iterator UI = MRI->use_nodbg
_begin(SrcReg);
+ if (++UI == MRI->use_
nodbg_
end())
// No other uses.
return false;
// Ok, the source has other uses. See if we can replace the other uses
// with use of the result of the extension.
SmallPtrSet<MachineBasicBlock*, 4> ReachedBBs;
// No other uses.
return false;
// Ok, the source has other uses. See if we can replace the other uses
// with use of the result of the extension.
SmallPtrSet<MachineBasicBlock*, 4> ReachedBBs;
- UI = MRI->use_begin(DstReg);
- for (MachineRegisterInfo::use_
iterator UE = MRI->use_end(); UI != UE
;
- ++UI)
+ UI = MRI->use_
nodbg_
begin(DstReg);
+ for (MachineRegisterInfo::use_
nodbg_iterator UE = MRI->use_nodbg_end()
;
+
UI != UE;
++UI)
ReachedBBs.insert(UI->getParent());
bool ExtendLife = true;
ReachedBBs.insert(UI->getParent());
bool ExtendLife = true;
@@
-103,14
+106,14
@@
bool OptimizeExts::OptimizeInstr(MachineInstr *MI, MachineBasicBlock *MBB,
// Uses that the result of the instruction can reach.
SmallVector<MachineOperand*, 8> ExtendedUses;
// Uses that the result of the instruction can reach.
SmallVector<MachineOperand*, 8> ExtendedUses;
- UI = MRI->use_begin(SrcReg);
- for (MachineRegisterInfo::use_
iterator UE = MRI->use_end(); UI != UE
;
- ++UI) {
+ UI = MRI->use_
nodbg_
begin(SrcReg);
+ for (MachineRegisterInfo::use_
nodbg_iterator UE = MRI->use_nodbg_end()
;
+
UI != UE;
++UI) {
MachineOperand &UseMO = UI.getOperand();
MachineInstr *UseMI = &*UI;
if (UseMI == MI)
continue;
MachineOperand &UseMO = UI.getOperand();
MachineInstr *UseMI = &*UI;
if (UseMI == MI)
continue;
- if (UseMI->
getOpcode() == TargetInstrInfo::PHI
) {
+ if (UseMI->
isPHI()
) {
ExtendLife = false;
continue;
}
ExtendLife = false;
continue;
}
@@
-147,10
+150,10
@@
bool OptimizeExts::OptimizeInstr(MachineInstr *MI, MachineBasicBlock *MBB,
// Look for PHI uses of the extended result, we don't want to extend the
// liveness of a PHI input. It breaks all kinds of assumptions down
// stream. A PHI use is expected to be the kill of its source values.
// Look for PHI uses of the extended result, we don't want to extend the
// liveness of a PHI input. It breaks all kinds of assumptions down
// stream. A PHI use is expected to be the kill of its source values.
- UI = MRI->use_begin(DstReg);
- for (MachineRegisterInfo::use_
iterator UE = MRI->use_end(); UI != UE
;
- ++UI)
- if (UI->
getOpcode() == TargetInstrInfo::PHI
)
+ UI = MRI->use_
nodbg_
begin(DstReg);
+ for (MachineRegisterInfo::use_
nodbg_iterator UE = MRI->use_nodbg_end()
;
+
UI != UE;
++UI)
+ if (UI->
isPHI()
)
PHIBBs.insert(UI->getParent());
const TargetRegisterClass *RC = MRI->getRegClass(SrcReg);
PHIBBs.insert(UI->getParent());
const TargetRegisterClass *RC = MRI->getRegClass(SrcReg);
@@
-162,7
+165,7
@@
bool OptimizeExts::OptimizeInstr(MachineInstr *MI, MachineBasicBlock *MBB,
continue;
unsigned NewVR = MRI->createVirtualRegister(RC);
BuildMI(*UseMBB, UseMI, UseMI->getDebugLoc(),
continue;
unsigned NewVR = MRI->createVirtualRegister(RC);
BuildMI(*UseMBB, UseMI, UseMI->getDebugLoc(),
- TII->get(Target
InstrInfo
::EXTRACT_SUBREG), NewVR)
+ TII->get(Target
Opcode
::EXTRACT_SUBREG), NewVR)
.addReg(DstReg).addImm(SubIdx);
UseMO->setReg(NewVR);
++NumReuse;
.addReg(DstReg).addImm(SubIdx);
UseMO->setReg(NewVR);
++NumReuse;