1*9880d681SAndroid Build Coastguard Worker //===----- X86WinAllocaExpander.cpp - Expand WinAlloca pseudo instruction -===//
2*9880d681SAndroid Build Coastguard Worker //
3*9880d681SAndroid Build Coastguard Worker // The LLVM Compiler Infrastructure
4*9880d681SAndroid Build Coastguard Worker //
5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source
6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details.
7*9880d681SAndroid Build Coastguard Worker //
8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
9*9880d681SAndroid Build Coastguard Worker //
10*9880d681SAndroid Build Coastguard Worker // This file defines a pass that expands WinAlloca pseudo-instructions.
11*9880d681SAndroid Build Coastguard Worker //
12*9880d681SAndroid Build Coastguard Worker // It performs a conservative analysis to determine whether each allocation
13*9880d681SAndroid Build Coastguard Worker // falls within a region of the stack that is safe to use, or whether stack
14*9880d681SAndroid Build Coastguard Worker // probes must be emitted.
15*9880d681SAndroid Build Coastguard Worker //
16*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Worker #include "X86.h"
19*9880d681SAndroid Build Coastguard Worker #include "X86InstrBuilder.h"
20*9880d681SAndroid Build Coastguard Worker #include "X86InstrInfo.h"
21*9880d681SAndroid Build Coastguard Worker #include "X86MachineFunctionInfo.h"
22*9880d681SAndroid Build Coastguard Worker #include "X86Subtarget.h"
23*9880d681SAndroid Build Coastguard Worker #include "llvm/ADT/PostOrderIterator.h"
24*9880d681SAndroid Build Coastguard Worker #include "llvm/CodeGen/MachineFunctionPass.h"
25*9880d681SAndroid Build Coastguard Worker #include "llvm/CodeGen/MachineInstrBuilder.h"
26*9880d681SAndroid Build Coastguard Worker #include "llvm/CodeGen/MachineRegisterInfo.h"
27*9880d681SAndroid Build Coastguard Worker #include "llvm/CodeGen/Passes.h"
28*9880d681SAndroid Build Coastguard Worker #include "llvm/IR/Function.h"
29*9880d681SAndroid Build Coastguard Worker #include "llvm/Support/raw_ostream.h"
30*9880d681SAndroid Build Coastguard Worker #include "llvm/Target/TargetInstrInfo.h"
31*9880d681SAndroid Build Coastguard Worker
32*9880d681SAndroid Build Coastguard Worker using namespace llvm;
33*9880d681SAndroid Build Coastguard Worker
34*9880d681SAndroid Build Coastguard Worker namespace {
35*9880d681SAndroid Build Coastguard Worker
36*9880d681SAndroid Build Coastguard Worker class X86WinAllocaExpander : public MachineFunctionPass {
37*9880d681SAndroid Build Coastguard Worker public:
X86WinAllocaExpander()38*9880d681SAndroid Build Coastguard Worker X86WinAllocaExpander() : MachineFunctionPass(ID) {}
39*9880d681SAndroid Build Coastguard Worker
40*9880d681SAndroid Build Coastguard Worker bool runOnMachineFunction(MachineFunction &MF) override;
41*9880d681SAndroid Build Coastguard Worker
42*9880d681SAndroid Build Coastguard Worker private:
43*9880d681SAndroid Build Coastguard Worker /// Strategies for lowering a WinAlloca.
44*9880d681SAndroid Build Coastguard Worker enum Lowering { TouchAndSub, Sub, Probe };
45*9880d681SAndroid Build Coastguard Worker
46*9880d681SAndroid Build Coastguard Worker /// Deterministic-order map from WinAlloca instruction to desired lowering.
47*9880d681SAndroid Build Coastguard Worker typedef MapVector<MachineInstr*, Lowering> LoweringMap;
48*9880d681SAndroid Build Coastguard Worker
49*9880d681SAndroid Build Coastguard Worker /// Compute which lowering to use for each WinAlloca instruction.
50*9880d681SAndroid Build Coastguard Worker void computeLowerings(MachineFunction &MF, LoweringMap& Lowerings);
51*9880d681SAndroid Build Coastguard Worker
52*9880d681SAndroid Build Coastguard Worker /// Get the appropriate lowering based on current offset and amount.
53*9880d681SAndroid Build Coastguard Worker Lowering getLowering(int64_t CurrentOffset, int64_t AllocaAmount);
54*9880d681SAndroid Build Coastguard Worker
55*9880d681SAndroid Build Coastguard Worker /// Lower a WinAlloca instruction.
56*9880d681SAndroid Build Coastguard Worker void lower(MachineInstr* MI, Lowering L);
57*9880d681SAndroid Build Coastguard Worker
58*9880d681SAndroid Build Coastguard Worker MachineRegisterInfo *MRI;
59*9880d681SAndroid Build Coastguard Worker const X86Subtarget *STI;
60*9880d681SAndroid Build Coastguard Worker const TargetInstrInfo *TII;
61*9880d681SAndroid Build Coastguard Worker const X86RegisterInfo *TRI;
62*9880d681SAndroid Build Coastguard Worker unsigned StackPtr;
63*9880d681SAndroid Build Coastguard Worker unsigned SlotSize;
64*9880d681SAndroid Build Coastguard Worker int64_t StackProbeSize;
65*9880d681SAndroid Build Coastguard Worker
getPassName() const66*9880d681SAndroid Build Coastguard Worker const char *getPassName() const override { return "X86 WinAlloca Expander"; }
67*9880d681SAndroid Build Coastguard Worker static char ID;
68*9880d681SAndroid Build Coastguard Worker };
69*9880d681SAndroid Build Coastguard Worker
70*9880d681SAndroid Build Coastguard Worker char X86WinAllocaExpander::ID = 0;
71*9880d681SAndroid Build Coastguard Worker
72*9880d681SAndroid Build Coastguard Worker } // end anonymous namespace
73*9880d681SAndroid Build Coastguard Worker
createX86WinAllocaExpander()74*9880d681SAndroid Build Coastguard Worker FunctionPass *llvm::createX86WinAllocaExpander() {
75*9880d681SAndroid Build Coastguard Worker return new X86WinAllocaExpander();
76*9880d681SAndroid Build Coastguard Worker }
77*9880d681SAndroid Build Coastguard Worker
78*9880d681SAndroid Build Coastguard Worker /// Return the allocation amount for a WinAlloca instruction, or -1 if unknown.
getWinAllocaAmount(MachineInstr * MI,MachineRegisterInfo * MRI)79*9880d681SAndroid Build Coastguard Worker static int64_t getWinAllocaAmount(MachineInstr *MI, MachineRegisterInfo *MRI) {
80*9880d681SAndroid Build Coastguard Worker assert(MI->getOpcode() == X86::WIN_ALLOCA_32 ||
81*9880d681SAndroid Build Coastguard Worker MI->getOpcode() == X86::WIN_ALLOCA_64);
82*9880d681SAndroid Build Coastguard Worker assert(MI->getOperand(0).isReg());
83*9880d681SAndroid Build Coastguard Worker
84*9880d681SAndroid Build Coastguard Worker unsigned AmountReg = MI->getOperand(0).getReg();
85*9880d681SAndroid Build Coastguard Worker MachineInstr *Def = MRI->getUniqueVRegDef(AmountReg);
86*9880d681SAndroid Build Coastguard Worker
87*9880d681SAndroid Build Coastguard Worker // Look through copies.
88*9880d681SAndroid Build Coastguard Worker while (Def && Def->isCopy() && Def->getOperand(1).isReg())
89*9880d681SAndroid Build Coastguard Worker Def = MRI->getUniqueVRegDef(Def->getOperand(1).getReg());
90*9880d681SAndroid Build Coastguard Worker
91*9880d681SAndroid Build Coastguard Worker if (!Def ||
92*9880d681SAndroid Build Coastguard Worker (Def->getOpcode() != X86::MOV32ri && Def->getOpcode() != X86::MOV64ri) ||
93*9880d681SAndroid Build Coastguard Worker !Def->getOperand(1).isImm())
94*9880d681SAndroid Build Coastguard Worker return -1;
95*9880d681SAndroid Build Coastguard Worker
96*9880d681SAndroid Build Coastguard Worker return Def->getOperand(1).getImm();
97*9880d681SAndroid Build Coastguard Worker }
98*9880d681SAndroid Build Coastguard Worker
99*9880d681SAndroid Build Coastguard Worker X86WinAllocaExpander::Lowering
getLowering(int64_t CurrentOffset,int64_t AllocaAmount)100*9880d681SAndroid Build Coastguard Worker X86WinAllocaExpander::getLowering(int64_t CurrentOffset,
101*9880d681SAndroid Build Coastguard Worker int64_t AllocaAmount) {
102*9880d681SAndroid Build Coastguard Worker // For a non-constant amount or a large amount, we have to probe.
103*9880d681SAndroid Build Coastguard Worker if (AllocaAmount < 0 || AllocaAmount > StackProbeSize)
104*9880d681SAndroid Build Coastguard Worker return Probe;
105*9880d681SAndroid Build Coastguard Worker
106*9880d681SAndroid Build Coastguard Worker // If it fits within the safe region of the stack, just subtract.
107*9880d681SAndroid Build Coastguard Worker if (CurrentOffset + AllocaAmount <= StackProbeSize)
108*9880d681SAndroid Build Coastguard Worker return Sub;
109*9880d681SAndroid Build Coastguard Worker
110*9880d681SAndroid Build Coastguard Worker // Otherwise, touch the current tip of the stack, then subtract.
111*9880d681SAndroid Build Coastguard Worker return TouchAndSub;
112*9880d681SAndroid Build Coastguard Worker }
113*9880d681SAndroid Build Coastguard Worker
isPushPop(const MachineInstr & MI)114*9880d681SAndroid Build Coastguard Worker static bool isPushPop(const MachineInstr &MI) {
115*9880d681SAndroid Build Coastguard Worker switch (MI.getOpcode()) {
116*9880d681SAndroid Build Coastguard Worker case X86::PUSH32i8:
117*9880d681SAndroid Build Coastguard Worker case X86::PUSH32r:
118*9880d681SAndroid Build Coastguard Worker case X86::PUSH32rmm:
119*9880d681SAndroid Build Coastguard Worker case X86::PUSH32rmr:
120*9880d681SAndroid Build Coastguard Worker case X86::PUSHi32:
121*9880d681SAndroid Build Coastguard Worker case X86::PUSH64i8:
122*9880d681SAndroid Build Coastguard Worker case X86::PUSH64r:
123*9880d681SAndroid Build Coastguard Worker case X86::PUSH64rmm:
124*9880d681SAndroid Build Coastguard Worker case X86::PUSH64rmr:
125*9880d681SAndroid Build Coastguard Worker case X86::PUSH64i32:
126*9880d681SAndroid Build Coastguard Worker case X86::POP32r:
127*9880d681SAndroid Build Coastguard Worker case X86::POP64r:
128*9880d681SAndroid Build Coastguard Worker return true;
129*9880d681SAndroid Build Coastguard Worker default:
130*9880d681SAndroid Build Coastguard Worker return false;
131*9880d681SAndroid Build Coastguard Worker }
132*9880d681SAndroid Build Coastguard Worker }
133*9880d681SAndroid Build Coastguard Worker
computeLowerings(MachineFunction & MF,LoweringMap & Lowerings)134*9880d681SAndroid Build Coastguard Worker void X86WinAllocaExpander::computeLowerings(MachineFunction &MF,
135*9880d681SAndroid Build Coastguard Worker LoweringMap &Lowerings) {
136*9880d681SAndroid Build Coastguard Worker // Do a one-pass reverse post-order walk of the CFG to conservatively estimate
137*9880d681SAndroid Build Coastguard Worker // the offset between the stack pointer and the lowest touched part of the
138*9880d681SAndroid Build Coastguard Worker // stack, and use that to decide how to lower each WinAlloca instruction.
139*9880d681SAndroid Build Coastguard Worker
140*9880d681SAndroid Build Coastguard Worker // Initialize OutOffset[B], the stack offset at exit from B, to something big.
141*9880d681SAndroid Build Coastguard Worker DenseMap<MachineBasicBlock *, int64_t> OutOffset;
142*9880d681SAndroid Build Coastguard Worker for (MachineBasicBlock &MBB : MF)
143*9880d681SAndroid Build Coastguard Worker OutOffset[&MBB] = INT32_MAX;
144*9880d681SAndroid Build Coastguard Worker
145*9880d681SAndroid Build Coastguard Worker // Note: we don't know the offset at the start of the entry block since the
146*9880d681SAndroid Build Coastguard Worker // prologue hasn't been inserted yet, and how much that will adjust the stack
147*9880d681SAndroid Build Coastguard Worker // pointer depends on register spills, which have not been computed yet.
148*9880d681SAndroid Build Coastguard Worker
149*9880d681SAndroid Build Coastguard Worker // Compute the reverse post-order.
150*9880d681SAndroid Build Coastguard Worker ReversePostOrderTraversal<MachineFunction*> RPO(&MF);
151*9880d681SAndroid Build Coastguard Worker
152*9880d681SAndroid Build Coastguard Worker for (MachineBasicBlock *MBB : RPO) {
153*9880d681SAndroid Build Coastguard Worker int64_t Offset = -1;
154*9880d681SAndroid Build Coastguard Worker for (MachineBasicBlock *Pred : MBB->predecessors())
155*9880d681SAndroid Build Coastguard Worker Offset = std::max(Offset, OutOffset[Pred]);
156*9880d681SAndroid Build Coastguard Worker if (Offset == -1) Offset = INT32_MAX;
157*9880d681SAndroid Build Coastguard Worker
158*9880d681SAndroid Build Coastguard Worker for (MachineInstr &MI : *MBB) {
159*9880d681SAndroid Build Coastguard Worker if (MI.getOpcode() == X86::WIN_ALLOCA_32 ||
160*9880d681SAndroid Build Coastguard Worker MI.getOpcode() == X86::WIN_ALLOCA_64) {
161*9880d681SAndroid Build Coastguard Worker // A WinAlloca moves StackPtr, and potentially touches it.
162*9880d681SAndroid Build Coastguard Worker int64_t Amount = getWinAllocaAmount(&MI, MRI);
163*9880d681SAndroid Build Coastguard Worker Lowering L = getLowering(Offset, Amount);
164*9880d681SAndroid Build Coastguard Worker Lowerings[&MI] = L;
165*9880d681SAndroid Build Coastguard Worker switch (L) {
166*9880d681SAndroid Build Coastguard Worker case Sub:
167*9880d681SAndroid Build Coastguard Worker Offset += Amount;
168*9880d681SAndroid Build Coastguard Worker break;
169*9880d681SAndroid Build Coastguard Worker case TouchAndSub:
170*9880d681SAndroid Build Coastguard Worker Offset = Amount;
171*9880d681SAndroid Build Coastguard Worker break;
172*9880d681SAndroid Build Coastguard Worker case Probe:
173*9880d681SAndroid Build Coastguard Worker Offset = 0;
174*9880d681SAndroid Build Coastguard Worker break;
175*9880d681SAndroid Build Coastguard Worker }
176*9880d681SAndroid Build Coastguard Worker } else if (MI.isCall() || isPushPop(MI)) {
177*9880d681SAndroid Build Coastguard Worker // Calls, pushes and pops touch the tip of the stack.
178*9880d681SAndroid Build Coastguard Worker Offset = 0;
179*9880d681SAndroid Build Coastguard Worker } else if (MI.getOpcode() == X86::ADJCALLSTACKUP32 ||
180*9880d681SAndroid Build Coastguard Worker MI.getOpcode() == X86::ADJCALLSTACKUP64) {
181*9880d681SAndroid Build Coastguard Worker Offset -= MI.getOperand(0).getImm();
182*9880d681SAndroid Build Coastguard Worker } else if (MI.getOpcode() == X86::ADJCALLSTACKDOWN32 ||
183*9880d681SAndroid Build Coastguard Worker MI.getOpcode() == X86::ADJCALLSTACKDOWN64) {
184*9880d681SAndroid Build Coastguard Worker Offset += MI.getOperand(0).getImm();
185*9880d681SAndroid Build Coastguard Worker } else if (MI.modifiesRegister(StackPtr, TRI)) {
186*9880d681SAndroid Build Coastguard Worker // Any other modification of SP means we've lost track of it.
187*9880d681SAndroid Build Coastguard Worker Offset = INT32_MAX;
188*9880d681SAndroid Build Coastguard Worker }
189*9880d681SAndroid Build Coastguard Worker }
190*9880d681SAndroid Build Coastguard Worker
191*9880d681SAndroid Build Coastguard Worker OutOffset[MBB] = Offset;
192*9880d681SAndroid Build Coastguard Worker }
193*9880d681SAndroid Build Coastguard Worker }
194*9880d681SAndroid Build Coastguard Worker
getSubOpcode(bool Is64Bit,int64_t Amount)195*9880d681SAndroid Build Coastguard Worker static unsigned getSubOpcode(bool Is64Bit, int64_t Amount) {
196*9880d681SAndroid Build Coastguard Worker if (Is64Bit)
197*9880d681SAndroid Build Coastguard Worker return isInt<8>(Amount) ? X86::SUB64ri8 : X86::SUB64ri32;
198*9880d681SAndroid Build Coastguard Worker return isInt<8>(Amount) ? X86::SUB32ri8 : X86::SUB32ri;
199*9880d681SAndroid Build Coastguard Worker }
200*9880d681SAndroid Build Coastguard Worker
lower(MachineInstr * MI,Lowering L)201*9880d681SAndroid Build Coastguard Worker void X86WinAllocaExpander::lower(MachineInstr* MI, Lowering L) {
202*9880d681SAndroid Build Coastguard Worker DebugLoc DL = MI->getDebugLoc();
203*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *MBB = MI->getParent();
204*9880d681SAndroid Build Coastguard Worker MachineBasicBlock::iterator I = *MI;
205*9880d681SAndroid Build Coastguard Worker
206*9880d681SAndroid Build Coastguard Worker int64_t Amount = getWinAllocaAmount(MI, MRI);
207*9880d681SAndroid Build Coastguard Worker if (Amount == 0) {
208*9880d681SAndroid Build Coastguard Worker MI->eraseFromParent();
209*9880d681SAndroid Build Coastguard Worker return;
210*9880d681SAndroid Build Coastguard Worker }
211*9880d681SAndroid Build Coastguard Worker
212*9880d681SAndroid Build Coastguard Worker bool Is64Bit = STI->is64Bit();
213*9880d681SAndroid Build Coastguard Worker assert(SlotSize == 4 || SlotSize == 8);
214*9880d681SAndroid Build Coastguard Worker unsigned RegA = (SlotSize == 8) ? X86::RAX : X86::EAX;
215*9880d681SAndroid Build Coastguard Worker
216*9880d681SAndroid Build Coastguard Worker switch (L) {
217*9880d681SAndroid Build Coastguard Worker case TouchAndSub:
218*9880d681SAndroid Build Coastguard Worker assert(Amount >= SlotSize);
219*9880d681SAndroid Build Coastguard Worker
220*9880d681SAndroid Build Coastguard Worker // Use a push to touch the top of the stack.
221*9880d681SAndroid Build Coastguard Worker BuildMI(*MBB, I, DL, TII->get(Is64Bit ? X86::PUSH64r : X86::PUSH32r))
222*9880d681SAndroid Build Coastguard Worker .addReg(RegA, RegState::Undef);
223*9880d681SAndroid Build Coastguard Worker Amount -= SlotSize;
224*9880d681SAndroid Build Coastguard Worker if (!Amount)
225*9880d681SAndroid Build Coastguard Worker break;
226*9880d681SAndroid Build Coastguard Worker
227*9880d681SAndroid Build Coastguard Worker // Fall through to make any remaining adjustment.
228*9880d681SAndroid Build Coastguard Worker case Sub:
229*9880d681SAndroid Build Coastguard Worker assert(Amount > 0);
230*9880d681SAndroid Build Coastguard Worker if (Amount == SlotSize) {
231*9880d681SAndroid Build Coastguard Worker // Use push to save size.
232*9880d681SAndroid Build Coastguard Worker BuildMI(*MBB, I, DL, TII->get(Is64Bit ? X86::PUSH64r : X86::PUSH32r))
233*9880d681SAndroid Build Coastguard Worker .addReg(RegA, RegState::Undef);
234*9880d681SAndroid Build Coastguard Worker } else {
235*9880d681SAndroid Build Coastguard Worker // Sub.
236*9880d681SAndroid Build Coastguard Worker BuildMI(*MBB, I, DL, TII->get(getSubOpcode(Is64Bit, Amount)), StackPtr)
237*9880d681SAndroid Build Coastguard Worker .addReg(StackPtr)
238*9880d681SAndroid Build Coastguard Worker .addImm(Amount);
239*9880d681SAndroid Build Coastguard Worker }
240*9880d681SAndroid Build Coastguard Worker break;
241*9880d681SAndroid Build Coastguard Worker case Probe:
242*9880d681SAndroid Build Coastguard Worker // The probe lowering expects the amount in RAX/EAX.
243*9880d681SAndroid Build Coastguard Worker BuildMI(*MBB, MI, DL, TII->get(TargetOpcode::COPY), RegA)
244*9880d681SAndroid Build Coastguard Worker .addReg(MI->getOperand(0).getReg());
245*9880d681SAndroid Build Coastguard Worker
246*9880d681SAndroid Build Coastguard Worker // Do the probe.
247*9880d681SAndroid Build Coastguard Worker STI->getFrameLowering()->emitStackProbe(*MBB->getParent(), *MBB, MI, DL,
248*9880d681SAndroid Build Coastguard Worker /*InPrologue=*/false);
249*9880d681SAndroid Build Coastguard Worker break;
250*9880d681SAndroid Build Coastguard Worker }
251*9880d681SAndroid Build Coastguard Worker
252*9880d681SAndroid Build Coastguard Worker unsigned AmountReg = MI->getOperand(0).getReg();
253*9880d681SAndroid Build Coastguard Worker MI->eraseFromParent();
254*9880d681SAndroid Build Coastguard Worker
255*9880d681SAndroid Build Coastguard Worker // Delete the definition of AmountReg, possibly walking a chain of copies.
256*9880d681SAndroid Build Coastguard Worker for (;;) {
257*9880d681SAndroid Build Coastguard Worker if (!MRI->use_empty(AmountReg))
258*9880d681SAndroid Build Coastguard Worker break;
259*9880d681SAndroid Build Coastguard Worker MachineInstr *AmountDef = MRI->getUniqueVRegDef(AmountReg);
260*9880d681SAndroid Build Coastguard Worker if (!AmountDef)
261*9880d681SAndroid Build Coastguard Worker break;
262*9880d681SAndroid Build Coastguard Worker if (AmountDef->isCopy() && AmountDef->getOperand(1).isReg())
263*9880d681SAndroid Build Coastguard Worker AmountReg = AmountDef->getOperand(1).isReg();
264*9880d681SAndroid Build Coastguard Worker AmountDef->eraseFromParent();
265*9880d681SAndroid Build Coastguard Worker break;
266*9880d681SAndroid Build Coastguard Worker }
267*9880d681SAndroid Build Coastguard Worker }
268*9880d681SAndroid Build Coastguard Worker
runOnMachineFunction(MachineFunction & MF)269*9880d681SAndroid Build Coastguard Worker bool X86WinAllocaExpander::runOnMachineFunction(MachineFunction &MF) {
270*9880d681SAndroid Build Coastguard Worker if (!MF.getInfo<X86MachineFunctionInfo>()->hasWinAlloca())
271*9880d681SAndroid Build Coastguard Worker return false;
272*9880d681SAndroid Build Coastguard Worker
273*9880d681SAndroid Build Coastguard Worker MRI = &MF.getRegInfo();
274*9880d681SAndroid Build Coastguard Worker STI = &MF.getSubtarget<X86Subtarget>();
275*9880d681SAndroid Build Coastguard Worker TII = STI->getInstrInfo();
276*9880d681SAndroid Build Coastguard Worker TRI = STI->getRegisterInfo();
277*9880d681SAndroid Build Coastguard Worker StackPtr = TRI->getStackRegister();
278*9880d681SAndroid Build Coastguard Worker SlotSize = TRI->getSlotSize();
279*9880d681SAndroid Build Coastguard Worker
280*9880d681SAndroid Build Coastguard Worker StackProbeSize = 4096;
281*9880d681SAndroid Build Coastguard Worker if (MF.getFunction()->hasFnAttribute("stack-probe-size")) {
282*9880d681SAndroid Build Coastguard Worker MF.getFunction()
283*9880d681SAndroid Build Coastguard Worker ->getFnAttribute("stack-probe-size")
284*9880d681SAndroid Build Coastguard Worker .getValueAsString()
285*9880d681SAndroid Build Coastguard Worker .getAsInteger(0, StackProbeSize);
286*9880d681SAndroid Build Coastguard Worker }
287*9880d681SAndroid Build Coastguard Worker
288*9880d681SAndroid Build Coastguard Worker LoweringMap Lowerings;
289*9880d681SAndroid Build Coastguard Worker computeLowerings(MF, Lowerings);
290*9880d681SAndroid Build Coastguard Worker for (auto &P : Lowerings)
291*9880d681SAndroid Build Coastguard Worker lower(P.first, P.second);
292*9880d681SAndroid Build Coastguard Worker
293*9880d681SAndroid Build Coastguard Worker return true;
294*9880d681SAndroid Build Coastguard Worker }
295