From: Duraid Madina Date: Thu, 22 Dec 2005 06:39:57 +0000 (+0000) Subject: this should take care of calls to varadic functions, but it doesn.,t X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=98b3a83d83877d319ab5f287bb082ce5998c5046;p=oota-llvm.git this should take care of calls to varadic functions, but it doesn.,t 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 --- diff --git a/lib/Target/IA64/IA64ISelLowering.cpp b/lib/Target/IA64/IA64ISelLowering.cpp index 009a337155d..adda64ec840 100644 --- a/lib/Target/IA64/IA64ISelLowering.cpp +++ b/lib/Target/IA64/IA64ISelLowering.cpp @@ -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 GETFDRetTypes; + std::vector 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 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);