mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-01 15:11:24 +00:00
Handle DEBUG_VALUE in this pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99573 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7ec7a0e96b
commit
1feeadac1b
@ -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.
|
||||
/// 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;
|
||||
@ -84,17 +87,17 @@ bool OptimizeExts::OptimizeInstr(MachineInstr *MI, MachineBasicBlock *MBB,
|
||||
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;
|
||||
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;
|
||||
@ -103,9 +106,9 @@ bool OptimizeExts::OptimizeInstr(MachineInstr *MI, MachineBasicBlock *MBB,
|
||||
// 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)
|
||||
@ -147,9 +150,9 @@ 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.
|
||||
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)
|
||||
if (UI->isPHI())
|
||||
PHIBBs.insert(UI->getParent());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user