Implement dynamic allocas

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75985 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/SystemZ/SystemZISelLowering.cpp b/lib/Target/SystemZ/SystemZISelLowering.cpp
index e50dc4f..c1004e1 100644
--- a/lib/Target/SystemZ/SystemZISelLowering.cpp
+++ b/lib/Target/SystemZ/SystemZISelLowering.cpp
@@ -68,6 +68,7 @@
   setOperationAction(ISD::BR_CC,            MVT::i64, Custom);
   setOperationAction(ISD::GlobalAddress,    MVT::i64, Custom);
   setOperationAction(ISD::JumpTable,        MVT::i64, Custom);
+  setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i64, Expand);
 
   // FIXME: Can we lower these 2 efficiently?
   setOperationAction(ISD::SETCC,            MVT::i32, Expand);
diff --git a/lib/Target/SystemZ/SystemZRegisterInfo.cpp b/lib/Target/SystemZ/SystemZRegisterInfo.cpp
index 087da0b..fe116b6 100644
--- a/lib/Target/SystemZ/SystemZRegisterInfo.cpp
+++ b/lib/Target/SystemZ/SystemZRegisterInfo.cpp
@@ -85,7 +85,13 @@
 eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
                               MachineBasicBlock::iterator I) const {
   if (!hasReservedCallFrame(MF)) {
-    assert(0 && "Not implemented yet!");
+    // If the stack pointer can be changed after prologue, turn the
+    // adjcallstackup instruction into a 'sub R15, <amt>' and the
+    // adjcallstackdown instruction into 'add R15, <amt>'
+    MachineInstr *Old = I;
+    uint64_t Amount = Old->getOperand(0).getImm();
+
+    assert((Amount == 0) && "Not implemented yet!");
   }
 
   MBB.erase(I);