rename the ADJCALLSTACKDOWN/ADJCALLSTACKUP nodes to be CALLSEQ_START/BEGIN.
authorChris Lattner <sabre@nondot.org>
Thu, 12 May 2005 23:24:06 +0000 (23:24 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 12 May 2005 23:24:06 +0000 (23:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21915 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/SelectionDAGNodes.h
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
lib/Target/Alpha/AlphaISelPattern.cpp
lib/Target/IA64/IA64ISelPattern.cpp
lib/Target/PowerPC/PPC64ISelPattern.cpp
lib/Target/PowerPC/PPCISelPattern.cpp
lib/Target/X86/X86ISelPattern.cpp

index dbf11d7ee7b77b352ff539c3bdfd87ec755f5fe0..b3ac7db890eec740bf5e5609835c78655bb5530a 100644 (file)
@@ -245,12 +245,12 @@ namespace ISD {
     MEMMOVE,
     MEMCPY,
 
-    // ADJCALLSTACKDOWN/ADJCALLSTACKUP - These operators mark the beginning and
-    // end of a call sequence and indicate how much the stack pointer needs to
-    // be adjusted for that particular call.  The first operand is a chain, the
-    // second is a ConstantSDNode of intptr type.
-    ADJCALLSTACKDOWN,  // Beginning of a call sequence
-    ADJCALLSTACKUP,    // End of a call sequence
+    // CALLSEQ_START/CALLSEQ_END - These operators mark the beginning and end of
+    // a call sequence, and carry arbitrary information that target might want
+    // to know.  The first operand is a chain, the rest are specified by the
+    // target and not touched by the DAG optimizers.
+    CALLSEQ_START,  // Beginning of a call sequence
+    CALLSEQ_END,    // End of a call sequence
 
     // SRCVALUE - This corresponds to a Value*, and is used to associate memory
     // locations with their value.  This allows one use alias analysis
index a7f50812152c31ee84831ad5648dd29394e8eb27..b2a3ac97b91223b0e95a9e29484a50f1f3e59a9c 100644 (file)
@@ -323,8 +323,8 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
     break;
   }
 
-  case ISD::ADJCALLSTACKDOWN:
-  case ISD::ADJCALLSTACKUP:
+  case ISD::CALLSEQ_START:
+  case ISD::CALLSEQ_END:
     Tmp1 = LegalizeOp(Node->getOperand(0));  // Legalize the chain.
     // There is no need to legalize the size argument (Operand #1)
     Tmp2 = Node->getOperand(0);
@@ -339,7 +339,7 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
         DAG.getNode(ISD::PCMARKER, MVT::Other, Tmp2,
                     DAG.getConstant(0, MVT::i32));
     }
-    // Note that we do not create new ADJCALLSTACK DOWN/UP nodes here.  These
+    // Note that we do not create new CALLSEQ_DOWN/UP nodes here.  These
     // nodes are treated specially and are mutated in place.  This makes the dag
     // legalization process more efficient and also makes libcall insertion
     // easier.
@@ -1945,9 +1945,9 @@ bool SelectionDAGLegalize::ExpandShift(unsigned Opc, SDOperand Op,SDOperand Amt,
 static void FindLatestAdjCallStackDown(SDNode *Node, SDNode *&Found) {
   if (Node->getNodeDepth() <= Found->getNodeDepth()) return;
 
-  // If we found an ADJCALLSTACKDOWN, we already know this node occurs later
+  // If we found an CALLSEQ_START, we already know this node occurs later
   // than the Found node. Just remember this node and return.
-  if (Node->getOpcode() == ISD::ADJCALLSTACKDOWN) {
+  if (Node->getOpcode() == ISD::CALLSEQ_START) {
     Found = Node;
     return;
   }
@@ -1970,9 +1970,9 @@ static void FindLatestAdjCallStackDown(SDNode *Node, SDNode *&Found) {
 static void FindEarliestAdjCallStackUp(SDNode *Node, SDNode *&Found) {
   if (Found && Node->getNodeDepth() >= Found->getNodeDepth()) return;
 
-  // If we found an ADJCALLSTACKUP, we already know this node occurs earlier
+  // If we found an CALLSEQ_END, we already know this node occurs earlier
   // than the Found node. Just remember this node and return.
-  if (Node->getOpcode() == ISD::ADJCALLSTACKUP) {
+  if (Node->getOpcode() == ISD::CALLSEQ_END) {
     Found = Node;
     return;
   }
@@ -1988,9 +1988,9 @@ static void FindEarliestAdjCallStackUp(SDNode *Node, SDNode *&Found) {
 }
 
 /// FindAdjCallStackUp - Given a chained node that is part of a call sequence,
-/// find the ADJCALLSTACKUP node that terminates the call sequence.
+/// find the CALLSEQ_END node that terminates the call sequence.
 static SDNode *FindAdjCallStackUp(SDNode *Node) {
-  if (Node->getOpcode() == ISD::ADJCALLSTACKUP)
+  if (Node->getOpcode() == ISD::CALLSEQ_END)
     return Node;
   if (Node->use_empty())
     return 0;   // No adjcallstackup
@@ -2003,7 +2003,7 @@ static SDNode *FindAdjCallStackUp(SDNode *Node) {
 
   for (SDNode::use_iterator UI = Node->use_begin(),
          E = Node->use_end(); ; ++UI) {
-    assert(UI != E && "Didn't find a user of the tokchain, no ADJCALLSTACKUP!");
+    assert(UI != E && "Didn't find a user of the tokchain, no CALLSEQ_END!");
 
     // Make sure to only follow users of our token chain.
     SDNode *User = *UI;
@@ -2016,10 +2016,10 @@ static SDNode *FindAdjCallStackUp(SDNode *Node) {
 }
 
 /// FindAdjCallStackDown - Given a chained node that is part of a call sequence,
-/// find the ADJCALLSTACKDOWN node that initiates the call sequence.
+/// find the CALLSEQ_START node that initiates the call sequence.
 static SDNode *FindAdjCallStackDown(SDNode *Node) {
   assert(Node && "Didn't find adjcallstackdown for a call??");
-  if (Node->getOpcode() == ISD::ADJCALLSTACKDOWN) return Node;
+  if (Node->getOpcode() == ISD::CALLSEQ_START) return Node;
 
   assert(Node->getOperand(0).getValueType() == MVT::Other &&
          "Node doesn't have a token chain argument!");
@@ -2040,11 +2040,11 @@ static SDOperand FindInputOutputChains(SDNode *OpNode, SDNode *&OutChain,
   FindLatestAdjCallStackDown(OpNode, LatestAdjCallStackDown);
   //std::cerr<<"Found node: "; LatestAdjCallStackDown->dump(); std::cerr <<"\n";
 
-  // It is possible that no ISD::ADJCALLSTACKDOWN was found because there is no
+  // It is possible that no ISD::CALLSEQ_START was found because there is no
   // previous call in the function.  LatestCallStackDown may in that case be
-  // the entry node itself.  Do not attempt to find a matching ADJCALLSTACKUP
-  // unless LatestCallStackDown is an ADJCALLSTACKDOWN.
-  if (LatestAdjCallStackDown->getOpcode() == ISD::ADJCALLSTACKDOWN)
+  // the entry node itself.  Do not attempt to find a matching CALLSEQ_END
+  // unless LatestCallStackDown is an CALLSEQ_START.
+  if (LatestAdjCallStackDown->getOpcode() == ISD::CALLSEQ_START)
     LatestAdjCallStackUp = FindAdjCallStackUp(LatestAdjCallStackDown);
   else
     LatestAdjCallStackUp = Entry.Val;
index 1ca213b44403b7acafcac85463f776c2d7fb7e22..6fa0d926a7f0d728be4c16ba5a6a8bd0942cc8ed 100644 (file)
@@ -1194,7 +1194,7 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
 
   // Memoize this node if possible.
   SDNode *N;
-  if (Opcode != ISD::ADJCALLSTACKDOWN && Opcode != ISD::ADJCALLSTACKUP) {
+  if (Opcode != ISD::CALLSEQ_START && Opcode != ISD::CALLSEQ_END) {
     SDNode *&BON = BinaryOps[std::make_pair(Opcode, std::make_pair(N1, N2))];
     if (BON) return SDOperand(BON, 0);
 
@@ -1214,11 +1214,11 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
 }
 
 // setAdjCallChain - This method changes the token chain of an
-// ADJCALLSTACKDOWN/UP node to be the specified operand.
+// CALLSEQ_START/END node to be the specified operand.
 void SDNode::setAdjCallChain(SDOperand N) {
   assert(N.getValueType() == MVT::Other);
-  assert((getOpcode() == ISD::ADJCALLSTACKDOWN ||
-          getOpcode() == ISD::ADJCALLSTACKUP) && "Cannot adjust this node!");
+  assert((getOpcode() == ISD::CALLSEQ_START ||
+          getOpcode() == ISD::CALLSEQ_END) && "Cannot adjust this node!");
 
   Operands[0].Val->removeUser(this);
   Operands[0] = N;
@@ -1690,8 +1690,8 @@ const char *SDNode::getOperationName() const {
   case ISD::BRCONDTWOWAY:  return "brcondtwoway";
   case ISD::RET:     return "ret";
   case ISD::CALL:    return "call";
-  case ISD::ADJCALLSTACKDOWN:  return "adjcallstackdown";
-  case ISD::ADJCALLSTACKUP:    return "adjcallstackup";
+  case ISD::CALLSEQ_START:  return "callseq_end";
+  case ISD::CALLSEQ_END:    return "callseq_start";
 
     // Other operators
   case ISD::LOAD:    return "load";
index b5f93b0548b658434cbdc03362c405838226c354..9a9e587c75220f8123aad16d0022180787875118 100644 (file)
@@ -311,7 +311,7 @@ AlphaTargetLowering::LowerCallTo(SDOperand Chain,
   if (Args.size() > 6)
     NumBytes = (Args.size() - 6) * 8;
 
-  Chain = DAG.getNode(ISD::ADJCALLSTACKDOWN, MVT::Other, Chain,
+  Chain = DAG.getNode(ISD::CALLSEQ_START, MVT::Other, Chain,
                       DAG.getConstant(NumBytes, getPointerTy()));
   std::vector<SDOperand> args_to_use;
   for (unsigned i = 0, e = Args.size(); i != e; ++i)
@@ -346,7 +346,7 @@ AlphaTargetLowering::LowerCallTo(SDOperand Chain,
   SDOperand TheCall = SDOperand(DAG.getCall(RetVals,
                                             Chain, Callee, args_to_use), 0);
   Chain = TheCall.getValue(RetTyVT != MVT::isVoid);
-  Chain = DAG.getNode(ISD::ADJCALLSTACKUP, MVT::Other, Chain,
+  Chain = DAG.getNode(ISD::CALLSEQ_END, MVT::Other, Chain,
                       DAG.getConstant(NumBytes, getPointerTy()));
   return std::make_pair(TheCall, Chain);
 }
@@ -2247,12 +2247,12 @@ void ISel::Select(SDOperand N) {
     SelectExpr(N);
     return;
 
-  case ISD::ADJCALLSTACKDOWN:
-  case ISD::ADJCALLSTACKUP:
+  case ISD::CALLSEQ_START:
+  case ISD::CALLSEQ_END:
     Select(N.getOperand(0));
     Tmp1 = cast<ConstantSDNode>(N.getOperand(1))->getValue();
 
-    Opc = N.getOpcode() == ISD::ADJCALLSTACKDOWN ? Alpha::ADJUSTSTACKDOWN :
+    Opc = N.getOpcode() == ISD::CALLSEQ_START ? Alpha::ADJUSTSTACKDOWN :
       Alpha::ADJUSTSTACKUP;
     BuildMI(BB, Opc, 1).addImm(Tmp1);
     return;
index cbbd619f0b84ece970765e1962666307a9e38472..200563255580067e8b14ee1cc070019fbd39720e 100644 (file)
@@ -333,7 +333,7 @@ IA64TargetLowering::LowerCallTo(SDOperand Chain,
   MF.getInfo<IA64FunctionInfo>()->outRegsUsed=
     std::max(outRegsUsed, MF.getInfo<IA64FunctionInfo>()->outRegsUsed);
 
-  Chain = DAG.getNode(ISD::ADJCALLSTACKDOWN, MVT::Other, Chain,
+  Chain = DAG.getNode(ISD::CALLSEQ_START, MVT::Other, Chain,
                         DAG.getConstant(NumBytes, getPointerTy()));
 
   std::vector<SDOperand> args_to_use;
@@ -373,7 +373,7 @@ IA64TargetLowering::LowerCallTo(SDOperand Chain,
   SDOperand TheCall = SDOperand(DAG.getCall(RetVals, Chain,
                                             Callee, args_to_use), 0);
   Chain = TheCall.getValue(RetTyVT != MVT::isVoid);
-  Chain = DAG.getNode(ISD::ADJCALLSTACKUP, MVT::Other, Chain,
+  Chain = DAG.getNode(ISD::CALLSEQ_END, MVT::Other, Chain,
                       DAG.getConstant(NumBytes, getPointerTy()));
   return std::make_pair(TheCall, Chain);
 }
@@ -2425,13 +2425,13 @@ void ISel::Select(SDOperand N) {
     return;
   }
 
-  case ISD::ADJCALLSTACKDOWN:
-  case ISD::ADJCALLSTACKUP: {
+  case ISD::CALLSEQ_START:
+  case ISD::CALLSEQ_END: {
     Select(N.getOperand(0));
     Tmp1 = cast<ConstantSDNode>(N.getOperand(1))->getValue();
 
-    Opc = N.getOpcode() == ISD::ADJCALLSTACKDOWN ? IA64::ADJUSTCALLSTACKDOWN :
-                                                   IA64::ADJUSTCALLSTACKUP;
+    Opc = N.getOpcode() == ISD::CALLSEQ_START ? IA64::ADJUSTCALLSTACKDOWN :
+                                                IA64::ADJUSTCALLSTACKUP;
     BuildMI(BB, Opc, 1).addImm(Tmp1);
     return;
   }
index 816d82a8ac613453173feb1d2cc15f297b705f3b..a91223d46945c4f88d1f632479fba49f3d9fe0cd 100644 (file)
@@ -247,7 +247,7 @@ PPC64TargetLowering::LowerCallTo(SDOperand Chain,
   unsigned NumBytes = 48;
 
   if (Args.empty()) {
-    Chain = DAG.getNode(ISD::ADJCALLSTACKDOWN, MVT::Other, Chain,
+    Chain = DAG.getNode(ISD::CALLSEQ_START, MVT::Other, Chain,
                         DAG.getConstant(NumBytes, getPointerTy()));
   } else {
     NumBytes = 8 * Args.size(); // All arguments are rounded up to 8 bytes
@@ -258,7 +258,7 @@ PPC64TargetLowering::LowerCallTo(SDOperand Chain,
 
     // Adjust the stack pointer for the new arguments...
     // These operations are automatically eliminated by the prolog/epilog pass
-    Chain = DAG.getNode(ISD::ADJCALLSTACKDOWN, MVT::Other, Chain,
+    Chain = DAG.getNode(ISD::CALLSEQ_START, MVT::Other, Chain,
                         DAG.getConstant(NumBytes, getPointerTy()));
 
     // Set up a copy of the stack pointer for use loading and storing any
@@ -351,7 +351,7 @@ PPC64TargetLowering::LowerCallTo(SDOperand Chain,
   SDOperand TheCall = SDOperand(DAG.getCall(RetVals,
                                             Chain, Callee, args_to_use), 0);
   Chain = TheCall.getValue(RetTyVT != MVT::isVoid);
-  Chain = DAG.getNode(ISD::ADJCALLSTACKUP, MVT::Other, Chain,
+  Chain = DAG.getNode(ISD::CALLSEQ_END, MVT::Other, Chain,
                       DAG.getConstant(NumBytes, getPointerTy()));
   return std::make_pair(TheCall, Chain);
 }
@@ -1495,11 +1495,11 @@ void ISel::Select(SDOperand N) {
     for (unsigned i = 0, e = Node->getNumOperands(); i != e; ++i)
       Select(Node->getOperand(i));
     return;
-  case ISD::ADJCALLSTACKDOWN:
-  case ISD::ADJCALLSTACKUP:
+  case ISD::CALLSEQ_START:
+  case ISD::CALLSEQ_END:
     Select(N.getOperand(0));
     Tmp1 = cast<ConstantSDNode>(N.getOperand(1))->getValue();
-    Opc = N.getOpcode() == ISD::ADJCALLSTACKDOWN ? PPC::ADJCALLSTACKDOWN :
+    Opc = N.getOpcode() == ISD::CALLSEQ_START ? PPC::ADJCALLSTACKDOWN :
       PPC::ADJCALLSTACKUP;
     BuildMI(BB, Opc, 1).addImm(Tmp1);
     return;
index 80091ecc3ba053b0e16d4c226aea0f8ac37c0799..2551771999cba7af4cc0ae4bb85b323891b4d122 100644 (file)
@@ -291,7 +291,7 @@ PPC32TargetLowering::LowerCallTo(SDOperand Chain,
   unsigned NumBytes = 24;
 
   if (Args.empty()) {
-    Chain = DAG.getNode(ISD::ADJCALLSTACKDOWN, MVT::Other, Chain,
+    Chain = DAG.getNode(ISD::CALLSEQ_START, MVT::Other, Chain,
                         DAG.getConstant(NumBytes, getPointerTy()));
   } else {
     for (unsigned i = 0, e = Args.size(); i != e; ++i)
@@ -316,7 +316,7 @@ PPC32TargetLowering::LowerCallTo(SDOperand Chain,
 
     // Adjust the stack pointer for the new arguments...
     // These operations are automatically eliminated by the prolog/epilog pass
-    Chain = DAG.getNode(ISD::ADJCALLSTACKDOWN, MVT::Other, Chain,
+    Chain = DAG.getNode(ISD::CALLSEQ_START, MVT::Other, Chain,
                         DAG.getConstant(NumBytes, getPointerTy()));
 
     // Set up a copy of the stack pointer for use loading and storing any
@@ -447,7 +447,7 @@ PPC32TargetLowering::LowerCallTo(SDOperand Chain,
   SDOperand TheCall = SDOperand(DAG.getCall(RetVals,
                                             Chain, Callee, args_to_use), 0);
   Chain = TheCall.getValue(RetTyVT != MVT::isVoid);
-  Chain = DAG.getNode(ISD::ADJCALLSTACKUP, MVT::Other, Chain,
+  Chain = DAG.getNode(ISD::CALLSEQ_END, MVT::Other, Chain,
                       DAG.getConstant(NumBytes, getPointerTy()));
   return std::make_pair(TheCall, Chain);
 }
@@ -2382,11 +2382,11 @@ void ISel::Select(SDOperand N) {
     for (unsigned i = 0, e = Node->getNumOperands(); i != e; ++i)
       Select(Node->getOperand(i));
     return;
-  case ISD::ADJCALLSTACKDOWN:
-  case ISD::ADJCALLSTACKUP:
+  case ISD::CALLSEQ_START:
+  case ISD::CALLSEQ_END:
     Select(N.getOperand(0));
     Tmp1 = cast<ConstantSDNode>(N.getOperand(1))->getValue();
-    Opc = N.getOpcode() == ISD::ADJCALLSTACKDOWN ? PPC::ADJCALLSTACKDOWN :
+    Opc = N.getOpcode() == ISD::CALLSEQ_START ? PPC::ADJCALLSTACKDOWN :
       PPC::ADJCALLSTACKUP;
     BuildMI(BB, Opc, 1).addImm(Tmp1);
     return;
index 092c2641aa63bf3e5b08c21ca07424b35d7e9c17..dd88367209cf337e22a0522b2de2dcaf3914547c 100644 (file)
@@ -257,7 +257,7 @@ X86TargetLowering::LowerCCCCallTo(SDOperand Chain, const Type *RetTy,
 
   if (Args.empty()) {
     // Save zero bytes.
-    Chain = DAG.getNode(ISD::ADJCALLSTACKDOWN, MVT::Other, Chain,
+    Chain = DAG.getNode(ISD::CALLSEQ_START, MVT::Other, Chain,
                         DAG.getConstant(0, getPointerTy()));
   } else {
     for (unsigned i = 0, e = Args.size(); i != e; ++i)
@@ -276,7 +276,7 @@ X86TargetLowering::LowerCCCCallTo(SDOperand Chain, const Type *RetTy,
         break;
       }
 
-    Chain = DAG.getNode(ISD::ADJCALLSTACKDOWN, MVT::Other, Chain,
+    Chain = DAG.getNode(ISD::CALLSEQ_START, MVT::Other, Chain,
                         DAG.getConstant(NumBytes, getPointerTy()));
 
     // Arguments go on the stack in reverse order, as specified by the ABI.
@@ -329,7 +329,7 @@ X86TargetLowering::LowerCCCCallTo(SDOperand Chain, const Type *RetTy,
 
   SDOperand TheCall = SDOperand(DAG.getCall(RetVals, Chain, Callee), 0);
   Chain = TheCall.getValue(RetTyVT != MVT::isVoid);
-  Chain = DAG.getNode(ISD::ADJCALLSTACKUP, MVT::Other, Chain,
+  Chain = DAG.getNode(ISD::CALLSEQ_END, MVT::Other, Chain,
                       DAG.getConstant(NumBytes, getPointerTy()));
   return std::make_pair(TheCall, Chain);
 }
@@ -578,7 +578,7 @@ X86TargetLowering::LowerFastCCCallTo(SDOperand Chain, const Type *RetTy,
       break;
     }
 
-  Chain = DAG.getNode(ISD::ADJCALLSTACKDOWN, MVT::Other, Chain,
+  Chain = DAG.getNode(ISD::CALLSEQ_START, MVT::Other, Chain,
                       DAG.getConstant(NumBytes, getPointerTy()));
 
   // Arguments go on the stack in reverse order, as specified by the ABI.
@@ -655,7 +655,7 @@ X86TargetLowering::LowerFastCCCallTo(SDOperand Chain, const Type *RetTy,
   SDOperand TheCall = SDOperand(DAG.getCall(RetVals, Chain, Callee,
                                             RegValuesToPass), 0);
   Chain = TheCall.getValue(RetTyVT != MVT::isVoid);
-  Chain = DAG.getNode(ISD::ADJCALLSTACKUP, MVT::Other, Chain,
+  Chain = DAG.getNode(ISD::CALLSEQ_END, MVT::Other, Chain,
                       DAG.getConstant(NumBytes, getPointerTy()));
   return std::make_pair(TheCall, Chain);
 }
@@ -3669,13 +3669,13 @@ void ISel::Select(SDOperand N) {
     addFullAddress(BuildMI(BB, Opc, 4+1), AM).addReg(Tmp1);
     return;
   }
-  case ISD::ADJCALLSTACKDOWN:
-  case ISD::ADJCALLSTACKUP:
+  case ISD::CALLSEQ_START:
+  case ISD::CALLSEQ_END:
     Select(N.getOperand(0));
     Tmp1 = cast<ConstantSDNode>(N.getOperand(1))->getValue();
 
-    Opc = N.getOpcode() == ISD::ADJCALLSTACKDOWN ? X86::ADJCALLSTACKDOWN :
-                                                   X86::ADJCALLSTACKUP;
+    Opc = N.getOpcode() == ISD::CALLSEQ_START ? X86::ADJCALLSTACKDOWN :
+                                                X86::ADJCALLSTACKUP;
     BuildMI(BB, Opc, 1).addImm(Tmp1);
     return;
   case ISD::MEMSET: {