this should take care of calls to varadic functions, but it doesn.,t
authorDuraid Madina <duraid@octopus.com.au>
Thu, 22 Dec 2005 06:39:57 +0000 (06:39 +0000)
committerDuraid Madina <duraid@octopus.com.au>
Thu, 22 Dec 2005 06:39:57 +0000 (06:39 +0000)
BUG: calling printf(string, float) will load the float into the wrong
register, completely forget about loading the string, etce

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

lib/Target/IA64/IA64ISelLowering.cpp

index 009a337155d0a5bc1f41c267ac49c71014da1de8..adda64ec840e3f3ea18208d70b2f6d6657b89f88 100644 (file)
@@ -388,16 +388,22 @@ IA64TargetLowering::LowerCallTo(SDOperand Chain,
     InFlag = Chain.getValue(1);
 
     //FIXME: for performance, only do the following when required
-
+    
     // if we have just copied an FP arg, copy its in-memory representation
     // to the appropriate integer register
-/*    if(MVT::isFloatingPoint(RegValuesToPass[i].getValueType())) {
-      Chain = DAG.getTargetNode(IA64::GETFD, MVT::i64, RegValuesToPass[i], Chain, InFlag);
-      InFlag = Chain.getValue(0); // XXX
-      Chain = DAG.getCopyToReg(Chain, IntArgRegs[i], Chain, InFlag); // ...thrice!
+    if(MVT::isFloatingPoint(RegValuesToPass[i].getValueType())) {
+      std::vector<MVT::ValueType> GETFDRetTypes;
+      std::vector<SDOperand> GETFDOperands;
+      GETFDRetTypes.push_back(MVT::i64);
+      GETFDRetTypes.push_back(MVT::Flag);
+      GETFDOperands.push_back(RegValuesToPass[i]);
+      GETFDOperands.push_back(Chain);
+      GETFDOperands.push_back(InFlag);
+      
+      Chain = DAG.getNode(IA64ISD::GETFD, GETFDRetTypes, GETFDOperands);
+      Chain = DAG.getCopyToReg(Chain, IntArgRegs[i], Chain.getValue(0), Chain.getValue(1)); // ...thrice!
       InFlag = Chain.getValue(1);
-    } */
-
+    }
   }
 
   std::vector<MVT::ValueType> RetVals;
@@ -452,6 +458,7 @@ IA64TargetLowering::LowerCallTo(SDOperand Chain,
       RetVal = DAG.getNode(RetTy->isSigned() ? ISD::AssertSext :ISD::AssertZext,
                            MVT::i64, RetVal, DAG.getValueType(RetTyVT));
       RetVal = DAG.getNode(ISD::TRUNCATE, RetTyVT, RetVal);
+      break;
     case MVT::i64:
       RetVal = DAG.getCopyFromReg(Chain, IA64::r8, MVT::i64, InFlag);
       Chain = RetVal.getValue(1);