[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp PPCISelLowering.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Nov 16 21:56:25 PST 2005



Changes in directory llvm/lib/Target/PowerPC:

PPCISelDAGToDAG.cpp updated: 1.126 -> 1.127
PPCISelLowering.cpp updated: 1.39 -> 1.40
---
Log message:

When lowering direct calls, lower them to use a targetglobaladress directly
instead of a globaladdress.  This has no effect on the generated code at all.


---
Diffs of the changes:  (+6 -2)

 PPCISelDAGToDAG.cpp |    3 +--
 PPCISelLowering.cpp |    5 +++++
 2 files changed, 6 insertions(+), 2 deletions(-)


Index: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
diff -u llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.126 llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.127
--- llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.126	Tue Nov 15 18:48:01 2005
+++ llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp	Wed Nov 16 23:56:14 2005
@@ -753,8 +753,7 @@
   if (GlobalAddressSDNode *GASD =
       dyn_cast<GlobalAddressSDNode>(N->getOperand(1))) {
     CallOpcode = PPC::BL;
-    CallOperands.push_back(CurDAG->getTargetGlobalAddress(GASD->getGlobal(),
-                                                          MVT::i32));
+    CallOperands.push_back(N->getOperand(1));
   } else if (ExternalSymbolSDNode *ESSDN =
              dyn_cast<ExternalSymbolSDNode>(N->getOperand(1))) {
     CallOpcode = PPC::BL;


Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp
diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.39 llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.40
--- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.39	Wed Oct 26 13:01:11 2005
+++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp	Wed Nov 16 23:56:14 2005
@@ -691,6 +691,11 @@
     RetVals.push_back(ActualRetTyVT);
   RetVals.push_back(MVT::Other);
   
+  // If the callee is a GlobalAddress node (quite common, every direct call is)
+  // turn it into a TargetGlobalAddress node so that legalize doesn't hack it.
+  if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee))
+    Callee = DAG.getTargetGlobalAddress(G->getGlobal(), MVT::i32);
+  
   SDOperand TheCall = SDOperand(DAG.getCall(RetVals,
                                             Chain, Callee, args_to_use), 0);
   Chain = TheCall.getValue(RetTyVT != MVT::isVoid);






More information about the llvm-commits mailing list