[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp X86ISelLowering.h
Chris Lattner
sabre at nondot.org
Sun Feb 25 01:06:32 PST 2007
Changes in directory llvm/lib/Target/X86:
X86ISelLowering.cpp updated: 1.330 -> 1.331
X86ISelLowering.h updated: 1.87 -> 1.88
---
Log message:
pass the calling convention into Lower*CallTo, instead of using ad-hoc flags.
---
Diffs of the changes: (+19 -23)
X86ISelLowering.cpp | 34 ++++++++++++++++------------------
X86ISelLowering.h | 8 +++-----
2 files changed, 19 insertions(+), 23 deletions(-)
Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.330 llvm/lib/Target/X86/X86ISelLowering.cpp:1.331
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.330 Sun Feb 25 02:59:22 2007
+++ llvm/lib/Target/X86/X86ISelLowering.cpp Sun Feb 25 03:06:15 2007
@@ -763,7 +763,7 @@
}
SDOperand X86TargetLowering::LowerCCCCallTo(SDOperand Op, SelectionDAG &DAG,
- bool isStdCall) {
+ unsigned CC) {
SDOperand Chain = Op.getOperand(0);
bool isVarArg = cast<ConstantSDNode>(Op.getOperand(2))->getValue() != 0;
bool isTailCall = cast<ConstantSDNode>(Op.getOperand(3))->getValue() != 0;
@@ -808,7 +808,7 @@
ArgInRegs[i],
NumIntRegs, NumXMMRegs, 3,
ObjSize, ObjIntRegs, ObjXMMRegs,
- !isStdCall);
+ CC != CallingConv::X86_StdCall);
if (ObjSize > 4)
ArgIncrement = ObjSize;
@@ -842,7 +842,7 @@
ArgInRegs[i],
NumIntRegs, NumXMMRegs, 3,
ObjSize, ObjIntRegs, ObjXMMRegs,
- !isStdCall);
+ CC != CallingConv::X86_StdCall);
if (ObjSize > 4)
ArgIncrement = ObjSize;
@@ -868,7 +868,6 @@
case MVT::v2i64:
case MVT::v4f32:
case MVT::v2f64:
- assert(!isStdCall && "Unhandled argument type!");
RegsToPass.push_back(std::make_pair(XMMArgRegs[NumXMMRegs], Arg));
break;
}
@@ -956,12 +955,11 @@
// Create the CALLSEQ_END node.
unsigned NumBytesForCalleeToPush = 0;
- if (isStdCall) {
- if (isVarArg) {
+ if (CC == CallingConv::X86_StdCall) {
+ if (isVarArg)
NumBytesForCalleeToPush = NumSRetBytes;
- } else {
+ else
NumBytesForCalleeToPush = NumBytes;
- }
} else {
// If this is is a call to a struct-return function, the callee
// pops the hidden struct pointer, so we have to push it back.
@@ -980,8 +978,7 @@
// Handle result values, copying them out of physregs into vregs that we
// return.
- return SDOperand(LowerCallResult(Chain, InFlag, Op.Val, CallingConv::C, DAG),
- Op.ResNo);
+ return SDOperand(LowerCallResult(Chain, InFlag, Op.Val, CC, DAG), Op.ResNo);
}
@@ -1219,7 +1216,8 @@
}
SDOperand
-X86TargetLowering::LowerX86_64CCCCallTo(SDOperand Op, SelectionDAG &DAG) {
+X86TargetLowering::LowerX86_64CCCCallTo(SDOperand Op, SelectionDAG &DAG,
+ unsigned CallingConv) {
SDOperand Chain = Op.getOperand(0);
bool isVarArg = cast<ConstantSDNode>(Op.getOperand(2))->getValue() != 0;
bool isTailCall = cast<ConstantSDNode>(Op.getOperand(3))->getValue() != 0;
@@ -1652,7 +1650,7 @@
}
SDOperand X86TargetLowering::LowerFastCCCallTo(SDOperand Op, SelectionDAG &DAG,
- bool isFastCall) {
+ unsigned CC) {
SDOperand Chain = Op.getOperand(0);
bool isTailCall = cast<ConstantSDNode>(Op.getOperand(3))->getValue() != 0;
SDOperand Callee = Op.getOperand(4);
@@ -1677,7 +1675,8 @@
X86::XMM0, X86::XMM1, X86::XMM2, X86::XMM3
};
- unsigned GPRInd = (isFastCall ? 1 : 0);
+ bool isFastCall = CC == CallingConv::X86_FastCall;
+ unsigned GPRInd = isFastCall ? 1 : 0;
for (unsigned i = 0; i != NumOps; ++i) {
SDOperand Arg = Op.getOperand(5+2*i);
@@ -3935,21 +3934,20 @@
unsigned CallingConv= cast<ConstantSDNode>(Op.getOperand(1))->getValue();
if (Subtarget->is64Bit())
- return LowerX86_64CCCCallTo(Op, DAG);
+ return LowerX86_64CCCCallTo(Op, DAG, CallingConv);
else
switch (CallingConv) {
default:
assert(0 && "Unsupported calling convention");
case CallingConv::Fast:
if (EnableFastCC)
- return LowerFastCCCallTo(Op, DAG);
+ return LowerFastCCCallTo(Op, DAG, CallingConv);
// Falls through
case CallingConv::C:
- return LowerCCCCallTo(Op, DAG);
case CallingConv::X86_StdCall:
- return LowerCCCCallTo(Op, DAG, true);
+ return LowerCCCCallTo(Op, DAG, CallingConv);
case CallingConv::X86_FastCall:
- return LowerFastCCCallTo(Op, DAG, true);
+ return LowerFastCCCallTo(Op, DAG, CallingConv);
}
}
Index: llvm/lib/Target/X86/X86ISelLowering.h
diff -u llvm/lib/Target/X86/X86ISelLowering.h:1.87 llvm/lib/Target/X86/X86ISelLowering.h:1.88
--- llvm/lib/Target/X86/X86ISelLowering.h:1.87 Sun Feb 25 02:59:22 2007
+++ llvm/lib/Target/X86/X86ISelLowering.h Sun Feb 25 03:06:15 2007
@@ -366,18 +366,16 @@
// C and StdCall Calling Convention implementation.
SDOperand LowerCCCArguments(SDOperand Op, SelectionDAG &DAG,
bool isStdCall = false);
- SDOperand LowerCCCCallTo(SDOperand Op, SelectionDAG &DAG,
- bool isStdCall = false);
+ SDOperand LowerCCCCallTo(SDOperand Op, SelectionDAG &DAG, unsigned CC);
// X86-64 C Calling Convention implementation.
SDOperand LowerX86_64CCCArguments(SDOperand Op, SelectionDAG &DAG);
- SDOperand LowerX86_64CCCCallTo(SDOperand Op, SelectionDAG &DAG);
+ SDOperand LowerX86_64CCCCallTo(SDOperand Op, SelectionDAG &DAG,unsigned CC);
// Fast and FastCall Calling Convention implementation.
SDOperand LowerFastCCArguments(SDOperand Op, SelectionDAG &DAG,
bool isFastCall = false);
- SDOperand LowerFastCCCallTo(SDOperand Op, SelectionDAG &DAG,
- bool isFastCall = false);
+ SDOperand LowerFastCCCallTo(SDOperand Op, SelectionDAG &DAG, unsigned CC);
SDOperand LowerBUILD_VECTOR(SDOperand Op, SelectionDAG &DAG);
SDOperand LowerVECTOR_SHUFFLE(SDOperand Op, SelectionDAG &DAG);
More information about the llvm-commits
mailing list