31 #ifndef LLVM_CODEGEN_MACHINEMODULEINFO_H
32 #define LLVM_CODEGEN_MACHINEMODULEINFO_H
45 #include "llvm/Support/DataTypes.h"
56 class MMIAddrLabelMap;
57 class MachineBasicBlock;
58 class MachineFunction;
128 std::vector<MCCFIInstruction> FrameInstructions;
132 std::vector<LandingPadInfo> LandingPads;
144 unsigned CurCallSite;
147 std::vector<const GlobalValue *> TypeInfos;
150 std::vector<unsigned> FilterIds;
154 std::vector<unsigned> FilterEnds;
158 std::vector<const Function *> Personalities;
165 bool CallsUnwindInit;
169 bool DbgInfoAvailable;
174 bool UsesVAFloatArgument;
181 bool UsesMorestackAddr;
198 : Var(Var), Expr(Expr), Slot(Slot), Loc(Loc) {}
232 template<
typename Ty>
234 if (ObjFileMMI ==
nullptr)
235 ObjFileMMI =
new Ty(*
this);
236 return *
static_cast<Ty*
>(ObjFileMMI);
239 template<
typename Ty>
256 return UsesVAFloatArgument;
260 UsesVAFloatArgument = b;
264 return UsesMorestackAddr;
268 UsesMorestackAddr = b;
275 return FrameInstructions;
280 FrameInstructions.push_back(Inst);
281 return FrameInstructions.size() - 1;
301 std::vector<MCSymbol*> &Result);
333 return Personalities;
382 "missing call site number for landing pad!");
383 return LPadToCallSiteMap[Sym];
389 return !LPadToCallSiteMap[Sym].empty();
394 CallSiteMap[BeginLabel] = Site;
400 "Missing call site number for EH_LABEL!");
401 return CallSiteMap[BeginLabel];
407 return CallSiteMap[BeginLabel] != 0;
const Ty & getObjFileInfo() const
PointerIntPair< MCSymbol *, 1, bool > StubValueTy
unsigned getTypeIDFor(const GlobalValue *TI)
getTypeIDFor - Return the type id for the specified typeinfo.
bool doFinalization(Module &) override
doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes...
#define LLVM_ATTRIBUTE_UNUSED_RESULT
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
A Module instance is used to store all the information related to an LLVM module. ...
WinEHFuncInfo & getWinEHFuncInfo(const Function *F)
void setCallSiteLandingPad(MCSymbol *Sym, ArrayRef< unsigned > Sites)
setCallSiteLandingPad - Map the landing pad's EH symbol to the call site indexes. ...
SmallVector< VariableDbgInfo, 4 > VariableDbgInfoMapTy
const Function * FilterOrFinally
const Function * Personality
void setVariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr, unsigned Slot, const DILocation *Loc)
setVariableDbgInfo - Collect information used to emit debugging information of a variable.
unsigned getCallSiteBeginLabel(MCSymbol *BeginLabel)
getCallSiteBeginLabel - Get the call site number for a begin label.
MCSymbol * LandingPadLabel
bool hasWinEHFuncInfo(const Function *F) const
std::vector< std::pair< MCSymbol *, StubValueTy > > SymbolListTy
VariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr, unsigned Slot, const DILocation *Loc)
void setCurrentCallSite(unsigned Site)
setCurrentCallSite - Set the call site currently being processed.
BlockAddress - The address of a basic block.
void takeDeletedSymbolsForFunction(const Function *F, std::vector< MCSymbol * > &Result)
takeDeletedSymbolsForFunction - If the specified function has had any references to address-taken blo...
SmallVector< MCSymbol *, 1 > EndLabels
~MachineModuleInfo() override
bool callsUnwindInit() const
const std::vector< unsigned > & getFilterIds() const
getFilterIds - Return a reference to the typeids encoding filters used in the current function...
SmallVector< SEHHandler, 1 > SEHHandlers
const Module * getModule() const
bool hasDebugInfo() const
hasDebugInfo - Returns true if valid debug info is present.
bool usesVAFloatArgument() const
Context object for machine code objects.
LandingPadInfo - This structure is used to retain landing pad info for the current function...
const std::vector< const GlobalValue * > & getTypeInfos() const
getTypeInfos - Return a reference to the C++ typeinfo for the current function.
void setCallSiteBeginLabel(MCSymbol *BeginLabel, unsigned Site)
setCallSiteBeginLabel - Map the begin label for a call site.
bool hasCallSiteLandingPad(MCSymbol *Sym)
hasCallSiteLandingPad - Return true if the landing pad Eh symbol has an associated call site...
unsigned LLVM_ATTRIBUTE_UNUSED_RESULT addFrameInst(const MCCFIInstruction &Inst)
LandingPadInfo & getOrCreateLandingPadInfo(MachineBasicBlock *LandingPad)
getOrCreateLandingPadInfo - Find or create an LandingPadInfo for the specified MachineBasicBlock.
unsigned getCurrentCallSite()
getCurrentCallSite - Get the call site currently being processed, if any.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
const std::vector< MCCFIInstruction > & getFrameInstructions() const
Returns a reference to a list of cfi instructions in the current function's prologue.
void addPersonality(MachineBasicBlock *LandingPad, const Function *Personality)
addPersonality - Provide the personality function for the exception information.
ArrayRef< MCSymbol * > getAddrLabelSymbolToEmit(const BasicBlock *BB)
getAddrLabelSymbolToEmit - Return the symbol to be used for the specified basic block when its addres...
void addFilterTypeInfo(MachineBasicBlock *LandingPad, ArrayRef< const GlobalValue * > TyInfo)
addFilterTypeInfo - Provide the filter typeinfo for a landing pad.
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
This class is intended to be used as a base class for asm properties and features specific to the tar...
bool hasCallSiteBeginLabel(MCSymbol *BeginLabel)
hasCallSiteBeginLabel - Return true if the begin label has a call site number associated with it...
void setCallsEHReturn(bool b)
LLVM Basic Block Representation.
PointerIntPair - This class implements a pair of a pointer and small integer.
VariableDbgInfoMapTy & getVariableDbgInfo()
void addCatchTypeInfo(MachineBasicBlock *LandingPad, ArrayRef< const GlobalValue * > TyInfo)
addCatchTypeInfo - Provide the catch typeinfo for a landing pad.
SmallVector< MCSymbol *, 1 > BeginLabels
MCSymbol * getAddrLabelSymbol(const BasicBlock *BB)
getAddrLabelSymbol - Return the symbol to be used for the specified basic block when its address is t...
EHPersonality getPersonalityType()
Classify the personality function amongst known EH styles.
const std::vector< const Function * > & getPersonalities() const
getPersonalities - Return array of personality functions ever seen.
std::vector< int > TypeIds
VariableDbgInfoMapTy VariableDbgInfos
MCSymbol * addLandingPad(MachineBasicBlock *LandingPad)
addLandingPad - Add a new panding pad.
void addInvoke(MachineBasicBlock *LandingPad, MCSymbol *BeginLabel, MCSymbol *EndLabel)
addInvoke - Provide the begin and end labels of an invoke style call and associate it with a try land...
Ty & getObjFileInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
bool callsEHReturn() const
SmallVectorImpl< unsigned > & getCallSiteLandingPad(MCSymbol *Sym)
getCallSiteLandingPad - Get the call site indexes for a landing pad EH symbol.
void addSEHCatchHandler(MachineBasicBlock *LandingPad, const Function *Filter, const BlockAddress *RecoverLabel)
ImmutablePass class - This class is used to provide information that does not need to be run...
void setDebugInfoAvailability(bool avail)
const MCContext & getContext() const
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
void setCallsUnwindInit(bool b)
void addSEHCleanupHandler(MachineBasicBlock *LandingPad, const Function *Cleanup)
bool usesMorestackAddr() const
void setUsesMorestackAddr(bool b)
void addCleanup(MachineBasicBlock *LandingPad)
addCleanup - Add a cleanup action for a landing pad.
void addWinEHState(MachineBasicBlock *LandingPad, int State)
MachineBasicBlock * LandingPadBlock
bool doInitialization(Module &) override
doInitialization - Virtual method overridden by subclasses to do any necessary initialization before ...
const Function * getWinEHParent(const Function *F) const
void emplace_back(ArgTypes &&...Args)
const std::vector< LandingPadInfo > & getLandingPads() const
getLandingPads - Return a reference to the landing pad info for the current function.
const DILocalVariable * Var
LandingPadInfo(MachineBasicBlock *MBB)
void setModule(const Module *M)
const DIExpression * Expr
int getFilterIDFor(std::vector< unsigned > &TyIds)
getFilterIDFor - Return the id of the filter encoded by TyIds.
void setUsesVAFloatArgument(bool b)
unsigned getPersonalityIndex() const
getPersonalityIndex - Get index of the current personality function inside Personalitites array ...
void TidyLandingPads(DenseMap< MCSymbol *, uintptr_t > *LPMap=nullptr)
TidyLandingPads - Remap landing pad labels and remove any deleted landing pads.
const BlockAddress * RecoverBA
void EndFunction()
EndFunction - Discard function meta information.
MachineModuleInfoImpl - This class can be derived from and used by targets to hold private target-spe...
virtual ~MachineModuleInfoImpl()
static SymbolListTy getSortedStubs(DenseMap< MCSymbol *, StubValueTy > &)
Return the entries from a DenseMap in a deterministic sorted orer.
MachineModuleInfo - This class contains meta information specific to a module.
const Function * getPersonality() const
getPersonality - Return a personality function if available.