explain that r12 is the stack pointer reg
authorDuraid Madina <duraid@octopus.com.au>
Sun, 15 Jan 2006 09:45:23 +0000 (09:45 +0000)
committerDuraid Madina <duraid@octopus.com.au>
Sun, 15 Jan 2006 09:45:23 +0000 (09:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25336 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/IA64/IA64ISelDAGToDAG.cpp
lib/Target/IA64/IA64ISelLowering.cpp

index f8827ea06b83159049fea04e28b20438baa0bc15..f81946584e80e2972a3e87b66737c11172c9d71f 100644 (file)
@@ -450,37 +450,6 @@ SDOperand IA64DAGToDAGISel::Select(SDOperand Op) {
   case ISD::SREM:
   case ISD::UREM: return SelectDIV(Op);
  
-  case ISD::DYNAMIC_STACKALLOC: {
-    if (!isa<ConstantSDNode>(N->getOperand(2)) ||
-        cast<ConstantSDNode>(N->getOperand(2))->getValue() != 0) {
-      std::cerr << "Cannot allocate stack object with greater alignment than"
-                << " the stack alignment yet!";
-      abort();
-    }
-
-    SDOperand Chain = Select(N->getOperand(0));
-    SDOperand Amt   = Select(N->getOperand(1));
-    SDOperand Reg = CurDAG->getRegister(IA64::r12, MVT::i64);
-    SDOperand Val = CurDAG->getCopyFromReg(Chain, IA64::r12, MVT::i64);
-    Chain = Val.getValue(1);
-    
-    // Subtract the amount (guaranteed to be a multiple of the stack alignment)
-    // from the stack pointer, giving us the result pointer.
-    SDOperand Result = Select(CurDAG->getNode(ISD::SUB, MVT::i64, Val, Amt));
-    
-    // Copy this result back into r12.
-    Chain = CurDAG->getNode(ISD::CopyToReg, MVT::Other, Chain, Reg, Result);
-    
-    // Copy this result back out of r12 to make sure we're not using the stack
-    // space without decrementing the stack pointer.
-    Result = CurDAG->getCopyFromReg(Chain, IA64::r12, MVT::i64);
-  
-    // Finally, replace the DYNAMIC_STACKALLOC with the copyfromreg.
-    CodeGenMap[Op.getValue(0)] = Result;
-    CodeGenMap[Op.getValue(1)] = Result.getValue(1);
-    return SDOperand(Result.Val, Op.ResNo);
-  }
-
   case ISD::ConstantFP: {
     SDOperand Chain = CurDAG->getEntryNode(); // this is a constant, so..
 
@@ -501,7 +470,8 @@ SDOperand IA64DAGToDAGISel::Select(SDOperand Op) {
                                 CurDAG->getTargetFrameIndex(FI, MVT::i64));
   }
 
-  case ISD::ConstantPool: {
+  case ISD::ConstantPool: { // TODO: nuke the constant pool
+                           //       (ia64 doesn't need one)
     Constant *C = cast<ConstantPoolSDNode>(N)->get();
     SDOperand CPI = CurDAG->getTargetConstantPool(C, MVT::i64);
     return CurDAG->getTargetNode(IA64::ADDL_GA, MVT::i64, // ?
index 61ec833a458d5569299f484bc2e4188ef05891e7..a9ce9df2b9d31800a83d0922d44e0693753240d5 100644 (file)
@@ -84,9 +84,11 @@ IA64TargetLowering::IA64TargetLowering(TargetMachine &TM)
       setOperationAction(ISD::ROTR , MVT::i64  , Expand);
       setOperationAction(ISD::BSWAP, MVT::i64  , Expand);  // mux @rev
 
-      // Not implemented yet.
       setOperationAction(ISD::STACKSAVE, MVT::Other, Expand);
       setOperationAction(ISD::STACKRESTORE, MVT::Other, Expand);
+      setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i64, Expand);
+
+      setStackPointerRegisterToSaveRestore(IA64::r12);
 
       computeRegisterProperties();