131d157ae1ac2cd9c787dc3c1d28e64c682803844Jia Liu//===-- X86TargetFrameLowering.h - Define frame lowering for X86 -*- C++ -*-==// 233464912237efaa0ed7060829e66b59055bdd48bAnton Korobeynikov// 333464912237efaa0ed7060829e66b59055bdd48bAnton Korobeynikov// The LLVM Compiler Infrastructure 433464912237efaa0ed7060829e66b59055bdd48bAnton Korobeynikov// 533464912237efaa0ed7060829e66b59055bdd48bAnton Korobeynikov// This file is distributed under the University of Illinois Open Source 633464912237efaa0ed7060829e66b59055bdd48bAnton Korobeynikov// License. See LICENSE.TXT for details. 733464912237efaa0ed7060829e66b59055bdd48bAnton Korobeynikov// 833464912237efaa0ed7060829e66b59055bdd48bAnton Korobeynikov//===----------------------------------------------------------------------===// 933464912237efaa0ed7060829e66b59055bdd48bAnton Korobeynikov// 1016c29b5f285f375be53dabaa73e3e91107485fe4Anton Korobeynikov// This class implements X86-specific bits of TargetFrameLowering class. 1133464912237efaa0ed7060829e66b59055bdd48bAnton Korobeynikov// 1233464912237efaa0ed7060829e66b59055bdd48bAnton Korobeynikov//===----------------------------------------------------------------------===// 1333464912237efaa0ed7060829e66b59055bdd48bAnton Korobeynikov 1437ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines#ifndef LLVM_LIB_TARGET_X86_X86FRAMELOWERING_H 1537ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines#define LLVM_LIB_TARGET_X86_X86FRAMELOWERING_H 1633464912237efaa0ed7060829e66b59055bdd48bAnton Korobeynikov 1716c29b5f285f375be53dabaa73e3e91107485fe4Anton Korobeynikov#include "llvm/Target/TargetFrameLowering.h" 1833464912237efaa0ed7060829e66b59055bdd48bAnton Korobeynikov 1933464912237efaa0ed7060829e66b59055bdd48bAnton Korobeynikovnamespace llvm { 2089ec1c5c9c744c125b61145ed59783eb5c68ebf8Bill Wendling 21f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainarclass MachineInstrBuilder; 22f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainarclass MCCFIInstruction; 23f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainarclass X86Subtarget; 24f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainarclass X86RegisterInfo; 25f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar 2616c29b5f285f375be53dabaa73e3e91107485fe4Anton Korobeynikovclass X86FrameLowering : public TargetFrameLowering { 2733464912237efaa0ed7060829e66b59055bdd48bAnton Korobeynikovpublic: 28f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar X86FrameLowering(const X86Subtarget &STI, unsigned StackAlignOverride); 29f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar 30f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar // Cached subtarget predicates. 31f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar 32f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar const X86Subtarget &STI; 33f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar const TargetInstrInfo &TII; 34f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar const X86RegisterInfo *TRI; 35f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar 36f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar unsigned SlotSize; 37f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar 38f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar /// Is64Bit implies that x86_64 instructions are available. 39f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar bool Is64Bit; 4033464912237efaa0ed7060829e66b59055bdd48bAnton Korobeynikov 41f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar bool IsLP64; 42f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar 43f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar /// True if the 64-bit frame or stack pointer should be used. True for most 44f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar /// 64-bit targets with the exception of x32. If this is false, 32-bit 45f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar /// instruction operands should be used to manipulate StackPtr and FramePtr. 46f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar bool Uses64BitFramePtr; 47f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar 48f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar unsigned StackPtr; 49f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar 50f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar /// Emit target stack probe code. This is required for all 51ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines /// large stack allocations on Windows. The caller is required to materialize 52f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar /// the number of bytes to probe in RAX/EAX. Returns instruction just 53f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar /// after the expansion. 54f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar MachineInstr *emitStackProbe(MachineFunction &MF, MachineBasicBlock &MBB, 55de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar MachineBasicBlock::iterator MBBI, 56de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar const DebugLoc &DL, bool InProlog) const; 57f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar 58f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar /// Replace a StackProbe inline-stub with the actual probe code inline. 59f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar void inlineStackProbe(MachineFunction &MF, 60f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar MachineBasicBlock &PrologMBB) const override; 6137ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines 6236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines void emitCalleeSavedFrameMoves(MachineBasicBlock &MBB, 63c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines MachineBasicBlock::iterator MBBI, 64de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar const DebugLoc &DL) const; 6533464912237efaa0ed7060829e66b59055bdd48bAnton Korobeynikov 6633464912237efaa0ed7060829e66b59055bdd48bAnton Korobeynikov /// emitProlog/emitEpilog - These methods insert prolog and epilog code into 6733464912237efaa0ed7060829e66b59055bdd48bAnton Korobeynikov /// the function. 686948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override; 6936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override; 70d0c38176690e9602a93a20a43f1bd084564a8116Anton Korobeynikov 716948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar void adjustForSegmentedStacks(MachineFunction &MF, 726948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar MachineBasicBlock &PrologueMBB) const override; 7376927d758657b3a511c73467ec5a7288795c1513Rafael Espindola 746948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar void adjustForHiPEPrologue(MachineFunction &MF, 756948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar MachineBasicBlock &PrologueMBB) const override; 7698fbe27ac8f0766ea94b89b8c03418131b72bea4Benjamin Kramer 77f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, 78f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar RegScavenger *RS = nullptr) const override; 7994c5ae08750f314bc3cf1bf882b686244a3927d9Anton Korobeynikov 80c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines bool 81c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines assignCalleeSavedSpillSlots(MachineFunction &MF, 82c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines const TargetRegisterInfo *TRI, 83c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines std::vector<CalleeSavedInfo> &CSI) const override; 84c6a4f5e819217e1e12c458aed8e7b122e23a3a58Stephen Hines 85cd775ceff0b25a0b026f643a7990c2924bd310a3Anton Korobeynikov bool spillCalleeSavedRegisters(MachineBasicBlock &MBB, 86cd775ceff0b25a0b026f643a7990c2924bd310a3Anton Korobeynikov MachineBasicBlock::iterator MI, 87cd775ceff0b25a0b026f643a7990c2924bd310a3Anton Korobeynikov const std::vector<CalleeSavedInfo> &CSI, 8836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines const TargetRegisterInfo *TRI) const override; 89cd775ceff0b25a0b026f643a7990c2924bd310a3Anton Korobeynikov 9094c5ae08750f314bc3cf1bf882b686244a3927d9Anton Korobeynikov bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB, 9136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines MachineBasicBlock::iterator MI, 9236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines const std::vector<CalleeSavedInfo> &CSI, 9336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines const TargetRegisterInfo *TRI) const override; 94cd775ceff0b25a0b026f643a7990c2924bd310a3Anton Korobeynikov 9536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines bool hasFP(const MachineFunction &MF) const override; 9636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines bool hasReservedCallFrame(const MachineFunction &MF) const override; 97ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines bool canSimplifyCallFramePseudos(const MachineFunction &MF) const override; 98ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines bool needsFrameIndexResolution(const MachineFunction &MF) const override; 99d0c38176690e9602a93a20a43f1bd084564a8116Anton Korobeynikov 100d07d06ceef942c478c0f75a4c4d7442e61ddff1dAlexey Samsonov int getFrameIndexReference(const MachineFunction &MF, int FI, 10136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines unsigned &FrameReg) const override; 102700ed80d3da5e98e05ceb90e9bfb66058581a6dbEli Bendersky 103de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar int getFrameIndexReferencePreferSP(const MachineFunction &MF, int FI, 104de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar unsigned &FrameReg, 105de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar bool IgnoreSPUpdates) const override; 106ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines 107de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar MachineBasicBlock::iterator 108de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, 109de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar MachineBasicBlock::iterator MI) const override; 110ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines 111f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar unsigned getWinEHParentFrameOffset(const MachineFunction &MF) const override; 112f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar 113f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar void processFunctionBeforeFrameFinalized(MachineFunction &MF, 114f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar RegScavenger *RS) const override; 115f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar 1166948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar /// Check the instruction before/after the passed instruction. If 1176948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar /// it is an ADD/SUB/LEA instruction it is deleted argument and the 1186948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar /// stack adjustment is returned as a positive value for ADD/LEA and 1196948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar /// a negative for SUB. 120f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar int mergeSPUpdates(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, 121f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar bool doMergeWithPrevious) const; 1226948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar 1236948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar /// Emit a series of instructions to increment / decrement the stack 1246948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar /// pointer by a constant value. 125f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar void emitSPUpdate(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, 126f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar int64_t NumBytes, bool InEpilogue) const; 1276948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar 1286948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar /// Check that LEA can be used on SP in an epilogue sequence for \p MF. 1296948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar bool canUseLEAForSPInEpilogue(const MachineFunction &MF) const; 1306948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar 131de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar /// Check whether or not the given \p MBB can be used as a prologue 132de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar /// for the target. 133de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar /// The prologue will be inserted first in this basic block. 134de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar /// This method is used by the shrink-wrapping pass to decide if 135de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar /// \p MBB will be correctly handled by the target. 136de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar /// As soon as the target enable shrink-wrapping without overriding 137de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar /// this method, we assume that each basic block is a valid 138de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar /// prologue. 139de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar bool canUseAsPrologue(const MachineBasicBlock &MBB) const override; 140de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar 1416948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar /// Check whether or not the given \p MBB can be used as a epilogue 1426948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar /// for the target. 1436948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar /// The epilogue will be inserted before the first terminator of that block. 1446948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar /// This method is used by the shrink-wrapping pass to decide if 1456948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar /// \p MBB will be correctly handled by the target. 1466948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar bool canUseAsEpilogue(const MachineBasicBlock &MBB) const override; 1476948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar 148f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar /// Returns true if the target will correctly handle shrink wrapping. 149f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar bool enableShrinkWrapping(const MachineFunction &MF) const override; 150f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar 151de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar /// Order the symbols in the local stack. 152de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar /// We want to place the local stack objects in some sort of sensible order. 153de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar /// The heuristic we use is to try and pack them according to static number 154de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar /// of uses and size in order to minimize code size. 155de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar void orderFrameObjects(const MachineFunction &MF, 156de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar SmallVectorImpl<int> &ObjectsToAllocate) const override; 157de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar 158ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines /// convertArgMovsToPushes - This method tries to convert a call sequence 159ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines /// that uses sub and mov instructions to put the argument onto the stack 160ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines /// into a series of pushes. 161ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines /// Returns true if the transformation succeeded, false if not. 162ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines bool convertArgMovsToPushes(MachineFunction &MF, 163ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines MachineBasicBlock &MBB, 164ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines MachineBasicBlock::iterator I, 165ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines uint64_t Amount) const; 166f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar 167f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar /// Wraps up getting a CFI index and building a MachineInstr for it. 168f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar void BuildCFI(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, 169de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar const DebugLoc &DL, const MCCFIInstruction &CFIInst) const; 170f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar 171f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar /// Sets up EBP and optionally ESI based on the incoming EBP value. Only 172f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar /// needed for 32-bit. Used in funclet prologues and at catchret destinations. 173f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar MachineBasicBlock::iterator 174f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar restoreWin32EHStackPointers(MachineBasicBlock &MBB, 175de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar MachineBasicBlock::iterator MBBI, 176de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar const DebugLoc &DL, bool RestoreSP = false) const; 177f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar 178f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainarprivate: 179f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar uint64_t calculateMaxStackAlign(const MachineFunction &MF) const; 180f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar 181f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar /// Emit target stack probe as a call to a helper function 182f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar MachineInstr *emitStackProbeCall(MachineFunction &MF, MachineBasicBlock &MBB, 183f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar MachineBasicBlock::iterator MBBI, 184de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar const DebugLoc &DL, bool InProlog) const; 185f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar 186f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar /// Emit target stack probe as an inline sequence. 187f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar MachineInstr *emitStackProbeInline(MachineFunction &MF, 188f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar MachineBasicBlock &MBB, 189f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar MachineBasicBlock::iterator MBBI, 190de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar const DebugLoc &DL, bool InProlog) const; 191f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar 192f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar /// Emit a stub to later inline the target stack probe. 193f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar MachineInstr *emitStackProbeInlineStub(MachineFunction &MF, 194f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar MachineBasicBlock &MBB, 195f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar MachineBasicBlock::iterator MBBI, 196de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar const DebugLoc &DL, 197de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar bool InProlog) const; 198f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar 199f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar /// Aligns the stack pointer by ANDing it with -MaxAlign. 200f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar void BuildStackAlignAND(MachineBasicBlock &MBB, 201de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar MachineBasicBlock::iterator MBBI, const DebugLoc &DL, 202f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar unsigned Reg, uint64_t MaxAlign) const; 203f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar 204f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar /// Make small positive stack adjustments using POPs. 205f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar bool adjustStackWithPops(MachineBasicBlock &MBB, 206de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar MachineBasicBlock::iterator MBBI, const DebugLoc &DL, 207f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar int Offset) const; 208f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar 209f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar /// Adjusts the stack pointer using LEA, SUB, or ADD. 210f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar MachineInstrBuilder BuildStackAdjustment(MachineBasicBlock &MBB, 211f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar MachineBasicBlock::iterator MBBI, 212de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar const DebugLoc &DL, int64_t Offset, 213f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar bool InEpilogue) const; 214f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar 215f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar unsigned getPSPSlotOffsetFromSP(const MachineFunction &MF) const; 216f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar 217f3ef5332fa3f4d5ec72c178a2b19dac363a19383Pirama Arumuga Nainar unsigned getWinEHFuncletFrameSize(const MachineFunction &MF) const; 21833464912237efaa0ed7060829e66b59055bdd48bAnton Korobeynikov}; 21933464912237efaa0ed7060829e66b59055bdd48bAnton Korobeynikov 22033464912237efaa0ed7060829e66b59055bdd48bAnton Korobeynikov} // End llvm namespace 22133464912237efaa0ed7060829e66b59055bdd48bAnton Korobeynikov 22233464912237efaa0ed7060829e66b59055bdd48bAnton Korobeynikov#endif 223