LLVM  14.0.0git
EHStreamer.cpp
Go to the documentation of this file.
1 //===- CodeGen/AsmPrinter/EHStreamer.cpp - Exception Directive Streamer ---===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file contains support for writing exception info into assembly files.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "EHStreamer.h"
14 #include "llvm/ADT/SmallVector.h"
15 #include "llvm/ADT/Twine.h"
22 #include "llvm/IR/DataLayout.h"
23 #include "llvm/IR/Function.h"
24 #include "llvm/MC/MCAsmInfo.h"
25 #include "llvm/MC/MCContext.h"
26 #include "llvm/MC/MCStreamer.h"
27 #include "llvm/MC/MCSymbol.h"
29 #include "llvm/Support/Casting.h"
30 #include "llvm/Support/LEB128.h"
32 #include <algorithm>
33 #include <cassert>
34 #include <cstdint>
35 #include <vector>
36 
37 using namespace llvm;
38 
39 EHStreamer::EHStreamer(AsmPrinter *A) : Asm(A), MMI(Asm->MMI) {}
40 
41 EHStreamer::~EHStreamer() = default;
42 
43 /// How many leading type ids two landing pads have in common.
45  const LandingPadInfo *R) {
46  const std::vector<int> &LIds = L->TypeIds, &RIds = R->TypeIds;
47  return std::mismatch(LIds.begin(), LIds.end(), RIds.begin(), RIds.end())
48  .first -
49  LIds.begin();
50 }
51 
52 /// Compute the actions table and gather the first action index for each landing
53 /// pad site.
55  const SmallVectorImpl<const LandingPadInfo *> &LandingPads,
57  SmallVectorImpl<unsigned> &FirstActions) {
58  // The action table follows the call-site table in the LSDA. The individual
59  // records are of two types:
60  //
61  // * Catch clause
62  // * Exception specification
63  //
64  // The two record kinds have the same format, with only small differences.
65  // They are distinguished by the "switch value" field: Catch clauses
66  // (TypeInfos) have strictly positive switch values, and exception
67  // specifications (FilterIds) have strictly negative switch values. Value 0
68  // indicates a catch-all clause.
69  //
70  // Negative type IDs index into FilterIds. Positive type IDs index into
71  // TypeInfos. The value written for a positive type ID is just the type ID
72  // itself. For a negative type ID, however, the value written is the
73  // (negative) byte offset of the corresponding FilterIds entry. The byte
74  // offset is usually equal to the type ID (because the FilterIds entries are
75  // written using a variable width encoding, which outputs one byte per entry
76  // as long as the value written is not too large) but can differ. This kind
77  // of complication does not occur for positive type IDs because type infos are
78  // output using a fixed width encoding. FilterOffsets[i] holds the byte
79  // offset corresponding to FilterIds[i].
80 
81  const std::vector<unsigned> &FilterIds = Asm->MF->getFilterIds();
82  SmallVector<int, 16> FilterOffsets;
83  FilterOffsets.reserve(FilterIds.size());
84  int Offset = -1;
85 
86  for (unsigned FilterId : FilterIds) {
87  FilterOffsets.push_back(Offset);
88  Offset -= getULEB128Size(FilterId);
89  }
90 
91  FirstActions.reserve(LandingPads.size());
92 
93  int FirstAction = 0;
94  unsigned SizeActions = 0; // Total size of all action entries for a function
95  const LandingPadInfo *PrevLPI = nullptr;
96 
97  for (const LandingPadInfo *LPI : LandingPads) {
98  const std::vector<int> &TypeIds = LPI->TypeIds;
99  unsigned NumShared = PrevLPI ? sharedTypeIDs(LPI, PrevLPI) : 0;
100  unsigned SizeSiteActions = 0; // Total size of all entries for a landingpad
101 
102  if (NumShared < TypeIds.size()) {
103  // Size of one action entry (typeid + next action)
104  unsigned SizeActionEntry = 0;
105  unsigned PrevAction = (unsigned)-1;
106 
107  if (NumShared) {
108  unsigned SizePrevIds = PrevLPI->TypeIds.size();
109  assert(Actions.size());
110  PrevAction = Actions.size() - 1;
111  SizeActionEntry = getSLEB128Size(Actions[PrevAction].NextAction) +
112  getSLEB128Size(Actions[PrevAction].ValueForTypeID);
113 
114  for (unsigned j = NumShared; j != SizePrevIds; ++j) {
115  assert(PrevAction != (unsigned)-1 && "PrevAction is invalid!");
116  SizeActionEntry -= getSLEB128Size(Actions[PrevAction].ValueForTypeID);
117  SizeActionEntry += -Actions[PrevAction].NextAction;
118  PrevAction = Actions[PrevAction].Previous;
119  }
120  }
121 
122  // Compute the actions.
123  for (unsigned J = NumShared, M = TypeIds.size(); J != M; ++J) {
124  int TypeID = TypeIds[J];
125  assert(-1 - TypeID < (int)FilterOffsets.size() && "Unknown filter id!");
126  int ValueForTypeID =
127  isFilterEHSelector(TypeID) ? FilterOffsets[-1 - TypeID] : TypeID;
128  unsigned SizeTypeID = getSLEB128Size(ValueForTypeID);
129 
130  int NextAction = SizeActionEntry ? -(SizeActionEntry + SizeTypeID) : 0;
131  SizeActionEntry = SizeTypeID + getSLEB128Size(NextAction);
132  SizeSiteActions += SizeActionEntry;
133 
134  ActionEntry Action = { ValueForTypeID, NextAction, PrevAction };
135  Actions.push_back(Action);
136  PrevAction = Actions.size() - 1;
137  }
138 
139  // Record the first action of the landing pad site.
140  FirstAction = SizeActions + SizeSiteActions - SizeActionEntry + 1;
141  } // else identical - re-use previous FirstAction
142 
143  // Information used when creating the call-site table. The action record
144  // field of the call site record is the offset of the first associated
145  // action record, relative to the start of the actions table. This value is
146  // biased by 1 (1 indicating the start of the actions table), and 0
147  // indicates that there are no actions.
148  FirstActions.push_back(FirstAction);
149 
150  // Compute this sites contribution to size.
151  SizeActions += SizeSiteActions;
152 
153  PrevLPI = LPI;
154  }
155 }
156 
157 /// Return `true' if this is a call to a function marked `nounwind'. Return
158 /// `false' otherwise.
160  assert(MI->isCall() && "This should be a call instruction!");
161 
162  bool MarkedNoUnwind = false;
163  bool SawFunc = false;
164 
165  for (const MachineOperand &MO : MI->operands()) {
166  if (!MO.isGlobal()) continue;
167 
168  const Function *F = dyn_cast<Function>(MO.getGlobal());
169  if (!F) continue;
170 
171  if (SawFunc) {
172  // Be conservative. If we have more than one function operand for this
173  // call, then we can't make the assumption that it's the callee and
174  // not a parameter to the call.
175  //
176  // FIXME: Determine if there's a way to say that `F' is the callee or
177  // parameter.
178  MarkedNoUnwind = false;
179  break;
180  }
181 
182  MarkedNoUnwind = F->doesNotThrow();
183  SawFunc = true;
184  }
185 
186  return MarkedNoUnwind;
187 }
188 
190  const SmallVectorImpl<const LandingPadInfo *> &LandingPads,
191  RangeMapType &PadMap) {
192  // Invokes and nounwind calls have entries in PadMap (due to being bracketed
193  // by try-range labels when lowered). Ordinary calls do not, so appropriate
194  // try-ranges for them need be deduced so we can put them in the LSDA.
195  for (unsigned i = 0, N = LandingPads.size(); i != N; ++i) {
196  const LandingPadInfo *LandingPad = LandingPads[i];
197  for (unsigned j = 0, E = LandingPad->BeginLabels.size(); j != E; ++j) {
198  MCSymbol *BeginLabel = LandingPad->BeginLabels[j];
199  assert(!PadMap.count(BeginLabel) && "Duplicate landing pad labels!");
200  PadRange P = { i, j };
201  PadMap[BeginLabel] = P;
202  }
203  }
204 }
205 
206 /// Compute the call-site table. The entry for an invoke has a try-range
207 /// containing the call, a non-zero landing pad, and an appropriate action. The
208 /// entry for an ordinary call has a try-range containing the call and zero for
209 /// the landing pad and the action. Calls marked 'nounwind' have no entry and
210 /// must not be contained in the try-range of any entry - they form gaps in the
211 /// table. Entries must be ordered by try-range address.
212 ///
213 /// Call-sites are split into one or more call-site ranges associated with
214 /// different sections of the function.
215 ///
216 /// - Without -basic-block-sections, all call-sites are grouped into one
217 /// call-site-range corresponding to the function section.
218 ///
219 /// - With -basic-block-sections, one call-site range is created for each
220 /// section, with its FragmentBeginLabel and FragmentEndLabel respectively
221 // set to the beginning and ending of the corresponding section and its
222 // ExceptionLabel set to the exception symbol dedicated for this section.
223 // Later, one LSDA header will be emitted for each call-site range with its
224 // call-sites following. The action table and type info table will be
225 // shared across all ranges.
228  SmallVectorImpl<CallSiteRange> &CallSiteRanges,
229  const SmallVectorImpl<const LandingPadInfo *> &LandingPads,
230  const SmallVectorImpl<unsigned> &FirstActions) {
231  RangeMapType PadMap;
232  computePadMap(LandingPads, PadMap);
233 
234  // The end label of the previous invoke or nounwind try-range.
235  MCSymbol *LastLabel = Asm->getFunctionBegin();
236 
237  // Whether there is a potentially throwing instruction (currently this means
238  // an ordinary call) between the end of the previous try-range and now.
239  bool SawPotentiallyThrowing = false;
240 
241  // Whether the last CallSite entry was for an invoke.
242  bool PreviousIsInvoke = false;
243 
245 
246  // Visit all instructions in order of address.
247  for (const auto &MBB : *Asm->MF) {
248  if (&MBB == &Asm->MF->front() || MBB.isBeginSection()) {
249  // We start a call-site range upon function entry and at the beginning of
250  // every basic block section.
251  CallSiteRanges.push_back(
252  {Asm->MBBSectionRanges[MBB.getSectionIDNum()].BeginLabel,
254  Asm->getMBBExceptionSym(MBB), CallSites.size()});
255  PreviousIsInvoke = false;
256  SawPotentiallyThrowing = false;
257  LastLabel = nullptr;
258  }
259 
260  if (MBB.isEHPad())
261  CallSiteRanges.back().IsLPRange = true;
262 
263  for (const auto &MI : MBB) {
264  if (!MI.isEHLabel()) {
265  if (MI.isCall())
266  SawPotentiallyThrowing |= !callToNoUnwindFunction(&MI);
267  continue;
268  }
269 
270  // End of the previous try-range?
271  MCSymbol *BeginLabel = MI.getOperand(0).getMCSymbol();
272  if (BeginLabel == LastLabel)
273  SawPotentiallyThrowing = false;
274 
275  // Beginning of a new try-range?
276  RangeMapType::const_iterator L = PadMap.find(BeginLabel);
277  if (L == PadMap.end())
278  // Nope, it was just some random label.
279  continue;
280 
281  const PadRange &P = L->second;
282  const LandingPadInfo *LandingPad = LandingPads[P.PadIndex];
283  assert(BeginLabel == LandingPad->BeginLabels[P.RangeIndex] &&
284  "Inconsistent landing pad map!");
285 
286  // For Dwarf and AIX exception handling (SjLj handling doesn't use this).
287  // If some instruction between the previous try-range and this one may
288  // throw, create a call-site entry with no landing pad for the region
289  // between the try-ranges.
290  if (SawPotentiallyThrowing &&
291  (Asm->MAI->usesCFIForEH() ||
293  CallSites.push_back({LastLabel, BeginLabel, nullptr, 0});
294  PreviousIsInvoke = false;
295  }
296 
297  LastLabel = LandingPad->EndLabels[P.RangeIndex];
298  assert(BeginLabel && LastLabel && "Invalid landing pad!");
299 
300  if (!LandingPad->LandingPadLabel) {
301  // Create a gap.
302  PreviousIsInvoke = false;
303  } else {
304  // This try-range is for an invoke.
305  CallSiteEntry Site = {
306  BeginLabel,
307  LastLabel,
308  LandingPad,
309  FirstActions[P.PadIndex]
310  };
311 
312  // Try to merge with the previous call-site. SJLJ doesn't do this
313  if (PreviousIsInvoke && !IsSJLJ) {
314  CallSiteEntry &Prev = CallSites.back();
315  if (Site.LPad == Prev.LPad && Site.Action == Prev.Action) {
316  // Extend the range of the previous entry.
317  Prev.EndLabel = Site.EndLabel;
318  continue;
319  }
320  }
321 
322  // Otherwise, create a new call-site.
323  if (!IsSJLJ)
324  CallSites.push_back(Site);
325  else {
326  // SjLj EH must maintain the call sites in the order assigned
327  // to them by the SjLjPrepare pass.
328  unsigned SiteNo = Asm->MF->getCallSiteBeginLabel(BeginLabel);
329  if (CallSites.size() < SiteNo)
330  CallSites.resize(SiteNo);
331  CallSites[SiteNo - 1] = Site;
332  }
333  PreviousIsInvoke = true;
334  }
335  }
336 
337  // We end the call-site range upon function exit and at the end of every
338  // basic block section.
339  if (&MBB == &Asm->MF->back() || MBB.isEndSection()) {
340  // If some instruction between the previous try-range and the end of the
341  // function may throw, create a call-site entry with no landing pad for
342  // the region following the try-range.
343  if (SawPotentiallyThrowing && !IsSJLJ) {
344  CallSiteEntry Site = {LastLabel, CallSiteRanges.back().FragmentEndLabel,
345  nullptr, 0};
346  CallSites.push_back(Site);
347  SawPotentiallyThrowing = false;
348  }
349  CallSiteRanges.back().CallSiteEndIdx = CallSites.size();
350  }
351  }
352 }
353 
354 /// Emit landing pads and actions.
355 ///
356 /// The general organization of the table is complex, but the basic concepts are
357 /// easy. First there is a header which describes the location and organization
358 /// of the three components that follow.
359 ///
360 /// 1. The landing pad site information describes the range of code covered by
361 /// the try. In our case it's an accumulation of the ranges covered by the
362 /// invokes in the try. There is also a reference to the landing pad that
363 /// handles the exception once processed. Finally an index into the actions
364 /// table.
365 /// 2. The action table, in our case, is composed of pairs of type IDs and next
366 /// action offset. Starting with the action index from the landing pad
367 /// site, each type ID is checked for a match to the current exception. If
368 /// it matches then the exception and type id are passed on to the landing
369 /// pad. Otherwise the next action is looked up. This chain is terminated
370 /// with a next action of zero. If no type id is found then the frame is
371 /// unwound and handling continues.
372 /// 3. Type ID table contains references to all the C++ typeinfo for all
373 /// catches in the function. This tables is reverse indexed base 1.
374 ///
375 /// Returns the starting symbol of an exception table.
377  const MachineFunction *MF = Asm->MF;
378  const std::vector<const GlobalValue *> &TypeInfos = MF->getTypeInfos();
379  const std::vector<unsigned> &FilterIds = MF->getFilterIds();
380  const std::vector<LandingPadInfo> &PadInfos = MF->getLandingPads();
381 
382  // Sort the landing pads in order of their type ids. This is used to fold
383  // duplicate actions.
385  LandingPads.reserve(PadInfos.size());
386 
387  for (const LandingPadInfo &LPI : PadInfos)
388  LandingPads.push_back(&LPI);
389 
390  // Order landing pads lexicographically by type id.
391  llvm::sort(LandingPads, [](const LandingPadInfo *L, const LandingPadInfo *R) {
392  return L->TypeIds < R->TypeIds;
393  });
394 
395  // Compute the actions table and gather the first action index for each
396  // landing pad site.
398  SmallVector<unsigned, 64> FirstActions;
399  computeActionsTable(LandingPads, Actions, FirstActions);
400 
401  // Compute the call-site table and call-site ranges. Normally, there is only
402  // one call-site-range which covers the whole funciton. With
403  // -basic-block-sections, there is one call-site-range per basic block
404  // section.
406  SmallVector<CallSiteRange, 4> CallSiteRanges;
407  computeCallSiteTable(CallSites, CallSiteRanges, LandingPads, FirstActions);
408 
411  bool HasLEB128Directives = Asm->MAI->hasLEB128Directives();
412  unsigned CallSiteEncoding =
413  IsSJLJ ? static_cast<unsigned>(dwarf::DW_EH_PE_udata4) :
415  bool HaveTTData = !TypeInfos.empty() || !FilterIds.empty();
416 
417  // Type infos.
419  MF->getFunction(), *Asm->CurrentFnSym, Asm->TM);
420  unsigned TTypeEncoding;
421 
422  if (!HaveTTData) {
423  // If there is no TypeInfo, then we just explicitly say that we're omitting
424  // that bit.
425  TTypeEncoding = dwarf::DW_EH_PE_omit;
426  } else {
427  // Okay, we have actual filters or typeinfos to emit. As such, we need to
428  // pick a type encoding for them. We're about to emit a list of pointers to
429  // typeinfo objects at the end of the LSDA. However, unless we're in static
430  // mode, this reference will require a relocation by the dynamic linker.
431  //
432  // Because of this, we have a couple of options:
433  //
434  // 1) If we are in -static mode, we can always use an absolute reference
435  // from the LSDA, because the static linker will resolve it.
436  //
437  // 2) Otherwise, if the LSDA section is writable, we can output the direct
438  // reference to the typeinfo and allow the dynamic linker to relocate
439  // it. Since it is in a writable section, the dynamic linker won't
440  // have a problem.
441  //
442  // 3) Finally, if we're in PIC mode and the LDSA section isn't writable,
443  // we need to use some form of indirection. For example, on Darwin,
444  // we can output a statically-relocatable reference to a dyld stub. The
445  // offset to the stub is constant, but the contents are in a section
446  // that is updated by the dynamic linker. This is easy enough, but we
447  // need to tell the personality function of the unwinder to indirect
448  // through the dyld stub.
449  //
450  // FIXME: When (3) is actually implemented, we'll have to emit the stubs
451  // somewhere. This predicate should be moved to a shared location that is
452  // in target-independent code.
453  //
454  TTypeEncoding = Asm->getObjFileLowering().getTTypeEncoding();
455  }
456 
457  // Begin the exception table.
458  // Sometimes we want not to emit the data into separate section (e.g. ARM
459  // EHABI). In this case LSDASection will be NULL.
460  if (LSDASection)
461  Asm->OutStreamer->SwitchSection(LSDASection);
462  Asm->emitAlignment(Align(4));
463 
464  // Emit the LSDA.
465  MCSymbol *GCCETSym =
466  Asm->OutContext.getOrCreateSymbol(Twine("GCC_except_table")+
468  Asm->OutStreamer->emitLabel(GCCETSym);
469  MCSymbol *CstEndLabel = Asm->createTempSymbol(
470  CallSiteRanges.size() > 1 ? "action_table_base" : "cst_end");
471 
472  MCSymbol *TTBaseLabel = nullptr;
473  if (HaveTTData)
474  TTBaseLabel = Asm->createTempSymbol("ttbase");
475 
476  const bool VerboseAsm = Asm->OutStreamer->isVerboseAsm();
477 
478  // Helper for emitting references (offsets) for type table and the end of the
479  // call-site table (which marks the beginning of the action table).
480  // * For Itanium, these references will be emitted for every callsite range.
481  // * For SJLJ and Wasm, they will be emitted only once in the LSDA header.
482  auto EmitTypeTableRefAndCallSiteTableEndRef = [&]() {
483  Asm->emitEncodingByte(TTypeEncoding, "@TType");
484  if (HaveTTData) {
485  // N.B.: There is a dependency loop between the size of the TTBase uleb128
486  // here and the amount of padding before the aligned type table. The
487  // assembler must sometimes pad this uleb128 or insert extra padding
488  // before the type table. See PR35809 or GNU as bug 4029.
489  MCSymbol *TTBaseRefLabel = Asm->createTempSymbol("ttbaseref");
490  Asm->emitLabelDifferenceAsULEB128(TTBaseLabel, TTBaseRefLabel);
491  Asm->OutStreamer->emitLabel(TTBaseRefLabel);
492  }
493 
494  // The Action table follows the call-site table. So we emit the
495  // label difference from here (start of the call-site table for SJLJ and
496  // Wasm, and start of a call-site range for Itanium) to the end of the
497  // whole call-site table (end of the last call-site range for Itanium).
498  MCSymbol *CstBeginLabel = Asm->createTempSymbol("cst_begin");
499  Asm->emitEncodingByte(CallSiteEncoding, "Call site");
500  Asm->emitLabelDifferenceAsULEB128(CstEndLabel, CstBeginLabel);
501  Asm->OutStreamer->emitLabel(CstBeginLabel);
502  };
503 
504  // An alternative path to EmitTypeTableRefAndCallSiteTableEndRef.
505  // For some platforms, the system assembler does not accept the form of
506  // `.uleb128 label2 - label1`. In those situations, we would need to calculate
507  // the size between label1 and label2 manually.
508  // In this case, we would need to calculate the LSDA size and the call
509  // site table size.
510  auto EmitTypeTableOffsetAndCallSiteTableOffset = [&]() {
511  assert(CallSiteEncoding == dwarf::DW_EH_PE_udata4 && !HasLEB128Directives &&
512  "Targets supporting .uleb128 do not need to take this path.");
513  if (CallSiteRanges.size() > 1)
515  "-fbasic-block-sections is not yet supported on "
516  "platforms that do not have general LEB128 directive support.");
517 
518  uint64_t CallSiteTableSize = 0;
519  const CallSiteRange &CSRange = CallSiteRanges.back();
520  for (size_t CallSiteIdx = CSRange.CallSiteBeginIdx;
521  CallSiteIdx < CSRange.CallSiteEndIdx; ++CallSiteIdx) {
522  const CallSiteEntry &S = CallSites[CallSiteIdx];
523  // Each call site entry consists of 3 udata4 fields (12 bytes) and
524  // 1 ULEB128 field.
525  CallSiteTableSize += 12 + getULEB128Size(S.Action);
526  assert(isUInt<32>(CallSiteTableSize) && "CallSiteTableSize overflows.");
527  }
528 
529  Asm->emitEncodingByte(TTypeEncoding, "@TType");
530  if (HaveTTData) {
531  const unsigned ByteSizeOfCallSiteOffset =
532  getULEB128Size(CallSiteTableSize);
533  uint64_t ActionTableSize = 0;
534  for (const ActionEntry &Action : Actions) {
535  // Each action entry consists of two SLEB128 fields.
536  ActionTableSize += getSLEB128Size(Action.ValueForTypeID) +
537  getSLEB128Size(Action.NextAction);
538  assert(isUInt<32>(ActionTableSize) && "ActionTableSize overflows.");
539  }
540 
541  const unsigned TypeInfoSize =
542  Asm->GetSizeOfEncodedValue(TTypeEncoding) * MF->getTypeInfos().size();
543 
544  const uint64_t LSDASizeBeforeAlign =
545  1 // Call site encoding byte.
546  + ByteSizeOfCallSiteOffset // ULEB128 encoding of CallSiteTableSize.
547  + CallSiteTableSize // Call site table content.
548  + ActionTableSize; // Action table content.
549 
550  const uint64_t LSDASizeWithoutAlign = LSDASizeBeforeAlign + TypeInfoSize;
551  const unsigned ByteSizeOfLSDAWithoutAlign =
552  getULEB128Size(LSDASizeWithoutAlign);
553  const uint64_t DisplacementBeforeAlign =
554  2 // LPStartEncoding and TypeTableEncoding.
555  + ByteSizeOfLSDAWithoutAlign + LSDASizeBeforeAlign;
556 
557  // The type info area starts with 4 byte alignment.
558  const unsigned NeedAlignVal = (4 - DisplacementBeforeAlign % 4) % 4;
559  uint64_t LSDASizeWithAlign = LSDASizeWithoutAlign + NeedAlignVal;
560  const unsigned ByteSizeOfLSDAWithAlign =
561  getULEB128Size(LSDASizeWithAlign);
562 
563  // The LSDASizeWithAlign could use 1 byte less padding for alignment
564  // when the data we use to represent the LSDA Size "needs" to be 1 byte
565  // larger than the one previously calculated without alignment.
566  if (ByteSizeOfLSDAWithAlign > ByteSizeOfLSDAWithoutAlign)
567  LSDASizeWithAlign -= 1;
568 
569  Asm->OutStreamer->emitULEB128IntValue(LSDASizeWithAlign,
570  ByteSizeOfLSDAWithAlign);
571  }
572 
573  Asm->emitEncodingByte(CallSiteEncoding, "Call site");
574  Asm->OutStreamer->emitULEB128IntValue(CallSiteTableSize);
575  };
576 
577  // SjLj / Wasm Exception handling
578  if (IsSJLJ || IsWasm) {
579  Asm->OutStreamer->emitLabel(Asm->getMBBExceptionSym(Asm->MF->front()));
580 
581  // emit the LSDA header.
583  EmitTypeTableRefAndCallSiteTableEndRef();
584 
585  unsigned idx = 0;
587  I = CallSites.begin(), E = CallSites.end(); I != E; ++I, ++idx) {
588  const CallSiteEntry &S = *I;
589 
590  // Index of the call site entry.
591  if (VerboseAsm) {
592  Asm->OutStreamer->AddComment(">> Call Site " + Twine(idx) + " <<");
593  Asm->OutStreamer->AddComment(" On exception at call site "+Twine(idx));
594  }
595  Asm->emitULEB128(idx);
596 
597  // Offset of the first associated action record, relative to the start of
598  // the action table. This value is biased by 1 (1 indicates the start of
599  // the action table), and 0 indicates that there are no actions.
600  if (VerboseAsm) {
601  if (S.Action == 0)
602  Asm->OutStreamer->AddComment(" Action: cleanup");
603  else
604  Asm->OutStreamer->AddComment(" Action: " +
605  Twine((S.Action - 1) / 2 + 1));
606  }
607  Asm->emitULEB128(S.Action);
608  }
609  Asm->OutStreamer->emitLabel(CstEndLabel);
610  } else {
611  // Itanium LSDA exception handling
612 
613  // The call-site table is a list of all call sites that may throw an
614  // exception (including C++ 'throw' statements) in the procedure
615  // fragment. It immediately follows the LSDA header. Each entry indicates,
616  // for a given call, the first corresponding action record and corresponding
617  // landing pad.
618  //
619  // The table begins with the number of bytes, stored as an LEB128
620  // compressed, unsigned integer. The records immediately follow the record
621  // count. They are sorted in increasing call-site address. Each record
622  // indicates:
623  //
624  // * The position of the call-site.
625  // * The position of the landing pad.
626  // * The first action record for that call site.
627  //
628  // A missing entry in the call-site table indicates that a call is not
629  // supposed to throw.
630 
631  assert(CallSiteRanges.size() != 0 && "No call-site ranges!");
632 
633  // There should be only one call-site range which includes all the landing
634  // pads. Find that call-site range here.
635  const CallSiteRange *LandingPadRange = nullptr;
636  for (const CallSiteRange &CSRange : CallSiteRanges) {
637  if (CSRange.IsLPRange) {
638  assert(LandingPadRange == nullptr &&
639  "All landing pads must be in a single callsite range.");
640  LandingPadRange = &CSRange;
641  }
642  }
643 
644  // The call-site table is split into its call-site ranges, each being
645  // emitted as:
646  // [ LPStartEncoding | LPStart ]
647  // [ TypeTableEncoding | TypeTableOffset ]
648  // [ CallSiteEncoding | CallSiteTableEndOffset ]
649  // cst_begin -> { call-site entries contained in this range }
650  //
651  // and is followed by the next call-site range.
652  //
653  // For each call-site range, CallSiteTableEndOffset is computed as the
654  // difference between cst_begin of that range and the last call-site-table's
655  // end label. This offset is used to find the action table.
656 
657  unsigned Entry = 0;
658  for (const CallSiteRange &CSRange : CallSiteRanges) {
659  if (CSRange.CallSiteBeginIdx != 0) {
660  // Align the call-site range for all ranges except the first. The
661  // first range is already aligned due to the exception table alignment.
662  Asm->emitAlignment(Align(4));
663  }
664  Asm->OutStreamer->emitLabel(CSRange.ExceptionLabel);
665 
666  // Emit the LSDA header.
667  // If only one call-site range exists, LPStart is omitted as it is the
668  // same as the function entry.
669  if (CallSiteRanges.size() == 1) {
671  } else if (!Asm->isPositionIndependent()) {
672  // For more than one call-site ranges, LPStart must be explicitly
673  // specified.
674  // For non-PIC we can simply use the absolute value.
676  Asm->OutStreamer->emitSymbolValue(LandingPadRange->FragmentBeginLabel,
678  } else {
679  // For PIC mode, we Emit a PC-relative address for LPStart.
681  MCContext &Context = Asm->OutStreamer->getContext();
682  MCSymbol *Dot = Context.createTempSymbol();
683  Asm->OutStreamer->emitLabel(Dot);
684  Asm->OutStreamer->emitValue(
687  Context),
690  }
691 
692  if (HasLEB128Directives)
693  EmitTypeTableRefAndCallSiteTableEndRef();
694  else
695  EmitTypeTableOffsetAndCallSiteTableOffset();
696 
697  for (size_t CallSiteIdx = CSRange.CallSiteBeginIdx;
698  CallSiteIdx != CSRange.CallSiteEndIdx; ++CallSiteIdx) {
699  const CallSiteEntry &S = CallSites[CallSiteIdx];
700 
701  MCSymbol *EHFuncBeginSym = CSRange.FragmentBeginLabel;
702  MCSymbol *EHFuncEndSym = CSRange.FragmentEndLabel;
703 
704  MCSymbol *BeginLabel = S.BeginLabel;
705  if (!BeginLabel)
706  BeginLabel = EHFuncBeginSym;
707  MCSymbol *EndLabel = S.EndLabel;
708  if (!EndLabel)
709  EndLabel = EHFuncEndSym;
710 
711  // Offset of the call site relative to the start of the procedure.
712  if (VerboseAsm)
713  Asm->OutStreamer->AddComment(">> Call Site " + Twine(++Entry) +
714  " <<");
715  Asm->emitCallSiteOffset(BeginLabel, EHFuncBeginSym, CallSiteEncoding);
716  if (VerboseAsm)
717  Asm->OutStreamer->AddComment(Twine(" Call between ") +
718  BeginLabel->getName() + " and " +
719  EndLabel->getName());
720  Asm->emitCallSiteOffset(EndLabel, BeginLabel, CallSiteEncoding);
721 
722  // Offset of the landing pad relative to the start of the landing pad
723  // fragment.
724  if (!S.LPad) {
725  if (VerboseAsm)
726  Asm->OutStreamer->AddComment(" has no landing pad");
727  Asm->emitCallSiteValue(0, CallSiteEncoding);
728  } else {
729  if (VerboseAsm)
730  Asm->OutStreamer->AddComment(Twine(" jumps to ") +
731  S.LPad->LandingPadLabel->getName());
732  Asm->emitCallSiteOffset(S.LPad->LandingPadLabel,
733  LandingPadRange->FragmentBeginLabel,
734  CallSiteEncoding);
735  }
736 
737  // Offset of the first associated action record, relative to the start
738  // of the action table. This value is biased by 1 (1 indicates the start
739  // of the action table), and 0 indicates that there are no actions.
740  if (VerboseAsm) {
741  if (S.Action == 0)
742  Asm->OutStreamer->AddComment(" On action: cleanup");
743  else
744  Asm->OutStreamer->AddComment(" On action: " +
745  Twine((S.Action - 1) / 2 + 1));
746  }
747  Asm->emitULEB128(S.Action);
748  }
749  }
750  Asm->OutStreamer->emitLabel(CstEndLabel);
751  }
752 
753  // Emit the Action Table.
754  int Entry = 0;
755  for (const ActionEntry &Action : Actions) {
756  if (VerboseAsm) {
757  // Emit comments that decode the action table.
758  Asm->OutStreamer->AddComment(">> Action Record " + Twine(++Entry) + " <<");
759  }
760 
761  // Type Filter
762  //
763  // Used by the runtime to match the type of the thrown exception to the
764  // type of the catch clauses or the types in the exception specification.
765  if (VerboseAsm) {
766  if (Action.ValueForTypeID > 0)
767  Asm->OutStreamer->AddComment(" Catch TypeInfo " +
768  Twine(Action.ValueForTypeID));
769  else if (Action.ValueForTypeID < 0)
770  Asm->OutStreamer->AddComment(" Filter TypeInfo " +
771  Twine(Action.ValueForTypeID));
772  else
773  Asm->OutStreamer->AddComment(" Cleanup");
774  }
775  Asm->emitSLEB128(Action.ValueForTypeID);
776 
777  // Action Record
778  if (VerboseAsm) {
779  if (Action.Previous == unsigned(-1)) {
780  Asm->OutStreamer->AddComment(" No further actions");
781  } else {
782  Asm->OutStreamer->AddComment(" Continue to action " +
783  Twine(Action.Previous + 1));
784  }
785  }
786  Asm->emitSLEB128(Action.NextAction);
787  }
788 
789  if (HaveTTData) {
790  Asm->emitAlignment(Align(4));
791  emitTypeInfos(TTypeEncoding, TTBaseLabel);
792  }
793 
794  Asm->emitAlignment(Align(4));
795  return GCCETSym;
796 }
797 
798 void EHStreamer::emitTypeInfos(unsigned TTypeEncoding, MCSymbol *TTBaseLabel) {
799  const MachineFunction *MF = Asm->MF;
800  const std::vector<const GlobalValue *> &TypeInfos = MF->getTypeInfos();
801  const std::vector<unsigned> &FilterIds = MF->getFilterIds();
802 
803  const bool VerboseAsm = Asm->OutStreamer->isVerboseAsm();
804 
805  int Entry = 0;
806  // Emit the Catch TypeInfos.
807  if (VerboseAsm && !TypeInfos.empty()) {
808  Asm->OutStreamer->AddComment(">> Catch TypeInfos <<");
809  Asm->OutStreamer->AddBlankLine();
810  Entry = TypeInfos.size();
811  }
812 
813  for (const GlobalValue *GV : llvm::reverse(TypeInfos)) {
814  if (VerboseAsm)
815  Asm->OutStreamer->AddComment("TypeInfo " + Twine(Entry--));
816  Asm->emitTTypeReference(GV, TTypeEncoding);
817  }
818 
819  Asm->OutStreamer->emitLabel(TTBaseLabel);
820 
821  // Emit the Exception Specifications.
822  if (VerboseAsm && !FilterIds.empty()) {
823  Asm->OutStreamer->AddComment(">> Filter TypeInfos <<");
824  Asm->OutStreamer->AddBlankLine();
825  Entry = 0;
826  }
827  for (std::vector<unsigned>::const_iterator
828  I = FilterIds.begin(), E = FilterIds.end(); I < E; ++I) {
829  unsigned TypeID = *I;
830  if (VerboseAsm) {
831  --Entry;
833  Asm->OutStreamer->AddComment("FilterInfo " + Twine(Entry));
834  }
835 
837  }
838 }
i
i
Definition: README.txt:29
AsmPrinter.h
llvm::AsmPrinter::isPositionIndependent
bool isPositionIndependent() const
Definition: AsmPrinter.cpp:214
llvm::AsmPrinter::emitLabelDifferenceAsULEB128
void emitLabelDifferenceAsULEB128(const MCSymbol *Hi, const MCSymbol *Lo) const
Emit something like ".uleb128 Hi-Lo".
Definition: AsmPrinterDwarf.cpp:56
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:105
MachineInstr.h
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
llvm::EHStreamer::computeCallSiteTable
virtual void computeCallSiteTable(SmallVectorImpl< CallSiteEntry > &CallSites, SmallVectorImpl< CallSiteRange > &CallSiteRanges, const SmallVectorImpl< const LandingPadInfo * > &LandingPads, const SmallVectorImpl< unsigned > &FirstActions)
Compute the call-site table and the call-site ranges.
Definition: EHStreamer.cpp:226
MCTargetOptions.h
llvm::AsmPrinter::emitULEB128
void emitULEB128(uint64_t Value, const char *Desc=nullptr, unsigned PadTo=0) const
Emit the specified unsigned leb128 value.
Definition: AsmPrinterDwarf.cpp:47
llvm::ExceptionHandling::SjLj
@ SjLj
setjmp/longjmp based exceptions
llvm::AsmPrinter::createTempSymbol
MCSymbol * createTempSymbol(const Twine &Name) const
Definition: AsmPrinter.cpp:3127
llvm::MCContext
Context object for machine code objects.
Definition: MCContext.h:72
llvm::Function
Definition: Function.h:62
P
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Definition: README-SSE.txt:411
llvm::AsmPrinter::MAI
const MCAsmInfo * MAI
Target Asm Printer information.
Definition: AsmPrinter.h:87
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1168
llvm::LandingPadInfo::LandingPadLabel
MCSymbol * LandingPadLabel
Definition: MachineFunction.h:227
llvm::AsmPrinter::emitSLEB128
void emitSLEB128(int64_t Value, const char *Desc=nullptr) const
Emit the specified signed leb128 value.
Definition: AsmPrinterDwarf.cpp:40
llvm::MCAsmInfo::hasLEB128Directives
bool hasLEB128Directives() const
Definition: MCAsmInfo.h:696
llvm::MachineFunction::back
const MachineBasicBlock & back() const
Definition: MachineFunction.h:830
llvm::EHStreamer::CallSiteRange::CallSiteEndIdx
size_t CallSiteEndIdx
Definition: EHStreamer.h:88
llvm::DenseMapIterator
Definition: DenseMap.h:56
llvm::getULEB128Size
unsigned getULEB128Size(uint64_t Value)
Utility function to get the size of the ULEB128-encoded value.
Definition: LEB128.cpp:19
llvm::reverse
auto reverse(ContainerTy &&C, std::enable_if_t< has_rbegin< ContainerTy >::value > *=nullptr)
Definition: STLExtras.h:359
llvm::MCAsmInfo::getCodePointerSize
unsigned getCodePointerSize() const
Get the code pointer size in bytes.
Definition: MCAsmInfo.h:536
llvm::DenseMapBase::count
size_type count(const_arg_type_t< KeyT > Val) const
Return 1 if the specified key is in the map, 0 otherwise.
Definition: DenseMap.h:145
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:81
llvm::MCAsmInfo::usesCFIForEH
bool usesCFIForEH() const
Returns true if the exception handling method for the platform uses call frame information to unwind.
Definition: MCAsmInfo.h:773
llvm::AsmPrinter::emitCallSiteOffset
void emitCallSiteOffset(const MCSymbol *Hi, const MCSymbol *Lo, unsigned Encoding) const
Emit reference to a call site with a specified encoding.
Definition: AsmPrinterDwarf.cpp:211
llvm::EHStreamer::CallSiteEntry::LPad
const LandingPadInfo * LPad
Definition: EHStreamer.h:67
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::EHStreamer::emitTypeInfos
virtual void emitTypeInfos(unsigned TTypeEncoding, MCSymbol *TTBaseLabel)
Definition: EHStreamer.cpp:798
Context
ManagedStatic< detail::RecordContext > Context
Definition: Record.cpp:96
llvm::ExceptionHandling::AIX
@ AIX
AIX Exception Handling.
llvm::MachineBasicBlock::isBeginSection
bool isBeginSection() const
Returns true if this block begins any section.
Definition: MachineBasicBlock.h:564
llvm::MachineFunction::front
const MachineBasicBlock & front() const
Definition: MachineFunction.h:828
llvm::MCContext::getOrCreateSymbol
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
Definition: MCContext.cpp:191
llvm::TargetLoweringObjectFile::getTTypeEncoding
unsigned getTTypeEncoding() const
Definition: TargetLoweringObjectFile.h:169
EHStreamer.h
llvm::LandingPadInfo::EndLabels
SmallVector< MCSymbol *, 1 > EndLabels
Definition: MachineFunction.h:225
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::MachineFunction::getFilterIds
const std::vector< unsigned > & getFilterIds() const
Return a reference to the typeids encoding filters used in the current function.
Definition: MachineFunction.h:1171
llvm::AsmPrinter::OutStreamer
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
Definition: AsmPrinter.h:96
Twine.h
MCContext.h
llvm::EHStreamer::emitExceptionTable
MCSymbol * emitExceptionTable()
Emit landing pads and actions.
Definition: EHStreamer.cpp:376
MCSymbol.h
llvm::LandingPadInfo::TypeIds
std::vector< int > TypeIds
Definition: MachineFunction.h:228
llvm::MachineOperand
MachineOperand class - Representation of each machine instruction operand.
Definition: MachineOperand.h:49
llvm::AsmPrinter::CurrentFnSym
MCSymbol * CurrentFnSym
The symbol for the current function.
Definition: AsmPrinter.h:118
llvm::AsmPrinter::emitAlignment
void emitAlignment(Align Alignment, const GlobalObject *GV=nullptr) const
Emit an alignment directive to the specified power of two boundary.
Definition: AsmPrinter.cpp:2465
llvm::report_fatal_error
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Definition: Error.cpp:143
llvm::ExceptionHandling::Wasm
@ Wasm
WebAssembly Exception Handling.
llvm::EHStreamer::computeActionsTable
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.
Definition: EHStreamer.cpp:54
llvm::SmallVectorImpl::resize
void resize(size_type N)
Definition: SmallVector.h:606
llvm::MCSymbol::getName
StringRef getName() const
getName - Get the symbol name.
Definition: MCSymbol.h:198
Align
uint64_t Align
Definition: ELFObjHandler.cpp:83
llvm::EHStreamer::isFilterEHSelector
static bool isFilterEHSelector(int Selector)
Definition: EHStreamer.h:145
llvm::AsmPrinter::getFunctionBegin
MCSymbol * getFunctionBegin() const
Definition: AsmPrinter.h:246
llvm::dwarf::DW_EH_PE_udata4
@ DW_EH_PE_udata4
Definition: Dwarf.h:436
llvm::TargetLoweringObjectFile::getSectionForLSDA
virtual MCSection * getSectionForLSDA(const Function &, const MCSymbol &, const TargetMachine &) const
Definition: TargetLoweringObjectFile.h:133
llvm::MachineBasicBlock::getSectionIDNum
unsigned getSectionIDNum() const
Returns the unique section ID number of this basic block.
Definition: MachineBasicBlock.h:577
llvm::TargetLoweringObjectFile::getCallSiteEncoding
unsigned getCallSiteEncoding() const
Definition: TargetLoweringObjectFile.cpp:61
TypeID
Type::TypeID TypeID
Definition: Mips16HardFloat.cpp:102
llvm::GlobalValue
Definition: GlobalValue.h:44
llvm::EHStreamer::sharedTypeIDs
static unsigned sharedTypeIDs(const LandingPadInfo *L, const LandingPadInfo *R)
How many leading type ids two landing pads have in common.
Definition: EHStreamer.cpp:44
llvm::EHStreamer::EHStreamer
EHStreamer(AsmPrinter *A)
Definition: EHStreamer.cpp:39
llvm::LandingPadInfo::BeginLabels
SmallVector< MCSymbol *, 1 > BeginLabels
Definition: MachineFunction.h:224
llvm::MachineInstr
Representation of each machine instruction.
Definition: MachineInstr.h:64
uint64_t
llvm::dwarf::DW_EH_PE_pcrel
@ DW_EH_PE_pcrel
Definition: Dwarf.h:443
llvm::AsmPrinter::GetSizeOfEncodedValue
unsigned GetSizeOfEncodedValue(unsigned Encoding) const
Return the size of the encoding in bytes.
Definition: AsmPrinterDwarf.cpp:129
LEB128.h
llvm::DenseMap
Definition: DenseMap.h:714
llvm::EHStreamer::CallSiteRange::CallSiteBeginIdx
size_t CallSiteBeginIdx
Definition: EHStreamer.h:85
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::EHStreamer::CallSiteEntry::EndLabel
MCSymbol * EndLabel
Definition: EHStreamer.h:64
llvm::EHStreamer::CallSiteRange
Structure describing a contiguous range of call-sites which reside in the same procedure fragment.
Definition: EHStreamer.h:76
llvm::isUInt< 32 >
constexpr bool isUInt< 32 >(uint64_t x)
Definition: MathExtras.h:411
llvm::DenseMapBase::find
iterator find(const_arg_type_t< KeyT > Val)
Definition: DenseMap.h:150
llvm::SmallVectorImpl::const_iterator
typename SuperClass::const_iterator const_iterator
Definition: SmallVector.h:563
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::EHStreamer::~EHStreamer
~EHStreamer() override
llvm::MCBinaryExpr::createSub
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
Definition: MCExpr.h:610
llvm::AsmPrinter::getMBBExceptionSym
MCSymbol * getMBBExceptionSym(const MachineBasicBlock &MBB)
Definition: AsmPrinter.cpp:1971
llvm::AsmPrinter::MF
MachineFunction * MF
The current machine function.
Definition: AsmPrinter.h:99
llvm::MachineFunction::getLandingPads
const std::vector< LandingPadInfo > & getLandingPads() const
Return a reference to the landing pad info for the current function.
Definition: MachineFunction.h:1070
llvm::EHStreamer::callToNoUnwindFunction
static bool callToNoUnwindFunction(const MachineInstr *MI)
Return ‘true’ if this is a call to a function marked ‘nounwind’.
Definition: EHStreamer.cpp:159
llvm::AsmPrinter::OutContext
MCContext & OutContext
This is the context for the output file that we are streaming.
Definition: AsmPrinter.h:91
iterator_range.h
llvm::EHStreamer::ActionEntry
Structure describing an entry in the actions table.
Definition: EHStreamer.h:54
llvm::MachineFunction
Definition: MachineFunction.h:234
llvm::EHStreamer::CallSiteEntry
Structure describing an entry in the call-site table.
Definition: EHStreamer.h:61
MCAsmInfo.h
llvm::EHStreamer::Asm
AsmPrinter * Asm
Target of directive emission.
Definition: EHStreamer.h:33
DataLayout.h
llvm::MachineBasicBlock::isEHPad
bool isEHPad() const
Returns true if the block is a landing pad.
Definition: MachineBasicBlock.h:526
Dwarf.h
TargetLoweringObjectFile.h
llvm::MCSection
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition: MCSection.h:39
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::getSLEB128Size
unsigned getSLEB128Size(int64_t Value)
Utility function to get the size of the SLEB128-encoded value.
Definition: LEB128.cpp:29
MBB
MachineBasicBlock & MBB
Definition: AArch64SLSHardening.cpp:74
llvm::dwarf::DW_EH_PE_absptr
@ DW_EH_PE_absptr
Definition: Dwarf.h:432
j
return j(j<< 16)
llvm::EHStreamer::computePadMap
void computePadMap(const SmallVectorImpl< const LandingPadInfo * > &LandingPads, RangeMapType &PadMap)
Definition: EHStreamer.cpp:189
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:83
llvm::MachineFunction::getFunction
Function & getFunction()
Return the LLVM function that this machine code represents.
Definition: MachineFunction.h:600
llvm::MachineBasicBlock::isEndSection
bool isEndSection() const
Returns true if this block ends any section.
Definition: MachineBasicBlock.h:567
llvm::DenseMapBase::end
iterator end()
Definition: DenseMap.h:83
Casting.h
Function.h
llvm::sort
void sort(IteratorTy Start, IteratorTy End)
Definition: STLExtras.h:1541
llvm::AsmPrinter
This class is intended to be used as a driving class for all asm writers.
Definition: AsmPrinter.h:81
llvm::MCSymbolRefExpr::create
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
Definition: MCExpr.h:386
llvm::MCAsmInfo::getExceptionHandlingType
ExceptionHandling getExceptionHandlingType() const
Definition: MCAsmInfo.h:762
llvm::AsmPrinter::emitTTypeReference
virtual void emitTTypeReference(const GlobalValue *GV, unsigned Encoding)
Emit reference to a ttype global with a specified encoding.
Definition: AsmPrinterDwarf.cpp:147
llvm::AsmPrinter::MBBSectionRanges
MapVector< unsigned, MBBSectionRange > MBBSectionRanges
Definition: AsmPrinter.h:135
llvm::AsmPrinter::TM
TargetMachine & TM
Target machine description.
Definition: AsmPrinter.h:84
SmallVector.h
llvm::AsmPrinter::getObjFileLowering
const TargetLoweringObjectFile & getObjFileLowering() const
Return information about object file lowering.
Definition: AsmPrinter.cpp:223
N
#define N
MCStreamer.h
llvm::dwarf::DW_EH_PE_omit
@ DW_EH_PE_omit
Definition: Dwarf.h:433
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:43
llvm::MachineFunction::getCallSiteBeginLabel
unsigned getCallSiteBeginLabel(MCSymbol *BeginLabel) const
Get the call site number for a begin label.
Definition: MachineFunction.h:1144
MachineOperand.h
llvm::LandingPadInfo
This structure is used to retain landing pad info for the current function.
Definition: MachineFunction.h:222
llvm::HexStyle::Asm
@ Asm
0ffh
Definition: MCInstPrinter.h:34
llvm::MachineFunction::getTypeInfos
const std::vector< const GlobalValue * > & getTypeInfos() const
Return a reference to the C++ typeinfo for the current function.
Definition: MachineFunction.h:1165
llvm::AsmPrinter::emitCallSiteValue
void emitCallSiteValue(uint64_t Value, unsigned Encoding) const
Emit an integer value corresponding to the call site encoding.
Definition: AsmPrinterDwarf.cpp:220
llvm::Type::TypeID
TypeID
Definitions of all of the base types for the Type system.
Definition: Type.h:54
llvm::EHStreamer::CallSiteEntry::Action
unsigned Action
Definition: EHStreamer.h:69
llvm::EHStreamer::PadRange
Structure holding a try-range and the associated landing pad.
Definition: EHStreamer.h:43
MachineFunction.h
llvm::SmallVectorImpl::reserve
void reserve(size_type N)
Definition: SmallVector.h:624
llvm::AsmPrinter::getFunctionNumber
unsigned getFunctionNumber() const
Return a unique ID for the current function.
Definition: AsmPrinter.cpp:219
llvm::AsmPrinter::emitEncodingByte
void emitEncodingByte(unsigned Val, const char *Desc=nullptr) const
Emit a .byte 42 directive that corresponds to an encoding.
Definition: AsmPrinterDwarf.cpp:116
llvm::EHStreamer::CallSiteRange::FragmentBeginLabel
MCSymbol * FragmentBeginLabel
Definition: EHStreamer.h:78