llvm.org GIT mirror llvm / b191e0a
add support for calling functions when the caller has variable sized objects git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31312 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 13 years ago
2 changed file(s) with 23 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
1818 #include "llvm/CodeGen/MachineFrameInfo.h"
1919 #include "llvm/CodeGen/MachineLocation.h"
2020 #include "llvm/Type.h"
21 #include "llvm/Target/TargetFrameInfo.h"
22 #include "llvm/Target/TargetMachine.h"
2123 #include "llvm/Target/TargetOptions.h"
2224 #include "llvm/ADT/STLExtras.h"
2325 #include
98100 eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
99101 MachineBasicBlock::iterator I) const {
100102 if (hasFP(MF)) {
101 assert(0);
103 MachineInstr *Old = I;
104 unsigned Amount = Old->getOperand(0).getImmedValue();
105 if (Amount != 0) {
106 unsigned Align = MF.getTarget().getFrameInfo()->getStackAlignment();
107 Amount = (Amount+Align-1)/Align*Align;
108
109 if (Old->getOpcode() == ARM::ADJCALLSTACKDOWN) {
110 // sub sp, sp, amount
111 BuildMI(MBB, I, ARM::SUB, 2, ARM::R13).addReg(ARM::R13).addImm(Amount)
112 .addImm(0).addImm(ARMShift::LSL);
113 } else {
114 // add sp, sp, amount
115 assert(Old->getOpcode() == ARM::ADJCALLSTACKUP);
116 BuildMI(MBB, I, ARM::ADD, 2, ARM::R13).addReg(ARM::R13).addImm(Amount)
117 .addImm(0).addImm(ARMShift::LSL);
118 }
119 }
102120 }
103121 MBB.erase(I);
104122 }
0 ; RUN: llvm-as < %s | llc -march=arm
11 void %f(uint %a) {
22 entry:
3 %tmp1032 = alloca ubyte, uint %a
3 %tmp = alloca sbyte, uint %a
4 call void %g( sbyte* %tmp, uint %a, uint 1, uint 2, uint 3 )
45 ret void
56 }
7
8 declare void %g(sbyte*, uint, uint, uint, uint)