Autogen matching code for ADJCALLSTACK[UP|DOWN], thanks to Evan's tblgen
authorChris Lattner <sabre@nondot.org>
Sun, 4 Dec 2005 19:01:59 +0000 (19:01 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 4 Dec 2005 19:01:59 +0000 (19:01 +0000)
improvements.

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

lib/Target/PowerPC/PPCISelDAGToDAG.cpp
lib/Target/PowerPC/PPCInstrInfo.td

index 9ed7de498093712cbeb6275caf77e20241771b4f..368a8cf0f6bb2c8bfbb17f21c472a32a7859e74d 100644 (file)
@@ -1190,14 +1190,6 @@ SDOperand PPCDAGToDAGISel::Select(SDOperand Op) {
                                 getI32Imm(BROpc));
   }
     
-  case ISD::CALLSEQ_START:
-  case ISD::CALLSEQ_END: {
-    unsigned Amt = cast<ConstantSDNode>(N->getOperand(1))->getValue();
-    unsigned Opc = N->getOpcode() == ISD::CALLSEQ_START ?
-                       PPC::ADJCALLSTACKDOWN : PPC::ADJCALLSTACKUP;
-    return CurDAG->SelectNodeTo(N, Opc, MVT::Other,
-                                getI32Imm(Amt), Select(N->getOperand(0)));
-  }
   case ISD::RET: {
     SDOperand Chain = Select(N->getOperand(0));     // Token chain.
 
index ad8f91e06bab2699068c4302feb7a6623f4ac2fd..ba8609611c90f658ca242774ebbfaff9b0fa653a 100644 (file)
@@ -30,6 +30,11 @@ def PPCfsel   : SDNode<"PPCISD::FSEL",
 def PPChi     : SDNode<"PPCISD::Hi", SDTIntBinOp, []>;
 def PPClo     : SDNode<"PPCISD::Lo", SDTIntBinOp, []>;
 
+// These are target-independent nodes, but have target-specific formats.
+def SDT_PPCCallSeq : SDTypeProfile<0, 1, [ SDTCisVT<0, i32> ]>;
+def callseq_start : SDNode<"ISD::CALLSEQ_START", SDT_PPCCallSeq,[SDNPHasChain]>;
+def callseq_end   : SDNode<"ISD::CALLSEQ_END",   SDT_PPCCallSeq,[SDNPHasChain]>;
+
 //===----------------------------------------------------------------------===//
 // PowerPC specific transformation functions and pattern fragments.
 //
@@ -158,9 +163,13 @@ def crbitm: Operand<i8> {
 // Pseudo-instructions:
 def PHI : Pseudo<(ops variable_ops), "; PHI", []>;
 
-let isLoad = 1 in {
-def ADJCALLSTACKDOWN : Pseudo<(ops u16imm:$amt), "; ADJCALLSTACKDOWN", []>;
-def ADJCALLSTACKUP : Pseudo<(ops u16imm:$amt), "; ADJCALLSTACKUP", []>;
+let isLoad = 1, hasCtrlDep = 1 in {
+def ADJCALLSTACKDOWN : Pseudo<(ops u16imm:$amt),
+                              "; ADJCALLSTACKDOWN",
+                              [(callseq_start imm:$amt)]>;
+def ADJCALLSTACKUP   : Pseudo<(ops u16imm:$amt),
+                              "; ADJCALLSTACKUP",
+                              [(callseq_end imm:$amt)]>;
 }
 def IMPLICIT_DEF_GPR : Pseudo<(ops GPRC:$rD), "; $rD = IMPLICIT_DEF_GPRC",
                               [(set GPRC:$rD, (undef))]>;