summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-05-13 18:43:43 +0000
committerChris Lattner <sabre@nondot.org>2005-05-13 18:43:43 +0000
commitd0feb644432512e9af5edab6791c1da46f6668f7 (patch)
tree7b4681c05ffdf9718f6189a48fa0dba0d4f0581b
parent46db599b6173d3278e268bcbebc9f1e226c19f84 (diff)
downloadbcm5719-llvm-d0feb644432512e9af5edab6791c1da46f6668f7.tar.gz
bcm5719-llvm-d0feb644432512e9af5edab6791c1da46f6668f7.zip
Handle TAILCALL node
llvm-svn: 21957
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp12
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp1
2 files changed, 10 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 793037930c0..14b4c5a4b23 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -361,6 +361,7 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
AddLegalizedOperand(SDOperand(Node, 1), Result.getValue(1));
return Result.getValue(Op.ResNo);
+ case ISD::TAILCALL:
case ISD::CALL: {
Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain.
Tmp2 = LegalizeOp(Node->getOperand(1)); // Legalize the callee.
@@ -377,7 +378,8 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
RetTyVTs.reserve(Node->getNumValues());
for (unsigned i = 0, e = Node->getNumValues(); i != e; ++i)
RetTyVTs.push_back(Node->getValueType(i));
- Result = SDOperand(DAG.getCall(RetTyVTs, Tmp1, Tmp2, Ops), 0);
+ Result = SDOperand(DAG.getCall(RetTyVTs, Tmp1, Tmp2, Ops,
+ Node->getOpcode() == ISD::TAILCALL), 0);
} else {
Result = Result.getValue(0);
}
@@ -1689,6 +1691,7 @@ SDOperand SelectionDAGLegalize::PromoteOp(SDOperand Op) {
Tmp3 = PromoteOp(Node->getOperand(2)); // Legalize the op1
Result = DAG.getNode(ISD::SELECT, NVT, Tmp1, Tmp2, Tmp3);
break;
+ case ISD::TAILCALL:
case ISD::CALL: {
Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain.
Tmp2 = LegalizeOp(Node->getOperand(1)); // Legalize the callee.
@@ -1703,7 +1706,8 @@ SDOperand SelectionDAGLegalize::PromoteOp(SDOperand Op) {
RetTyVTs.reserve(2);
RetTyVTs.push_back(NVT);
RetTyVTs.push_back(MVT::Other);
- SDNode *NC = DAG.getCall(RetTyVTs, Tmp1, Tmp2, Ops);
+ SDNode *NC = DAG.getCall(RetTyVTs, Tmp1, Tmp2, Ops,
+ Node->getOpcode() == ISD::TAILCALL);
Result = SDOperand(NC, 0);
// Insert the new chain mapping.
@@ -2341,6 +2345,7 @@ void SelectionDAGLegalize::ExpandOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi){
std::swap(Lo, Hi);
break;
}
+ case ISD::TAILCALL:
case ISD::CALL: {
SDOperand Chain = LegalizeOp(Node->getOperand(0)); // Legalize the chain.
SDOperand Callee = LegalizeOp(Node->getOperand(1)); // Legalize the callee.
@@ -2360,7 +2365,8 @@ void SelectionDAGLegalize::ExpandOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi){
RetTyVTs.push_back(NVT);
RetTyVTs.push_back(NVT);
RetTyVTs.push_back(MVT::Other);
- SDNode *NC = DAG.getCall(RetTyVTs, Chain, Callee, Ops);
+ SDNode *NC = DAG.getCall(RetTyVTs, Chain, Callee, Ops,
+ Node->getOpcode() == ISD::TAILCALL);
Lo = SDOperand(NC, 0);
Hi = SDOperand(NC, 1);
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 79d41fca2a3..160afec63c5 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -1690,6 +1690,7 @@ const char *SDNode::getOperationName() const {
case ISD::BRCONDTWOWAY: return "brcondtwoway";
case ISD::RET: return "ret";
case ISD::CALL: return "call";
+ case ISD::TAILCALL:return "tailcall";
case ISD::CALLSEQ_START: return "callseq_start";
case ISD::CALLSEQ_END: return "callseq_end";
OpenPOWER on IntegriCloud