10b57cec5SDimitry Andric //===-- X86MachineFunctionInfo.h - X86 machine function info ----*- C++ -*-===// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric // 90b57cec5SDimitry Andric // This file declares X86-specific per-machine-function information. 100b57cec5SDimitry Andric // 110b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 120b57cec5SDimitry Andric 130b57cec5SDimitry Andric #ifndef LLVM_LIB_TARGET_X86_X86MACHINEFUNCTIONINFO_H 140b57cec5SDimitry Andric #define LLVM_LIB_TARGET_X86_X86MACHINEFUNCTIONINFO_H 150b57cec5SDimitry Andric 165ffd83dbSDimitry Andric #include "llvm/ADT/ArrayRef.h" 175ffd83dbSDimitry Andric #include "llvm/ADT/SmallVector.h" 180b57cec5SDimitry Andric #include "llvm/CodeGen/CallingConvLower.h" 19*0fca6ea1SDimitry Andric #include "llvm/CodeGen/MIRYamlMapping.h" 200b57cec5SDimitry Andric #include "llvm/CodeGen/MachineFunction.h" 21*0fca6ea1SDimitry Andric #include "llvm/Support/YAMLTraits.h" 225f757f3fSDimitry Andric #include <set> 230b57cec5SDimitry Andric 240b57cec5SDimitry Andric namespace llvm { 250b57cec5SDimitry Andric 26*0fca6ea1SDimitry Andric enum AMXProgModelEnum { None = 0, DirectReg = 1, ManagedRA = 2 }; 27*0fca6ea1SDimitry Andric 28*0fca6ea1SDimitry Andric class X86MachineFunctionInfo; 29*0fca6ea1SDimitry Andric 30*0fca6ea1SDimitry Andric namespace yaml { 31*0fca6ea1SDimitry Andric template <> struct ScalarEnumerationTraits<AMXProgModelEnum> { 32*0fca6ea1SDimitry Andric static void enumeration(IO &YamlIO, AMXProgModelEnum &Value) { 33*0fca6ea1SDimitry Andric YamlIO.enumCase(Value, "None", AMXProgModelEnum::None); 34*0fca6ea1SDimitry Andric YamlIO.enumCase(Value, "DirectReg", AMXProgModelEnum::DirectReg); 35*0fca6ea1SDimitry Andric YamlIO.enumCase(Value, "ManagedRA", AMXProgModelEnum::ManagedRA); 36*0fca6ea1SDimitry Andric } 37*0fca6ea1SDimitry Andric }; 38*0fca6ea1SDimitry Andric 39*0fca6ea1SDimitry Andric struct X86MachineFunctionInfo final : public yaml::MachineFunctionInfo { 40*0fca6ea1SDimitry Andric AMXProgModelEnum AMXProgModel; 41*0fca6ea1SDimitry Andric 42*0fca6ea1SDimitry Andric X86MachineFunctionInfo() = default; 43*0fca6ea1SDimitry Andric X86MachineFunctionInfo(const llvm::X86MachineFunctionInfo &MFI); 44*0fca6ea1SDimitry Andric 45*0fca6ea1SDimitry Andric void mappingImpl(yaml::IO &YamlIO) override; 46*0fca6ea1SDimitry Andric ~X86MachineFunctionInfo() = default; 47*0fca6ea1SDimitry Andric }; 48*0fca6ea1SDimitry Andric 49*0fca6ea1SDimitry Andric template <> struct MappingTraits<X86MachineFunctionInfo> { 50*0fca6ea1SDimitry Andric static void mapping(IO &YamlIO, X86MachineFunctionInfo &MFI) { 51*0fca6ea1SDimitry Andric YamlIO.mapOptional("amxProgModel", MFI.AMXProgModel); 52*0fca6ea1SDimitry Andric } 53*0fca6ea1SDimitry Andric }; 54*0fca6ea1SDimitry Andric } // end namespace yaml 55*0fca6ea1SDimitry Andric 560b57cec5SDimitry Andric /// X86MachineFunctionInfo - This class is derived from MachineFunction and 570b57cec5SDimitry Andric /// contains private X86 target-specific information for each MachineFunction. 580b57cec5SDimitry Andric class X86MachineFunctionInfo : public MachineFunctionInfo { 590b57cec5SDimitry Andric virtual void anchor(); 600b57cec5SDimitry Andric 610b57cec5SDimitry Andric /// ForceFramePointer - True if the function is required to use of frame 620b57cec5SDimitry Andric /// pointer for reasons other than it containing dynamic allocation or 630b57cec5SDimitry Andric /// that FP eliminatation is turned off. For example, Cygwin main function 640b57cec5SDimitry Andric /// contains stack pointer re-alignment code which requires FP. 650b57cec5SDimitry Andric bool ForceFramePointer = false; 660b57cec5SDimitry Andric 670b57cec5SDimitry Andric /// RestoreBasePointerOffset - Non-zero if the function has base pointer 680b57cec5SDimitry Andric /// and makes call to llvm.eh.sjlj.setjmp. When non-zero, the value is a 690b57cec5SDimitry Andric /// displacement from the frame pointer to a slot where the base pointer 700b57cec5SDimitry Andric /// is stashed. 710b57cec5SDimitry Andric signed char RestoreBasePointerOffset = 0; 720b57cec5SDimitry Andric 73c14a5a88SDimitry Andric /// WinEHXMMSlotInfo - Slot information of XMM registers in the stack frame 74c14a5a88SDimitry Andric /// in bytes. 75c14a5a88SDimitry Andric DenseMap<int, unsigned> WinEHXMMSlotInfo; 76c14a5a88SDimitry Andric 770b57cec5SDimitry Andric /// CalleeSavedFrameSize - Size of the callee-saved register portion of the 780b57cec5SDimitry Andric /// stack frame in bytes. 790b57cec5SDimitry Andric unsigned CalleeSavedFrameSize = 0; 800b57cec5SDimitry Andric 810b57cec5SDimitry Andric /// BytesToPopOnReturn - Number of bytes function pops on return (in addition 820b57cec5SDimitry Andric /// to the space used by the return address). 830b57cec5SDimitry Andric /// Used on windows platform for stdcall & fastcall name decoration 840b57cec5SDimitry Andric unsigned BytesToPopOnReturn = 0; 850b57cec5SDimitry Andric 860b57cec5SDimitry Andric /// ReturnAddrIndex - FrameIndex for return slot. 870b57cec5SDimitry Andric int ReturnAddrIndex = 0; 880b57cec5SDimitry Andric 890b57cec5SDimitry Andric /// FrameIndex for return slot. 900b57cec5SDimitry Andric int FrameAddrIndex = 0; 910b57cec5SDimitry Andric 920b57cec5SDimitry Andric /// TailCallReturnAddrDelta - The number of bytes by which return address 930b57cec5SDimitry Andric /// stack slot is moved as the result of tail call optimization. 940b57cec5SDimitry Andric int TailCallReturnAddrDelta = 0; 950b57cec5SDimitry Andric 960b57cec5SDimitry Andric /// SRetReturnReg - Some subtargets require that sret lowering includes 970b57cec5SDimitry Andric /// returning the value of the returned struct in a register. This field 980b57cec5SDimitry Andric /// holds the virtual register into which the sret argument is passed. 995ffd83dbSDimitry Andric Register SRetReturnReg; 1000b57cec5SDimitry Andric 1010b57cec5SDimitry Andric /// GlobalBaseReg - keeps track of the virtual register initialized for 1020b57cec5SDimitry Andric /// use as the global base register. This is used for PIC in some PIC 1030b57cec5SDimitry Andric /// relocation models. 1045ffd83dbSDimitry Andric Register GlobalBaseReg; 1050b57cec5SDimitry Andric 1060b57cec5SDimitry Andric /// VarArgsFrameIndex - FrameIndex for start of varargs area. 1070b57cec5SDimitry Andric int VarArgsFrameIndex = 0; 1080b57cec5SDimitry Andric /// RegSaveFrameIndex - X86-64 vararg func register save area. 1090b57cec5SDimitry Andric int RegSaveFrameIndex = 0; 1100b57cec5SDimitry Andric /// VarArgsGPOffset - X86-64 vararg func int reg offset. 1110b57cec5SDimitry Andric unsigned VarArgsGPOffset = 0; 1120b57cec5SDimitry Andric /// VarArgsFPOffset - X86-64 vararg func fp reg offset. 1130b57cec5SDimitry Andric unsigned VarArgsFPOffset = 0; 1140b57cec5SDimitry Andric /// ArgumentStackSize - The number of bytes on stack consumed by the arguments 1150b57cec5SDimitry Andric /// being passed on the stack. 1160b57cec5SDimitry Andric unsigned ArgumentStackSize = 0; 1170b57cec5SDimitry Andric /// NumLocalDynamics - Number of local-dynamic TLS accesses. 1180b57cec5SDimitry Andric unsigned NumLocalDynamics = 0; 1190b57cec5SDimitry Andric /// HasPushSequences - Keeps track of whether this function uses sequences 1200b57cec5SDimitry Andric /// of pushes to pass function parameters. 1210b57cec5SDimitry Andric bool HasPushSequences = false; 1220b57cec5SDimitry Andric 1230b57cec5SDimitry Andric /// True if the function recovers from an SEH exception, and therefore needs 1240b57cec5SDimitry Andric /// to spill and restore the frame pointer. 1250b57cec5SDimitry Andric bool HasSEHFramePtrSave = false; 1260b57cec5SDimitry Andric 1270b57cec5SDimitry Andric /// The frame index of a stack object containing the original frame pointer 1280b57cec5SDimitry Andric /// used to address arguments in a function using a base pointer. 1290b57cec5SDimitry Andric int SEHFramePtrSaveIndex = 0; 1300b57cec5SDimitry Andric 131*0fca6ea1SDimitry Andric /// The AMX programing model used in the function. 132*0fca6ea1SDimitry Andric AMXProgModelEnum AMXProgModel = AMXProgModelEnum::None; 133*0fca6ea1SDimitry Andric 1340b57cec5SDimitry Andric /// True if this function has a subset of CSRs that is handled explicitly via 1350b57cec5SDimitry Andric /// copies. 1360b57cec5SDimitry Andric bool IsSplitCSR = false; 1370b57cec5SDimitry Andric 1380b57cec5SDimitry Andric /// True if this function uses the red zone. 1390b57cec5SDimitry Andric bool UsesRedZone = false; 1400b57cec5SDimitry Andric 141349cc55cSDimitry Andric /// True if this function has DYN_ALLOCA instructions. 142349cc55cSDimitry Andric bool HasDynAlloca = false; 1430b57cec5SDimitry Andric 1445ffd83dbSDimitry Andric /// True if this function has any preallocated calls. 1455ffd83dbSDimitry Andric bool HasPreallocatedCall = false; 1465ffd83dbSDimitry Andric 147fe6060f1SDimitry Andric /// Whether this function has an extended frame record [Ctx, RBP, Return 148fe6060f1SDimitry Andric /// addr]. If so, bit 60 of the in-memory frame pointer will be 1 to enable 149fe6060f1SDimitry Andric /// other tools to detect the extended record. 150fe6060f1SDimitry Andric bool HasSwiftAsyncContext = false; 151fe6060f1SDimitry Andric 1525f757f3fSDimitry Andric /// Ajust stack for push2/pop2 1535f757f3fSDimitry Andric bool PadForPush2Pop2 = false; 1545f757f3fSDimitry Andric 1555f757f3fSDimitry Andric /// Candidate registers for push2/pop2 1565f757f3fSDimitry Andric std::set<Register> CandidatesForPush2Pop2; 1575f757f3fSDimitry Andric 15806c3fb27SDimitry Andric /// True if this function has CFI directives that adjust the CFA. 15906c3fb27SDimitry Andric /// This is used to determine if we should direct the debugger to use 16006c3fb27SDimitry Andric /// the CFA instead of the stack pointer. 16106c3fb27SDimitry Andric bool HasCFIAdjustCfa = false; 16206c3fb27SDimitry Andric 16306c3fb27SDimitry Andric MachineInstr *StackPtrSaveMI = nullptr; 16406c3fb27SDimitry Andric 165bdd1243dSDimitry Andric std::optional<int> SwiftAsyncContextFrameIdx; 166fe6060f1SDimitry Andric 16781ad6265SDimitry Andric // Preallocated fields are only used during isel. 16881ad6265SDimitry Andric // FIXME: Can we find somewhere else to store these? 16981ad6265SDimitry Andric DenseMap<const Value *, size_t> PreallocatedIds; 1705ffd83dbSDimitry Andric SmallVector<size_t, 0> PreallocatedStackSizes; 1715ffd83dbSDimitry Andric SmallVector<SmallVector<size_t, 4>, 0> PreallocatedArgOffsets; 1725ffd83dbSDimitry Andric 1730b57cec5SDimitry Andric private: 1740b57cec5SDimitry Andric /// ForwardedMustTailRegParms - A list of virtual and physical registers 1750b57cec5SDimitry Andric /// that must be forwarded to every musttail call. 1760b57cec5SDimitry Andric SmallVector<ForwardedRegister, 1> ForwardedMustTailRegParms; 1770b57cec5SDimitry Andric 1780b57cec5SDimitry Andric public: 1790b57cec5SDimitry Andric X86MachineFunctionInfo() = default; 180bdd1243dSDimitry Andric X86MachineFunctionInfo(const Function &F, const TargetSubtargetInfo *STI) {} 1810b57cec5SDimitry Andric 182bdd1243dSDimitry Andric X86MachineFunctionInfo(const X86MachineFunctionInfo &) = default; 18381ad6265SDimitry Andric 18481ad6265SDimitry Andric MachineFunctionInfo * 18581ad6265SDimitry Andric clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF, 18681ad6265SDimitry Andric const DenseMap<MachineBasicBlock *, MachineBasicBlock *> &Src2DstMBB) 18781ad6265SDimitry Andric const override; 1880b57cec5SDimitry Andric 189*0fca6ea1SDimitry Andric void initializeBaseYamlFields(const yaml::X86MachineFunctionInfo &YamlMFI); 190*0fca6ea1SDimitry Andric 1910b57cec5SDimitry Andric bool getForceFramePointer() const { return ForceFramePointer;} 1920b57cec5SDimitry Andric void setForceFramePointer(bool forceFP) { ForceFramePointer = forceFP; } 1930b57cec5SDimitry Andric 1940b57cec5SDimitry Andric bool getHasPushSequences() const { return HasPushSequences; } 1950b57cec5SDimitry Andric void setHasPushSequences(bool HasPush) { HasPushSequences = HasPush; } 1960b57cec5SDimitry Andric 1970b57cec5SDimitry Andric bool getRestoreBasePointer() const { return RestoreBasePointerOffset!=0; } 1980b57cec5SDimitry Andric void setRestoreBasePointer(const MachineFunction *MF); 19906c3fb27SDimitry Andric void setRestoreBasePointer(unsigned CalleeSavedFrameSize) { 20006c3fb27SDimitry Andric RestoreBasePointerOffset = -CalleeSavedFrameSize; 20106c3fb27SDimitry Andric } 2020b57cec5SDimitry Andric int getRestoreBasePointerOffset() const {return RestoreBasePointerOffset; } 2030b57cec5SDimitry Andric 204c14a5a88SDimitry Andric DenseMap<int, unsigned>& getWinEHXMMSlotInfo() { return WinEHXMMSlotInfo; } 205c14a5a88SDimitry Andric const DenseMap<int, unsigned>& getWinEHXMMSlotInfo() const { 206c14a5a88SDimitry Andric return WinEHXMMSlotInfo; } 207c14a5a88SDimitry Andric 2085f757f3fSDimitry Andric unsigned getCalleeSavedFrameSize() const { 2095f757f3fSDimitry Andric return CalleeSavedFrameSize + 8 * padForPush2Pop2(); 2105f757f3fSDimitry Andric } 2110b57cec5SDimitry Andric void setCalleeSavedFrameSize(unsigned bytes) { CalleeSavedFrameSize = bytes; } 2120b57cec5SDimitry Andric 2130b57cec5SDimitry Andric unsigned getBytesToPopOnReturn() const { return BytesToPopOnReturn; } 2140b57cec5SDimitry Andric void setBytesToPopOnReturn (unsigned bytes) { BytesToPopOnReturn = bytes;} 2150b57cec5SDimitry Andric 2160b57cec5SDimitry Andric int getRAIndex() const { return ReturnAddrIndex; } 2170b57cec5SDimitry Andric void setRAIndex(int Index) { ReturnAddrIndex = Index; } 2180b57cec5SDimitry Andric 2190b57cec5SDimitry Andric int getFAIndex() const { return FrameAddrIndex; } 2200b57cec5SDimitry Andric void setFAIndex(int Index) { FrameAddrIndex = Index; } 2210b57cec5SDimitry Andric 2220b57cec5SDimitry Andric int getTCReturnAddrDelta() const { return TailCallReturnAddrDelta; } 2230b57cec5SDimitry Andric void setTCReturnAddrDelta(int delta) {TailCallReturnAddrDelta = delta;} 2240b57cec5SDimitry Andric 2255ffd83dbSDimitry Andric Register getSRetReturnReg() const { return SRetReturnReg; } 2265ffd83dbSDimitry Andric void setSRetReturnReg(Register Reg) { SRetReturnReg = Reg; } 2270b57cec5SDimitry Andric 2285ffd83dbSDimitry Andric Register getGlobalBaseReg() const { return GlobalBaseReg; } 2295ffd83dbSDimitry Andric void setGlobalBaseReg(Register Reg) { GlobalBaseReg = Reg; } 2300b57cec5SDimitry Andric 2310b57cec5SDimitry Andric int getVarArgsFrameIndex() const { return VarArgsFrameIndex; } 2320b57cec5SDimitry Andric void setVarArgsFrameIndex(int Idx) { VarArgsFrameIndex = Idx; } 2330b57cec5SDimitry Andric 2340b57cec5SDimitry Andric int getRegSaveFrameIndex() const { return RegSaveFrameIndex; } 2350b57cec5SDimitry Andric void setRegSaveFrameIndex(int Idx) { RegSaveFrameIndex = Idx; } 2360b57cec5SDimitry Andric 2370b57cec5SDimitry Andric unsigned getVarArgsGPOffset() const { return VarArgsGPOffset; } 2380b57cec5SDimitry Andric void setVarArgsGPOffset(unsigned Offset) { VarArgsGPOffset = Offset; } 2390b57cec5SDimitry Andric 2400b57cec5SDimitry Andric unsigned getVarArgsFPOffset() const { return VarArgsFPOffset; } 2410b57cec5SDimitry Andric void setVarArgsFPOffset(unsigned Offset) { VarArgsFPOffset = Offset; } 2420b57cec5SDimitry Andric 2430b57cec5SDimitry Andric unsigned getArgumentStackSize() const { return ArgumentStackSize; } 2440b57cec5SDimitry Andric void setArgumentStackSize(unsigned size) { ArgumentStackSize = size; } 2450b57cec5SDimitry Andric 2460b57cec5SDimitry Andric unsigned getNumLocalDynamicTLSAccesses() const { return NumLocalDynamics; } 2470b57cec5SDimitry Andric void incNumLocalDynamicTLSAccesses() { ++NumLocalDynamics; } 2480b57cec5SDimitry Andric 2490b57cec5SDimitry Andric bool getHasSEHFramePtrSave() const { return HasSEHFramePtrSave; } 2500b57cec5SDimitry Andric void setHasSEHFramePtrSave(bool V) { HasSEHFramePtrSave = V; } 2510b57cec5SDimitry Andric 2520b57cec5SDimitry Andric int getSEHFramePtrSaveIndex() const { return SEHFramePtrSaveIndex; } 2530b57cec5SDimitry Andric void setSEHFramePtrSaveIndex(int Index) { SEHFramePtrSaveIndex = Index; } 2540b57cec5SDimitry Andric 255*0fca6ea1SDimitry Andric AMXProgModelEnum getAMXProgModel() const { return AMXProgModel; } 256*0fca6ea1SDimitry Andric void setAMXProgModel(AMXProgModelEnum Model) { 257*0fca6ea1SDimitry Andric assert((AMXProgModel == AMXProgModelEnum::None || AMXProgModel == Model) && 258*0fca6ea1SDimitry Andric "mixed model is not supported"); 259*0fca6ea1SDimitry Andric AMXProgModel = Model; 260*0fca6ea1SDimitry Andric } 261*0fca6ea1SDimitry Andric 2620b57cec5SDimitry Andric SmallVectorImpl<ForwardedRegister> &getForwardedMustTailRegParms() { 2630b57cec5SDimitry Andric return ForwardedMustTailRegParms; 2640b57cec5SDimitry Andric } 2650b57cec5SDimitry Andric 2660b57cec5SDimitry Andric bool isSplitCSR() const { return IsSplitCSR; } 2670b57cec5SDimitry Andric void setIsSplitCSR(bool s) { IsSplitCSR = s; } 2680b57cec5SDimitry Andric 2690b57cec5SDimitry Andric bool getUsesRedZone() const { return UsesRedZone; } 2700b57cec5SDimitry Andric void setUsesRedZone(bool V) { UsesRedZone = V; } 2710b57cec5SDimitry Andric 272349cc55cSDimitry Andric bool hasDynAlloca() const { return HasDynAlloca; } 273349cc55cSDimitry Andric void setHasDynAlloca(bool v) { HasDynAlloca = v; } 2745ffd83dbSDimitry Andric 2755ffd83dbSDimitry Andric bool hasPreallocatedCall() const { return HasPreallocatedCall; } 2765ffd83dbSDimitry Andric void setHasPreallocatedCall(bool v) { HasPreallocatedCall = v; } 2775ffd83dbSDimitry Andric 278fe6060f1SDimitry Andric bool hasSwiftAsyncContext() const { return HasSwiftAsyncContext; } 279fe6060f1SDimitry Andric void setHasSwiftAsyncContext(bool v) { HasSwiftAsyncContext = v; } 280fe6060f1SDimitry Andric 2815f757f3fSDimitry Andric bool padForPush2Pop2() const { return PadForPush2Pop2; } 2825f757f3fSDimitry Andric void setPadForPush2Pop2(bool V) { PadForPush2Pop2 = V; } 2835f757f3fSDimitry Andric 2845f757f3fSDimitry Andric bool isCandidateForPush2Pop2(Register Reg) const { 2855f757f3fSDimitry Andric return CandidatesForPush2Pop2.find(Reg) != CandidatesForPush2Pop2.end(); 2865f757f3fSDimitry Andric } 2875f757f3fSDimitry Andric void addCandidateForPush2Pop2(Register Reg) { 2885f757f3fSDimitry Andric CandidatesForPush2Pop2.insert(Reg); 2895f757f3fSDimitry Andric } 2905f757f3fSDimitry Andric size_t getNumCandidatesForPush2Pop2() const { 2915f757f3fSDimitry Andric return CandidatesForPush2Pop2.size(); 2925f757f3fSDimitry Andric } 2935f757f3fSDimitry Andric 29406c3fb27SDimitry Andric bool hasCFIAdjustCfa() const { return HasCFIAdjustCfa; } 29506c3fb27SDimitry Andric void setHasCFIAdjustCfa(bool v) { HasCFIAdjustCfa = v; } 29606c3fb27SDimitry Andric 29706c3fb27SDimitry Andric void setStackPtrSaveMI(MachineInstr *MI) { StackPtrSaveMI = MI; } 29806c3fb27SDimitry Andric MachineInstr *getStackPtrSaveMI() const { return StackPtrSaveMI; } 29906c3fb27SDimitry Andric 300bdd1243dSDimitry Andric std::optional<int> getSwiftAsyncContextFrameIdx() const { 301fe6060f1SDimitry Andric return SwiftAsyncContextFrameIdx; 302fe6060f1SDimitry Andric } 303fe6060f1SDimitry Andric void setSwiftAsyncContextFrameIdx(int v) { SwiftAsyncContextFrameIdx = v; } 304fe6060f1SDimitry Andric 3055ffd83dbSDimitry Andric size_t getPreallocatedIdForCallSite(const Value *CS) { 3065ffd83dbSDimitry Andric auto Insert = PreallocatedIds.insert({CS, PreallocatedIds.size()}); 3075ffd83dbSDimitry Andric if (Insert.second) { 3085ffd83dbSDimitry Andric PreallocatedStackSizes.push_back(0); 3095ffd83dbSDimitry Andric PreallocatedArgOffsets.emplace_back(); 3105ffd83dbSDimitry Andric } 3115ffd83dbSDimitry Andric return Insert.first->second; 3125ffd83dbSDimitry Andric } 3135ffd83dbSDimitry Andric 3145ffd83dbSDimitry Andric void setPreallocatedStackSize(size_t Id, size_t StackSize) { 3155ffd83dbSDimitry Andric PreallocatedStackSizes[Id] = StackSize; 3165ffd83dbSDimitry Andric } 3175ffd83dbSDimitry Andric 3185ffd83dbSDimitry Andric size_t getPreallocatedStackSize(const size_t Id) { 3195ffd83dbSDimitry Andric assert(PreallocatedStackSizes[Id] != 0 && "stack size not set"); 3205ffd83dbSDimitry Andric return PreallocatedStackSizes[Id]; 3215ffd83dbSDimitry Andric } 3225ffd83dbSDimitry Andric 3235ffd83dbSDimitry Andric void setPreallocatedArgOffsets(size_t Id, ArrayRef<size_t> AO) { 3245ffd83dbSDimitry Andric PreallocatedArgOffsets[Id].assign(AO.begin(), AO.end()); 3255ffd83dbSDimitry Andric } 3265ffd83dbSDimitry Andric 327fe6060f1SDimitry Andric ArrayRef<size_t> getPreallocatedArgOffsets(const size_t Id) { 3285ffd83dbSDimitry Andric assert(!PreallocatedArgOffsets[Id].empty() && "arg offsets not set"); 3295ffd83dbSDimitry Andric return PreallocatedArgOffsets[Id]; 3305ffd83dbSDimitry Andric } 3310b57cec5SDimitry Andric }; 3320b57cec5SDimitry Andric 3330b57cec5SDimitry Andric } // End llvm namespace 3340b57cec5SDimitry Andric 3350b57cec5SDimitry Andric #endif 336