llvm.org GIT mirror llvm / 3557463
initial prologue and epilogue implementation. Need to define add and sub before finishing it :-) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29175 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 14 years ago
2 changed file(s) with 23 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
5252 "!ADJCALLSTACKDOWN $amt",
5353 [(callseq_start imm:$amt)]>;
5454
55 def bxr: InstARM<(ops IntRegs:$dst), "bx $dst", [(brind IntRegs:$dst)]>;
55 let isReturn = 1 in {
56 def bx: InstARM<(ops IntRegs:$dst), "bx $dst", [(brind IntRegs:$dst)]>;
57 }
5658
5759 def bl: InstARM<(ops i32imm:$func, variable_ops), "bl $func", [(ARMcall tglobaladdr:$func)]>;
5860
115115 processFunctionBeforeFrameFinalized(MachineFunction &MF) const {}
116116
117117 void ARMRegisterInfo::emitPrologue(MachineFunction &MF) const {
118 MachineBasicBlock &MBB = MF.front();
119 MachineFrameInfo *MFI = MF.getFrameInfo();
120 int NumBytes = (int) MFI->getStackSize();
121
122 //hack
123 assert(NumBytes == 0);
124
125 //add a sp = sp - 4
126 BuildMI(MBB, MBB.begin(), ARM::str, 1, ARM::R14).addReg(ARM::R13);
118127 }
119128
120129 void ARMRegisterInfo::emitEpilogue(MachineFunction &MF,
121130 MachineBasicBlock &MBB) const {
131 MachineBasicBlock::iterator MBBI = prior(MBB.end());
132 assert(MBBI->getOpcode() == ARM::bx &&
133 "Can only insert epilog into returning blocks");
134
135 MachineFrameInfo *MFI = MF.getFrameInfo();
136 int NumBytes = (int) MFI->getStackSize();
137 //hack
138 assert(NumBytes == 0);
139
140 BuildMI(MBB, MBBI, ARM::ldr, 2, ARM::R14).addImm(0).addReg(ARM::R13);
141 //add a sp = sp + 4
122142 }
123143
124144 unsigned ARMRegisterInfo::getRARegister() const {