diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-01-16 22:34:08 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-01-16 22:34:08 +0000 |
commit | 86ae07f049fce1bc69d26e7fa22caf3ce45259de (patch) | |
tree | e3af25a2e502c20525691355fd8535273fb8df7b /llvm/lib/CodeGen/TargetInstrInfoImpl.cpp | |
parent | eff0a40d7e5a440b470f8f16459c8aa1ad8c1345 (diff) | |
download | bcm5719-llvm-86ae07f049fce1bc69d26e7fa22caf3ce45259de.tar.gz bcm5719-llvm-86ae07f049fce1bc69d26e7fa22caf3ce45259de.zip |
Extract method for detecting constant unallocatable physregs.
It is safe to move uses of such registers.
llvm-svn: 148259
Diffstat (limited to 'llvm/lib/CodeGen/TargetInstrInfoImpl.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetInstrInfoImpl.cpp | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/TargetInstrInfoImpl.cpp b/llvm/lib/CodeGen/TargetInstrInfoImpl.cpp index 018b5e5e319..be2585575b6 100644 --- a/llvm/lib/CodeGen/TargetInstrInfoImpl.cpp +++ b/llvm/lib/CodeGen/TargetInstrInfoImpl.cpp @@ -380,7 +380,6 @@ isReallyTriviallyReMaterializableGeneric(const MachineInstr *MI, const MachineRegisterInfo &MRI = MF.getRegInfo(); const TargetMachine &TM = MF.getTarget(); const TargetInstrInfo &TII = *TM.getInstrInfo(); - const TargetRegisterInfo &TRI = *TM.getRegisterInfo(); // Remat clients assume operand 0 is the defined register. if (!MI->getNumOperands() || !MI->getOperand(0).isReg()) @@ -432,19 +431,8 @@ isReallyTriviallyReMaterializableGeneric(const MachineInstr *MI, // If the physreg has no defs anywhere, it's just an ambient register // and we can freely move its uses. Alternatively, if it's allocatable, // it could get allocated to something with a def during allocation. - if (!MRI.def_empty(Reg)) + if (!MRI.isConstantPhysReg(Reg, MF)) return false; - BitVector AllocatableRegs = TRI.getAllocatableSet(MF, 0); - if (AllocatableRegs.test(Reg)) - return false; - // Check for a def among the register's aliases too. - for (const unsigned *Alias = TRI.getAliasSet(Reg); *Alias; ++Alias) { - unsigned AliasReg = *Alias; - if (!MRI.def_empty(AliasReg)) - return false; - if (AllocatableRegs.test(AliasReg)) - return false; - } } else { // A physreg def. We can't remat it. return false; |