diff options
author | Dale Johannesen <dalej@apple.com> | 2010-03-09 20:15:42 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2010-03-09 20:15:42 +0000 |
commit | 90eab67320745dcacd6ed07a16933a68d1b59c54 (patch) | |
tree | d9e468aedc6f888ea9af1c3a65b3c113b42f0dd5 /llvm/lib | |
parent | 28d5f76f8572bb790ac2757a9cbb64071c8a2e2b (diff) | |
download | bcm5719-llvm-90eab67320745dcacd6ed07a16933a68d1b59c54.tar.gz bcm5719-llvm-90eab67320745dcacd6ed07a16933a68d1b59c54.zip |
The address of an indirect call must be in R12 on Darwin.
Make it so. (This patch is in LowerCall_Darwin, which seems
to be used by SVR4 code as well; since that doesn't belong here,
I haven't worried about this case.)
llvm-svn: 98077
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCISelLowering.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp index 3d81afa4507..aeaa7c6816d 100644 --- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp @@ -3258,6 +3258,16 @@ PPCTargetLowering::LowerCall_Darwin(SDValue Chain, SDValue Callee, false, false, 0); } + // On Darwin, R12 must contain the address of an indirect callee. This does + // not mean the MTCTR instruction must use R12; it's easier to model this as + // an extra parameter, so do that. + if (!isTailCall && + !dyn_cast<GlobalAddressSDNode>(Callee) && + !dyn_cast<ExternalSymbolSDNode>(Callee) && + !isBLACompatibleAddress(Callee, DAG)) + RegsToPass.push_back(std::make_pair((unsigned)(isPPC64 ? PPC::X12 : + PPC::R12), Callee)); + // Build a sequence of copy-to-reg nodes chained together with token chain // and flag operands which copy the outgoing args into the appropriate regs. SDValue InFlag; |