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

Chris Lattner lattner at cs.uiuc.edu
Thu Apr 21 12:03:41 PDT 2005



Changes in directory llvm/lib/Target/X86:

X86ISelPattern.cpp updated: 1.105 -> 1.106
---
Log message:

Handle (store &GV -> mem) as a store immediate.  This often occurs for
printf format strings and other stuff.  Instead of generating this:

        movl $l1__2E_str_1, %eax
        movl %eax, (%esp)

we now emit:

        movl $l1__2E_str_1, (%esp)



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

 X86ISelPattern.cpp |   14 ++++++++++++++
 1 files changed, 14 insertions(+)


Index: llvm/lib/Target/X86/X86ISelPattern.cpp
diff -u llvm/lib/Target/X86/X86ISelPattern.cpp:1.105 llvm/lib/Target/X86/X86ISelPattern.cpp:1.106
--- llvm/lib/Target/X86/X86ISelPattern.cpp:1.105	Tue Apr 12 22:29:53 2005
+++ llvm/lib/Target/X86/X86ISelPattern.cpp	Thu Apr 21 14:03:24 2005
@@ -3120,6 +3120,20 @@
         addFullAddress(BuildMI(BB, Opc, 4+1), AM).addImm(CN->getValue());
         return;
       }
+    } else if (GlobalAddressSDNode *GA =
+                      dyn_cast<GlobalAddressSDNode>(N.getOperand(1))) {
+      assert(GA->getValueType(0) == MVT::i32 && "Bad pointer operand");
+
+      if (getRegPressure(N.getOperand(0)) > getRegPressure(N.getOperand(2))) {
+        Select(N.getOperand(0));
+        SelectAddress(N.getOperand(2), AM);
+      } else {
+        SelectAddress(N.getOperand(2), AM);
+        Select(N.getOperand(0));
+      }
+      addFullAddress(BuildMI(BB, X86::MOV32mi, 4+1),
+                     AM).addGlobalAddress(GA->getGlobal());
+      return;
     }
 
     // Check to see if this is a load/op/store combination.






More information about the llvm-commits mailing list