diff options
author | Chris Lattner <sabre@nondot.org> | 2005-11-17 05:56:14 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-11-17 05:56:14 +0000 |
commit | b7025749e1021ef83e3c63e286f9a2b890c792a1 (patch) | |
tree | 94dbd863614e3d6293299eb6f79168bcac6c3123 /llvm/lib | |
parent | 4ff65ec7451144614062de7efe17536f0f393951 (diff) | |
download | bcm5719-llvm-b7025749e1021ef83e3c63e286f9a2b890c792a1.tar.gz bcm5719-llvm-b7025749e1021ef83e3c63e286f9a2b890c792a1.zip |
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.
llvm-svn: 24386
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp | 3 | ||||
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCISelLowering.cpp | 5 |
2 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp b/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp index ad0a0a02193..cc7a59aa977 100644 --- a/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp +++ b/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp @@ -753,8 +753,7 @@ SDOperand PPCDAGToDAGISel::SelectCALL(SDOperand Op) { 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; diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp index 30525cffd06..d196c10fae7 100644 --- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp @@ -691,6 +691,11 @@ PPCTargetLowering::LowerCallTo(SDOperand Chain, 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); |