[llvm-commits] [llvm] r48856 - /llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
Evan Cheng
evan.cheng at apple.com
Wed Mar 26 18:45:12 PDT 2008
Author: evancheng
Date: Wed Mar 26 20:45:11 2008
New Revision: 48856
URL: http://llvm.org/viewvc/llvm-project?rev=48856&view=rev
Log:
Code clean up.
Modified:
llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=48856&r1=48855&r2=48856&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Wed Mar 26 20:45:11 2008
@@ -734,19 +734,20 @@
}
- static bool regIsPICBase(MachineInstr *MI, unsigned BaseReg) {
- MachineRegisterInfo &MRI = MI->getParent()->getParent()->getRegInfo();
- bool isPICBase = false;
- for (MachineRegisterInfo::def_iterator I = MRI.def_begin(BaseReg),
- E = MRI.def_end(); I != E; ++I) {
- MachineInstr *DefMI = I.getOperand().getParent();
- if (DefMI->getOpcode() != X86::MOVPC32r)
- return false;
- assert(!isPICBase && "More than one PIC base?");
- isPICBase = true;
- }
- return isPICBase;
- }
+/// regIsPICBase - Return true if register is PIC base (i.e.g defined by
+/// X86::MOVPC32r.
+static bool regIsPICBase(unsigned BaseReg, MachineRegisterInfo &MRI) {
+ bool isPICBase = false;
+ for (MachineRegisterInfo::def_iterator I = MRI.def_begin(BaseReg),
+ E = MRI.def_end(); I != E; ++I) {
+ MachineInstr *DefMI = I.getOperand().getParent();
+ if (DefMI->getOpcode() != X86::MOVPC32r)
+ return false;
+ assert(!isPICBase && "More than one PIC base?");
+ isPICBase = true;
+ }
+ return isPICBase;
+}
bool X86InstrInfo::isReallyTriviallyReMaterializable(MachineInstr *MI) const {
switch (MI->getOpcode()) {
@@ -799,7 +800,8 @@
if (BaseReg == 0)
return true;
// Allow re-materialization of lea PICBase + x.
- return regIsPICBase(MI, BaseReg);
+ MachineRegisterInfo &MRI = MI->getParent()->getParent()->getRegInfo();
+ return regIsPICBase(BaseReg, MRI);
}
return false;
}
More information about the llvm-commits
mailing list