48 unsigned LSize = LIds.size(), RSize = RIds.size();
49 unsigned MinSize = LSize < RSize ? LSize : RSize;
52 for (; Count != MinSize; ++Count)
53 if (LIds[Count] != RIds[Count])
90 FilterOffsets.
reserve(FilterIds.size());
93 for (std::vector<unsigned>::const_iterator
94 I = FilterIds.begin(),
E = FilterIds.end();
I !=
E; ++
I) {
102 unsigned SizeActions = 0;
106 I = LandingPads.
begin(),
E = LandingPads.
end();
I !=
E; ++
I) {
108 const std::vector<int> &TypeIds = LPI->
TypeIds;
109 unsigned NumShared = PrevLPI ?
sharedTypeIDs(LPI, PrevLPI) : 0;
110 unsigned SizeSiteActions = 0;
112 if (NumShared < TypeIds.size()) {
114 unsigned SizeActionEntry = 0;
118 unsigned SizePrevIds = PrevLPI->
TypeIds.size();
120 PrevAction = Actions.
size() - 1;
121 SizeActionEntry =
getSLEB128Size(Actions[PrevAction].NextAction) +
124 for (
unsigned j = NumShared; j != SizePrevIds; ++j) {
125 assert(PrevAction != (
unsigned)-1 &&
"PrevAction is invalid!");
126 SizeActionEntry -=
getSLEB128Size(Actions[PrevAction].ValueForTypeID);
127 SizeActionEntry += -Actions[PrevAction].NextAction;
128 PrevAction = Actions[PrevAction].Previous;
133 for (
unsigned J = NumShared, M = TypeIds.size(); J != M; ++J) {
135 assert(-1 - TypeID < (
int)FilterOffsets.
size() &&
"Unknown filter id!");
140 int NextAction = SizeActionEntry ? -(SizeActionEntry + SizeTypeID) : 0;
142 SizeSiteActions += SizeActionEntry;
144 ActionEntry Action = { ValueForTypeID, NextAction, PrevAction };
146 PrevAction = Actions.
size() - 1;
150 FirstAction = SizeActions + SizeSiteActions - SizeActionEntry + 1;
161 SizeActions += SizeSiteActions;
170 assert(MI->
isCall() &&
"This should be a call instruction!");
172 bool MarkedNoUnwind =
false;
173 bool SawFunc =
false;
190 MarkedNoUnwind =
false;
198 return MarkedNoUnwind;
207 for (
unsigned i = 0,
N = LandingPads.
size(); i !=
N; ++i) {
209 for (
unsigned j = 0,
E = LandingPad->
BeginLabels.size(); j !=
E; ++j) {
211 assert(!PadMap.
count(BeginLabel) &&
"Duplicate landing pad labels!");
213 PadMap[BeginLabel] =
P;
236 bool SawPotentiallyThrowing =
false;
239 bool PreviousIsInvoke =
false;
244 for (
const auto &MBB : *
Asm->
MF) {
245 for (
const auto &
MI : MBB) {
246 if (!
MI.isEHLabel()) {
253 MCSymbol *BeginLabel =
MI.getOperand(0).getMCSymbol();
254 if (BeginLabel == LastLabel)
255 SawPotentiallyThrowing =
false;
259 if (L == PadMap.
end())
266 "Inconsistent landing pad map!");
275 PreviousIsInvoke =
false;
279 assert(BeginLabel && LastLabel &&
"Invalid landing pad!");
283 PreviousIsInvoke =
false;
294 if (PreviousIsInvoke && !IsSJLJ) {
310 if (CallSites.
size() < SiteNo)
312 CallSites[SiteNo - 1] = Site;
314 PreviousIsInvoke =
true;
322 if (SawPotentiallyThrowing && !IsSJLJ) {
352 const std::vector<const GlobalValue *> &TypeInfos = MF->
getTypeInfos();
353 const std::vector<unsigned> &FilterIds = MF->
getFilterIds();
354 const std::vector<LandingPadInfo> &PadInfos = MF->
getLandingPads();
359 LandingPads.
reserve(PadInfos.size());
361 for (
unsigned i = 0,
N = PadInfos.size(); i !=
N; ++i)
381 unsigned CallSiteEncoding =
383 bool HaveTTData = !TypeInfos.empty() || !FilterIds.empty();
387 unsigned TTypeEncoding;
464 if (IsSJLJ || IsWasm) {
467 I = CallSites.
begin(),
E = CallSites.
end();
I !=
E; ++
I, ++idx) {
519 BeginLabel = EHFuncBeginSym;
530 BeginLabel->
getName() +
" and " +
565 I = Actions.begin(),
E = Actions.end();
I !=
E; ++
I) {
597 unsigned NextAction = Entry + (Action.
NextAction + 1) / 2;
615 const std::vector<const GlobalValue *> &TypeInfos = MF->
getTypeInfos();
616 const std::vector<unsigned> &FilterIds = MF->
getFilterIds();
622 if (VerboseAsm && !TypeInfos.empty()) {
625 Entry = TypeInfos.size();
638 if (VerboseAsm && !FilterIds.empty()) {
643 for (std::vector<unsigned>::const_iterator
644 I = FilterIds.begin(),
E = FilterIds.end();
I <
E; ++
I) {
const TargetLoweringObjectFile & getObjFileLowering() const
Return information about object file lowering.
Instances of this class represent a uniqued identifier for a section in the current translation unit...
static unsigned sharedTypeIDs(const LandingPadInfo *L, const LandingPadInfo *R)
How many leading type ids two landing pads have in common.
Structure describing an entry in the call-site table.
bool isCall(QueryType Type=AnyInBundle) const
typename SuperClass::const_iterator const_iterator
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
This class represents lattice values for constants.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
MCContext & OutContext
This is the context for the output file that we are streaming.
void push_back(const T &Elt)
DWARF-like instruction based exceptions.
EHStreamer(AsmPrinter *A)
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
static bool callToNoUnwindFunction(const MachineInstr *MI)
Return `true' if this is a call to a function marked `nounwind'.
unsigned getCallSiteBeginLabel(MCSymbol *BeginLabel) const
Get the call site number for a begin label.
MachineFunction * MF
The current machine function.
MCSymbol * LandingPadLabel
Structure describing an entry in the actions table.
void reserve(size_type N)
static bool isFilterEHSelector(int Selector)
const LandingPadInfo * LPad
const std::vector< unsigned > & getFilterIds() const
Return a reference to the typeids encoding filters used in the current function.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
SmallVector< MCSymbol *, 1 > EndLabels
unsigned getNumOperands() const
Retuns the total number of operands.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void computeActionsTable(const SmallVectorImpl< const LandingPadInfo *> &LandingPads, SmallVectorImpl< ActionEntry > &Actions, SmallVectorImpl< unsigned > &FirstActions)
Compute the actions table and gather the first action index for each landing pad site.
TypeID
Definitions of all of the base types for the Type system.
unsigned getTTypeEncoding() const
This structure is used to retain landing pad info for the current function.
MCSymbol * getFunctionBegin() const
void EmitLabelDifferenceAsULEB128(const MCSymbol *Hi, const MCSymbol *Lo) const
Emit something like ".uleb128 Hi-Lo".
iterator find(const_arg_type_t< KeyT > Val)
Windows Exception Handling.
const MCAsmInfo * MAI
Target Asm Printer information.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
SmallVector< MCSymbol *, 1 > BeginLabels
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
const GlobalValue * getGlobal() const
void EmitEncodingByte(unsigned Val, const char *Desc=nullptr) const
Emit a .byte 42 directive that corresponds to an encoding.
void EmitAlignment(unsigned NumBits, const GlobalObject *GV=nullptr) const
Emit an alignment directive to the specified power of two boundary.
This class is intended to be used as a driving class for all asm writers.
std::vector< int > TypeIds
AsmPrinter * Asm
Target of directive emission.
unsigned getULEB128Size(uint64_t Value)
Utility function to get the size of the ULEB128-encoded value.
void sort(IteratorTy Start, IteratorTy End)
bool doesNotThrow() const
Determine if the function cannot unwind.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
unsigned getFunctionNumber() const
Return a unique ID for the current function.
const std::vector< LandingPadInfo > & getLandingPads() const
Return a reference to the landing pad info for the current function.
void EmitSLEB128(int64_t Value, const char *Desc=nullptr) const
Emit the specified signed leb128 value.
bool isGlobal() const
isGlobal - Tests if this is a MO_GlobalAddress operand.
MachineOperand class - Representation of each machine instruction operand.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
virtual void emitTypeInfos(unsigned TTypeEncoding, MCSymbol *TTBaseLabel)
void EmitTTypeReference(const GlobalValue *GV, unsigned Encoding) const
Emit reference to a ttype global with a specified encoding.
MCSymbol * getFunctionEnd() const
bool usesCFIForEH() const
Returns true if the exception handling method for the platform uses call frame information to unwind...
virtual void computeCallSiteTable(SmallVectorImpl< CallSiteEntry > &CallSites, const SmallVectorImpl< const LandingPadInfo *> &LandingPads, const SmallVectorImpl< unsigned > &FirstActions)
Compute the call-site table.
This file contains constants used for implementing Dwarf debug support.
MCSymbol * getCurExceptionSym()
void computePadMap(const SmallVectorImpl< const LandingPadInfo *> &LandingPads, RangeMapType &PadMap)
Representation of each machine instruction.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
size_type count(const_arg_type_t< KeyT > Val) const
Return 1 if the specified key is in the map, 0 otherwise.
unsigned getSLEB128Size(int64_t Value)
Utility function to get the size of the SLEB128-encoded value.
StringRef getName() const
getName - Get the symbol name.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
MCSymbol * emitExceptionTable()
Emit landing pads and actions.
void EmitULEB128(uint64_t Value, const char *Desc=nullptr) const
Emit the specified unsigned leb128 value.
ExceptionHandling getExceptionHandlingType() const
MCSection * getLSDASection() const
const std::vector< const GlobalValue * > & getTypeInfos() const
Return a reference to the C++ typeinfo for the current function.
const MachineOperand & getOperand(unsigned i) const
Structure holding a try-range and the associated landing pad.
MCSymbol * createTempSymbol(const Twine &Name) const