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