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 | f7b730425fc45a28cafddf6e9907cd89acdae2aa (patch) | |
| tree | 02c80fc610522484f78bd0534af5a5f07b374458 /lib/Target/PowerPC/PPCISelLowering.cpp | |
| parent | f10e43ee7e3cb171e44c201e133fa153778d0da4 (diff) | |
| download | external_llvm-f7b730425fc45a28cafddf6e9907cd89acdae2aa.zip external_llvm-f7b730425fc45a28cafddf6e9907cd89acdae2aa.tar.gz external_llvm-f7b730425fc45a28cafddf6e9907cd89acdae2aa.tar.bz2 | |
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.)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98077 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PowerPC/PPCISelLowering.cpp')
| -rw-r--r-- | lib/Target/PowerPC/PPCISelLowering.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp index 3d81afa..aeaa7c6 100644 --- a/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/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; |
