Darwin PPC64 indirect call target goes in X12, not R12. This fixes these
authorChris Lattner <sabre@nondot.org>
Sun, 9 Mar 2008 20:49:33 +0000 (20:49 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 9 Mar 2008 20:49:33 +0000 (20:49 +0000)
two regression tests:
test/CodeGen/PowerPC/2007-10-21-LocalRegAllocAssert.ll
test/CodeGen/PowerPC/2007-10-21-LocalRegAllocAssert2.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48120 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/PPCISelLowering.cpp

index 7647d4e223344e4ab435419e8142d6882da40ebe..6b6ec55864d8eb7a154b48592c7eec75f045bf60 100644 (file)
@@ -1973,9 +1973,10 @@ SDOperand PPCTargetLowering::LowerCALL(SDOperand Op, SelectionDAG &DAG,
     Chain = DAG.getNode(PPCISD::MTCTR, NodeTys, MTCTROps, 2+(InFlag.Val!=0));
     InFlag = Chain.getValue(1);
     
-    // Copy the callee address into R12 on darwin.
+    // Copy the callee address into R12/X12 on darwin.
     if (isMachoABI) {
-      Chain = DAG.getCopyToReg(Chain, PPC::R12, Callee, InFlag);
+      unsigned Reg = Callee.getValueType() == MVT::i32 ? PPC::R12 : PPC::X12;
+      Chain = DAG.getCopyToReg(Chain, Reg, Callee, InFlag);
       InFlag = Chain.getValue(1);
     }