mirror of
https://github.com/RPCSX/llvm.git
synced 2025-04-07 10:42:16 +00:00
Avoid adding duplicate function live-in's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104560 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e350690e3b
commit
3946043a80
@ -293,6 +293,10 @@ public:
|
|||||||
/// corresponding live-in physical register.
|
/// corresponding live-in physical register.
|
||||||
unsigned getLiveInPhysReg(unsigned VReg) const;
|
unsigned getLiveInPhysReg(unsigned VReg) const;
|
||||||
|
|
||||||
|
/// getLiveInVirtReg - If PReg is a live-in physical register, return the
|
||||||
|
/// corresponding live-in physical register.
|
||||||
|
unsigned getLiveInVirtReg(unsigned PReg) const;
|
||||||
|
|
||||||
/// EmitLiveInCopies - Emit copies to initialize livein virtual registers
|
/// EmitLiveInCopies - Emit copies to initialize livein virtual registers
|
||||||
/// into the given entry block.
|
/// into the given entry block.
|
||||||
void EmitLiveInCopies(MachineBasicBlock *EntryMBB,
|
void EmitLiveInCopies(MachineBasicBlock *EntryMBB,
|
||||||
|
@ -398,8 +398,14 @@ void MachineFunction::viewCFGOnly() const
|
|||||||
unsigned MachineFunction::addLiveIn(unsigned PReg,
|
unsigned MachineFunction::addLiveIn(unsigned PReg,
|
||||||
const TargetRegisterClass *RC) {
|
const TargetRegisterClass *RC) {
|
||||||
assert(RC->contains(PReg) && "Not the correct regclass!");
|
assert(RC->contains(PReg) && "Not the correct regclass!");
|
||||||
unsigned VReg = getRegInfo().createVirtualRegister(RC);
|
MachineRegisterInfo &MRI = getRegInfo();
|
||||||
getRegInfo().addLiveIn(PReg, VReg);
|
unsigned VReg = MRI.getLiveInVirtReg(PReg);
|
||||||
|
if (VReg) {
|
||||||
|
assert(MRI.getRegClass(VReg) == RC && "Register class mismatch!");
|
||||||
|
return VReg;
|
||||||
|
}
|
||||||
|
VReg = MRI.createVirtualRegister(RC);
|
||||||
|
MRI.addLiveIn(PReg, VReg);
|
||||||
return VReg;
|
return VReg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,6 +165,15 @@ unsigned MachineRegisterInfo::getLiveInPhysReg(unsigned VReg) const {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// getLiveInVirtReg - If PReg is a live-in physical register, return the
|
||||||
|
/// corresponding live-in physical register.
|
||||||
|
unsigned MachineRegisterInfo::getLiveInVirtReg(unsigned PReg) const {
|
||||||
|
for (livein_iterator I = livein_begin(), E = livein_end(); I != E; ++I)
|
||||||
|
if (I->first == PReg)
|
||||||
|
return I->second;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static cl::opt<bool>
|
static cl::opt<bool>
|
||||||
SchedLiveInCopies("schedule-livein-copies", cl::Hidden,
|
SchedLiveInCopies("schedule-livein-copies", cl::Hidden,
|
||||||
cl::desc("Schedule copies of livein registers"),
|
cl::desc("Schedule copies of livein registers"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user