1//===-- PPCMachineFunctionInfo.h - Private data used for PowerPC --*- C++ -*-=// 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4// See https://llvm.org/LICENSE.txt for license information. 5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7//===----------------------------------------------------------------------===// 9// This file declares the PowerPC specific subclass of MachineFunctionInfo. 11//===----------------------------------------------------------------------===// 13#ifndef LLVM_LIB_TARGET_POWERPC_PPCMACHINEFUNCTIONINFO_H 14#define LLVM_LIB_TARGET_POWERPC_PPCMACHINEFUNCTIONINFO_H 22/// PPCFunctionInfo - This class is derived from MachineFunction private 23/// PowerPC target-specific information for each MachineFunction. 39 /// FramePointerSaveIndex - Frame index of where the old frame pointer is 40 /// stored. Also used as an anchor for instructions that need to be altered 41 /// when using frame pointers (dyna_add, dyna_sub.) 42int FramePointerSaveIndex = 0;
44 /// ReturnAddrSaveIndex - Frame index of where the return address is stored. 46int ReturnAddrSaveIndex = 0;
48 /// Frame index where the old base pointer is stored. 49int BasePointerSaveIndex = 0;
51 /// Frame index where the old PIC base pointer is stored. 52int PICBasePointerSaveIndex = 0;
54 /// Frame index where the ROP Protection Hash is stored. 55int ROPProtectionHashSaveIndex = 0;
57 /// MustSaveLR - Indicates whether LR is defined (or clobbered) in the current 58 /// function. This is only valid after the initial scan of the function by 60bool MustSaveLR =
false;
62 /// MustSaveTOC - Indicates that the TOC save needs to be performed in the 63 /// prologue of the function. This is typically the case when there are 64 /// indirect calls in the function and it is more profitable to save the 65 /// TOC pointer in the prologue than in the block(s) containing the call(s). 66bool MustSaveTOC =
false;
68 /// Do we have to disable shrink-wrapping? This has to be set if we emit any 69 /// instructions that clobber LR in the entry block because discovering this 70 /// in PEI is too late (happens after shrink-wrapping); 71bool ShrinkWrapDisabled =
false;
73 /// Does this function have any stack spills. 76 /// Does this function spill using instructions with only r+r (not r+i) 78bool HasNonRISpills =
false;
80 /// SpillsCR - Indicates whether CR is spilled in the current function. 83 /// DisableNonVolatileCR - Indicates whether non-volatile CR fields would be 85bool DisableNonVolatileCR =
false;
87 /// LRStoreRequired - The bool indicates whether there is some explicit use of 88 /// the LR/LR8 stack slot that is not obvious from scanning the code. This 89 /// requires that the code generator produce a store of LR to the stack on 90 /// entry, even though LR may otherwise apparently not be used. 91bool LRStoreRequired =
false;
93 /// This function makes use of the PPC64 ELF TOC base pointer (register r2). 94bool UsesTOCBasePtr =
false;
96 /// MinReservedArea - This is the frame size that is at least reserved in a 97 /// potential caller (parameter+linkage area). 98unsigned MinReservedArea = 0;
100 /// TailCallSPDelta - Stack pointer delta used when tail calling. Maximum 101 /// amount the stack pointer is adjusted to make the frame bigger for tail 102 /// calls. Used for creating an area before the register spill area. 103int TailCallSPDelta = 0;
105 /// HasFastCall - Does this function contain a fast call. Used to determine 106 /// how the caller's stack pointer should be calculated (epilog/dynamicalloc). 107bool HasFastCall =
false;
109 /// VarArgsFrameIndex - FrameIndex for start of varargs area. 110int VarArgsFrameIndex = 0;
112 /// VarArgsStackOffset - StackOffset for start of stack 115int VarArgsStackOffset = 0;
117 /// VarArgsNumGPR - Index of the first unused integer 118 /// register for parameter passing. 119unsigned VarArgsNumGPR = 0;
121 /// VarArgsNumFPR - Index of the first unused double 122 /// register for parameter passing. 123unsigned VarArgsNumFPR = 0;
125 /// FixedParmsNum - The number of fixed parameters. 126unsigned FixedParmsNum = 0;
128 /// FloatingParmsNum - The number of floating parameters. 129unsigned FloatingParmsNum = 0;
131 /// VectorParmsNum - The number of vector parameters. 132unsigned VectorParmsNum = 0;
134 /// ParamtersType - Store all the parameter's type that are saved on 138 /// CRSpillFrameIndex - FrameIndex for CR spill slot for 32-bit SVR4. 139int CRSpillFrameIndex = 0;
141 /// If any of CR[2-4] need to be saved in the prologue and restored in the 142 /// epilogue then they are added to this array. This is used for the 146 /// Whether this uses the PIC Base register or not. 147bool UsesPICBase =
false;
149 /// We keep track attributes for each live-in virtual registers 150 /// to use SExt/ZExt flags in later optimization. 151 std::vector<std::pair<Register, ISD::ArgFlagsTy>> LiveInAttrs;
153 /// Flags for aix-shared-lib-tls-model-opt, will be lazily initialized for 155bool AIXFuncUseTLSIEForLD =
false;
156bool AIXFuncTLSModelOptInitDone =
false;
179return ROPProtectionHashSaveIndex;
182 ROPProtectionHashSaveIndex =
Idx;
191 /// MustSaveLR - This is set when the prolog/epilog inserter does its initial 192 /// scan of the function. It is true if the LR/LR8 register is ever explicitly 193 /// defined/clobbered in the machine function (e.g. by calls and movpctolr, 194 /// which is used in PIC generation), or if the LR stack slot is explicitly 195 /// referenced by builtin_return_address. 202 /// We certainly don't want to shrink wrap functions if we've emitted a 203 /// MovePCtoLR8 as that has to go into the entry, so the prologue definitely 204 /// has to go into the entry block. 231return AIXFuncTLSModelOptInitDone;
259 /// This function associates attributes for each live-in virtual register. 261 LiveInAttrs.push_back(std::make_pair(VReg, Flags));
264 /// This function returns true if the specified vreg is 265 /// a live-in register and sign-extended. 268 /// This function returns true if the specified vreg is 269 /// a live-in register and zero-extended. 289}
// end namespace llvm 291#endif// LLVM_LIB_TARGET_POWERPC_PPCMACHINEFUNCTIONINFO_H Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
Given that RA is a live propagate it s liveness to any other values it uses(according to Uses). void DeadArgumentEliminationPass
This file defines the SmallVector class.
Allocate memory in an ever growing pool, as if by bump-pointer.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
PPCFunctionInfo - This class is derived from MachineFunction private PowerPC target-specific informat...
int getTailCallSPDelta() const
void setVarArgsNumFPR(unsigned Num)
uint32_t getParmsType() const
MCSymbol * getPICOffsetSymbol(MachineFunction &MF) const
const SmallVectorImpl< Register > & getMustSaveCRs() const
void setReturnAddrSaveIndex(int idx)
void setMustSaveTOC(bool U)
unsigned getFloatingPointParmsNum() const
bool isAIXFuncUseTLSIEForLD() const
bool isLiveInSExt(Register VReg) const
This function returns true if the specified vreg is a live-in register and sign-extended.
MCSymbol * getGlobalEPSymbol(MachineFunction &MF) const
int getPICBasePointerSaveIndex() const
MCSymbol * getLocalEPSymbol(MachineFunction &MF) const
bool shrinkWrapDisabled() const
int getReturnAddrSaveIndex() const
unsigned getVarArgsNumFPR() const
void setAIXFuncUseTLSIEForLD()
int getFramePointerSaveIndex() const
bool isLiveInZExt(Register VReg) const
This function returns true if the specified vreg is a live-in register and zero-extended.
void setShrinkWrapDisabled(bool U)
We certainly don't want to shrink wrap functions if we've emitted a MovePCtoLR8 as that has to go int...
unsigned getVectorParmsNum() const
void setVarArgsNumGPR(unsigned Num)
void setUsesPICBase(bool uses)
void appendParameterType(ParamType Type)
bool isNonVolatileCRDisabled() const
int getVarArgsFrameIndex() const
void addMustSaveCR(Register Reg)
void setLRStoreRequired()
bool usesTOCBasePtr() const
void setBasePointerSaveIndex(int Idx)
bool isAIXFuncTLSModelOptInitDone() const
bool hasVectorParms() const
void setTailCallSPDelta(int size)
uint32_t getVecExtParmsType() const
void setAIXFuncTLSModelOptInitDone()
int getCRSpillFrameIndex() const
bool hasNonRISpills() const
bool isLRStoreRequired() const
void setMinReservedArea(unsigned size)
void setPICBasePointerSaveIndex(int Idx)
MCSymbol * getTOCOffsetSymbol(MachineFunction &MF) const
int getROPProtectionHashSaveIndex() const
unsigned getVarArgsNumGPR() const
unsigned getMinReservedArea() const
void setMustSaveLR(bool U)
MustSaveLR - This is set when the prolog/epilog inserter does its initial scan of the function.
void setDisableNonVolatileCR()
void setVarArgsStackOffset(int Offset)
void setCRSpillFrameIndex(int idx)
unsigned getFixedParmsNum() const
void setVarArgsFrameIndex(int Index)
int getBasePointerSaveIndex() const
void addLiveInAttr(Register VReg, ISD::ArgFlagsTy Flags)
This function associates attributes for each live-in virtual register.
void setROPProtectionHashSaveIndex(int Idx)
MachineFunctionInfo * clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF, const DenseMap< MachineBasicBlock *, MachineBasicBlock * > &Src2DstMBB) const override
Make a functionally equivalent copy of this MachineFunctionInfo in MF.
int getVarArgsStackOffset() const
void setFramePointerSaveIndex(int Idx)
Wrapper class representing virtual and physical registers.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
TargetSubtargetInfo - Generic base class for all target subtargets.
The instances of the Type class are immutable: once they are created, they are never changed.
This is an optimization pass for GlobalISel generic memory operations.
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...