[llvm-commits] CVS: llvm/lib/Target/X86/X86InstrInfo.cpp X86InstrInfo.h

Dan Gohman djg at cray.com
Thu Jun 14 13:51:13 PDT 2007



Changes in directory llvm/lib/Target/X86:

X86InstrInfo.cpp updated: 1.89 -> 1.90
X86InstrInfo.h updated: 1.64 -> 1.65
---
Log message:

Add a target hook to allow loads from constant pools to be rematerialized, and an
implementation for x86.


---
Diffs of the changes:  (+26 -0)

 X86InstrInfo.cpp |   25 +++++++++++++++++++++++++
 X86InstrInfo.h   |    1 +
 2 files changed, 26 insertions(+)


Index: llvm/lib/Target/X86/X86InstrInfo.cpp
diff -u llvm/lib/Target/X86/X86InstrInfo.cpp:1.89 llvm/lib/Target/X86/X86InstrInfo.cpp:1.90
--- llvm/lib/Target/X86/X86InstrInfo.cpp:1.89	Wed Jun 13 12:59:52 2007
+++ llvm/lib/Target/X86/X86InstrInfo.cpp	Thu Jun 14 15:50:44 2007
@@ -112,6 +112,31 @@
 }
 
 
+bool X86InstrInfo::isOtherReMaterializableLoad(MachineInstr *MI) const {
+  switch (MI->getOpcode()) {
+  default: break;
+  case X86::MOV8rm:
+  case X86::MOV16rm:
+  case X86::MOV16_rm:
+  case X86::MOV32rm:
+  case X86::MOV32_rm:
+  case X86::MOV64rm:
+  case X86::FpLD64m:
+  case X86::MOVSSrm:
+  case X86::MOVSDrm:
+  case X86::MOVAPSrm:
+  case X86::MOVAPDrm:
+  case X86::MMX_MOVD64rm:
+  case X86::MMX_MOVQ64rm:
+    return MI->getOperand(1).isRegister() && MI->getOperand(2).isImmediate() &&
+           MI->getOperand(3).isRegister() && MI->getOperand(4).isConstantPoolIndex() &&
+           MI->getOperand(1).getReg() == 0 &&
+           MI->getOperand(2).getImmedValue() == 1 &&
+           MI->getOperand(3).getReg() == 0;
+  }
+  return false;
+}
+
 /// convertToThreeAddress - This method must be implemented by targets that
 /// set the M_CONVERTIBLE_TO_3_ADDR flag.  When this flag is set, the target
 /// may be able to convert a two-address instruction into a true


Index: llvm/lib/Target/X86/X86InstrInfo.h
diff -u llvm/lib/Target/X86/X86InstrInfo.h:1.64 llvm/lib/Target/X86/X86InstrInfo.h:1.65
--- llvm/lib/Target/X86/X86InstrInfo.h:1.64	Thu May 17 19:17:09 2007
+++ llvm/lib/Target/X86/X86InstrInfo.h	Thu Jun 14 15:50:44 2007
@@ -239,6 +239,7 @@
                    unsigned& destReg) const;
   unsigned isLoadFromStackSlot(MachineInstr *MI, int &FrameIndex) const;
   unsigned isStoreToStackSlot(MachineInstr *MI, int &FrameIndex) const;
+  bool isOtherReMaterializableLoad(MachineInstr *MI) const;
   
   /// convertToThreeAddress - This method must be implemented by targets that
   /// set the M_CONVERTIBLE_TO_3_ADDR flag.  When this flag is set, the target






More information about the llvm-commits mailing list