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

Chris Lattner lattner at cs.uiuc.edu
Sun Sep 18 22:23:55 PDT 2005



Changes in directory llvm/lib/Target/X86:

X86RegisterInfo.cpp updated: 1.108 -> 1.109
X86RegisterInfo.h updated: 1.30 -> 1.31
---
Log message:

Implement the isLoadFromStackSlot interface


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

 X86RegisterInfo.cpp |   25 +++++++++++++++++++++++++
 X86RegisterInfo.h   |    3 +++
 2 files changed, 28 insertions(+)


Index: llvm/lib/Target/X86/X86RegisterInfo.cpp
diff -u llvm/lib/Target/X86/X86RegisterInfo.cpp:1.108 llvm/lib/Target/X86/X86RegisterInfo.cpp:1.109
--- llvm/lib/Target/X86/X86RegisterInfo.cpp:1.108	Fri Aug 19 13:32:03 2005
+++ llvm/lib/Target/X86/X86RegisterInfo.cpp	Mon Sep 19 00:23:44 2005
@@ -92,6 +92,31 @@
   BuildMI(MBB, MI, Opc, 1, DestReg).addReg(SrcReg);
 }
 
+unsigned X86RegisterInfo::isLoadFromStackSlot(MachineInstr *MI, 
+                                              int &FrameIndex) const {
+  switch (MI->getOpcode()) {
+  default: break;
+  case X86::MOV8rm:
+  case X86::MOV16rm:
+  case X86::MOV32rm:
+  case X86::FLD64m:
+  case X86::FLD80m:
+  case X86::MOVAPDrm:
+  case X86::MOVSDrm:
+    if (MI->getOperand(1).isFrameIndex() && MI->getOperand(2).isImmediate() &&
+        MI->getOperand(3).isRegister() && MI->getOperand(4).isImmediate() &&
+        MI->getOperand(2).getImmedValue() == 1 &&
+        MI->getOperand(3).getReg() == 0 &&
+        MI->getOperand(4).getImmedValue() == 0) {
+      FrameIndex = MI->getOperand(1).getFrameIndex();
+      return MI->getOperand(0).getReg();
+    }
+    break;
+  }
+  return 0;
+}
+
+
 static MachineInstr *MakeMInst(unsigned Opcode, unsigned FrameIndex,
                                MachineInstr *MI) {
   return addFrameReference(BuildMI(Opcode, 4), FrameIndex);


Index: llvm/lib/Target/X86/X86RegisterInfo.h
diff -u llvm/lib/Target/X86/X86RegisterInfo.h:1.30 llvm/lib/Target/X86/X86RegisterInfo.h:1.31
--- llvm/lib/Target/X86/X86RegisterInfo.h:1.30	Fri Aug 19 13:32:03 2005
+++ llvm/lib/Target/X86/X86RegisterInfo.h	Mon Sep 19 00:23:44 2005
@@ -39,6 +39,9 @@
                     unsigned DestReg, unsigned SrcReg,
                     const TargetRegisterClass *RC) const;
 
+  unsigned isLoadFromStackSlot(MachineInstr *MI, int &FrameIndex) const;
+
+
   /// foldMemoryOperand - If this target supports it, fold a load or store of
   /// the specified stack slot into the specified machine instruction for the
   /// specified operand.  If this is possible, the target should perform the






More information about the llvm-commits mailing list