LLVM  13.0.0git
MCContext.h
Go to the documentation of this file.
1 //===- MCContext.h - Machine Code Context -----------------------*- C++ -*-===//
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 #ifndef LLVM_MC_MCCONTEXT_H
10 #define LLVM_MC_MCCONTEXT_H
11 
12 #include "llvm/ADT/DenseMap.h"
13 #include "llvm/ADT/Optional.h"
14 #include "llvm/ADT/SetVector.h"
15 #include "llvm/ADT/SmallString.h"
16 #include "llvm/ADT/SmallVector.h"
17 #include "llvm/ADT/StringMap.h"
18 #include "llvm/ADT/StringRef.h"
19 #include "llvm/ADT/Twine.h"
21 #include "llvm/BinaryFormat/ELF.h"
23 #include "llvm/MC/MCAsmMacro.h"
24 #include "llvm/MC/MCDwarf.h"
25 #include "llvm/MC/MCPseudoProbe.h"
28 #include "llvm/MC/SectionKind.h"
29 #include "llvm/Support/Allocator.h"
30 #include "llvm/Support/Compiler.h"
31 #include "llvm/Support/Error.h"
32 #include "llvm/Support/MD5.h"
34 #include <algorithm>
35 #include <cassert>
36 #include <cstddef>
37 #include <cstdint>
38 #include <functional>
39 #include <map>
40 #include <memory>
41 #include <string>
42 #include <utility>
43 #include <vector>
44 
45 namespace llvm {
46 
47  class CodeViewContext;
48  class MCAsmInfo;
49  class MCLabel;
50  class MCObjectFileInfo;
51  class MCRegisterInfo;
52  class MCSection;
53  class MCSectionCOFF;
54  class MCSectionELF;
55  class MCSectionMachO;
56  class MCSectionWasm;
57  class MCSectionXCOFF;
58  class MCStreamer;
59  class MCSymbol;
60  class MCSymbolELF;
61  class MCSymbolWasm;
62  class MCSymbolXCOFF;
63  class MDNode;
64  class SMDiagnostic;
65  class SMLoc;
66  class SourceMgr;
67 
68  /// Context object for machine code objects. This class owns all of the
69  /// sections that it creates.
70  ///
71  class MCContext {
72  public:
74  using DiagHandlerTy =
75  std::function<void(const SMDiagnostic &, bool, const SourceMgr &,
76  std::vector<const MDNode *> &)>;
77 
78  private:
79  /// The SourceMgr for this object, if any.
80  const SourceMgr *SrcMgr;
81 
82  /// The SourceMgr for inline assembly, if any.
83  std::unique_ptr<SourceMgr> InlineSrcMgr;
84  std::vector<const MDNode *> LocInfos;
85 
86  DiagHandlerTy DiagHandler;
87 
88  /// The MCAsmInfo for this target.
89  const MCAsmInfo *MAI;
90 
91  /// The MCRegisterInfo for this target.
92  const MCRegisterInfo *MRI;
93 
94  /// The MCObjectFileInfo for this target.
95  const MCObjectFileInfo *MOFI;
96 
97  std::unique_ptr<CodeViewContext> CVContext;
98 
99  /// Allocator object used for creating machine code objects.
100  ///
101  /// We use a bump pointer allocator to avoid the need to track all allocated
102  /// objects.
103  BumpPtrAllocator Allocator;
104 
110  SpecificBumpPtrAllocator<MCInst> MCInstAllocator;
111 
112  /// Bindings of names to symbols.
113  SymbolTable Symbols;
114 
115  /// A mapping from a local label number and an instance count to a symbol.
116  /// For example, in the assembly
117  /// 1:
118  /// 2:
119  /// 1:
120  /// We have three labels represented by the pairs (1, 0), (2, 0) and (1, 1)
122 
123  /// Keeps tracks of names that were used both for used declared and
124  /// artificial symbols. The value is "true" if the name has been used for a
125  /// non-section symbol (there can be at most one of those, plus an unlimited
126  /// number of section symbols with the same name).
128 
129  /// Keeps track of labels that are used in inline assembly.
130  SymbolTable InlineAsmUsedLabelNames;
131 
132  /// The next ID to dole out to an unnamed assembler temporary symbol with
133  /// a given prefix.
134  StringMap<unsigned> NextID;
135 
136  /// Instances of directional local labels.
138  /// NextInstance() creates the next instance of the directional local label
139  /// for the LocalLabelVal and adds it to the map if needed.
140  unsigned NextInstance(unsigned LocalLabelVal);
141  /// GetInstance() gets the current instance of the directional local label
142  /// for the LocalLabelVal and adds it to the map if needed.
143  unsigned GetInstance(unsigned LocalLabelVal);
144 
145  /// The file name of the log file from the environment variable
146  /// AS_SECURE_LOG_FILE. Which must be set before the .secure_log_unique
147  /// directive is used or it is an error.
148  char *SecureLogFile;
149  /// The stream that gets written to for the .secure_log_unique directive.
150  std::unique_ptr<raw_fd_ostream> SecureLog;
151  /// Boolean toggled when .secure_log_unique / .secure_log_reset is seen to
152  /// catch errors if .secure_log_unique appears twice without
153  /// .secure_log_reset appearing between them.
154  bool SecureLogUsed = false;
155 
156  /// The compilation directory to use for DW_AT_comp_dir.
157  SmallString<128> CompilationDir;
158 
159  /// Prefix replacement map for source file information.
160  std::map<const std::string, const std::string> DebugPrefixMap;
161 
162  /// The main file name if passed in explicitly.
163  std::string MainFileName;
164 
165  /// The dwarf file and directory tables from the dwarf .file directive.
166  /// We now emit a line table for each compile unit. To reduce the prologue
167  /// size of each line table, the files and directories used by each compile
168  /// unit are separated.
169  std::map<unsigned, MCDwarfLineTable> MCDwarfLineTablesCUMap;
170 
171  /// The current dwarf line information from the last dwarf .loc directive.
172  MCDwarfLoc CurrentDwarfLoc;
173  bool DwarfLocSeen = false;
174 
175  /// Generate dwarf debugging info for assembly source files.
176  bool GenDwarfForAssembly = false;
177 
178  /// The current dwarf file number when generate dwarf debugging info for
179  /// assembly source files.
180  unsigned GenDwarfFileNumber = 0;
181 
182  /// Sections for generating the .debug_ranges and .debug_aranges sections.
183  SetVector<MCSection *> SectionsForRanges;
184 
185  /// The information gathered from labels that will have dwarf label
186  /// entries when generating dwarf assembly source files.
187  std::vector<MCGenDwarfLabelEntry> MCGenDwarfLabelEntries;
188 
189  /// The string to embed in the debug information for the compile unit, if
190  /// non-empty.
191  StringRef DwarfDebugFlags;
192 
193  /// The string to embed in as the dwarf AT_producer for the compile unit, if
194  /// non-empty.
195  StringRef DwarfDebugProducer;
196 
197  /// The maximum version of dwarf that we should emit.
198  uint16_t DwarfVersion = 4;
199 
200  /// The format of dwarf that we emit.
201  dwarf::DwarfFormat DwarfFormat = dwarf::DWARF32;
202 
203  /// Honor temporary labels, this is useful for debugging semantic
204  /// differences between temporary and non-temporary labels (primarily on
205  /// Darwin).
206  bool AllowTemporaryLabels = true;
207  bool UseNamesOnTempLabels = false;
208 
209  /// The Compile Unit ID that we are currently processing.
210  unsigned DwarfCompileUnitID = 0;
211 
212  /// A collection of MCPseudoProbe in the current module
213  MCPseudoProbeTable PseudoProbeTable;
214 
215  // Sections are differentiated by the quadruple (section_name, group_name,
216  // unique_id, link_to_symbol_name). Sections sharing the same quadruple are
217  // combined into one section.
218  struct ELFSectionKey {
219  std::string SectionName;
220  StringRef GroupName;
221  StringRef LinkedToName;
222  unsigned UniqueID;
223 
224  ELFSectionKey(StringRef SectionName, StringRef GroupName,
225  StringRef LinkedToName, unsigned UniqueID)
226  : SectionName(SectionName), GroupName(GroupName),
227  LinkedToName(LinkedToName), UniqueID(UniqueID) {}
228 
229  bool operator<(const ELFSectionKey &Other) const {
230  if (SectionName != Other.SectionName)
231  return SectionName < Other.SectionName;
232  if (GroupName != Other.GroupName)
233  return GroupName < Other.GroupName;
234  if (int O = LinkedToName.compare(Other.LinkedToName))
235  return O < 0;
236  return UniqueID < Other.UniqueID;
237  }
238  };
239 
240  struct COFFSectionKey {
241  std::string SectionName;
242  StringRef GroupName;
243  int SelectionKey;
244  unsigned UniqueID;
245 
246  COFFSectionKey(StringRef SectionName, StringRef GroupName,
247  int SelectionKey, unsigned UniqueID)
248  : SectionName(SectionName), GroupName(GroupName),
249  SelectionKey(SelectionKey), UniqueID(UniqueID) {}
250 
251  bool operator<(const COFFSectionKey &Other) const {
252  if (SectionName != Other.SectionName)
253  return SectionName < Other.SectionName;
254  if (GroupName != Other.GroupName)
255  return GroupName < Other.GroupName;
256  if (SelectionKey != Other.SelectionKey)
257  return SelectionKey < Other.SelectionKey;
258  return UniqueID < Other.UniqueID;
259  }
260  };
261 
262  struct WasmSectionKey {
263  std::string SectionName;
264  StringRef GroupName;
265  unsigned UniqueID;
266 
267  WasmSectionKey(StringRef SectionName, StringRef GroupName,
268  unsigned UniqueID)
269  : SectionName(SectionName), GroupName(GroupName), UniqueID(UniqueID) {
270  }
271 
272  bool operator<(const WasmSectionKey &Other) const {
273  if (SectionName != Other.SectionName)
274  return SectionName < Other.SectionName;
275  if (GroupName != Other.GroupName)
276  return GroupName < Other.GroupName;
277  return UniqueID < Other.UniqueID;
278  }
279  };
280 
281  struct XCOFFSectionKey {
282  // Section name.
283  std::string SectionName;
284  // Section property.
285  // For csect section, it is storage mapping class.
286  // For debug section, it is section type flags.
287  union {
288  XCOFF::StorageMappingClass MappingClass;
289  XCOFF::DwarfSectionSubtypeFlags DwarfSubtypeFlags;
290  };
291  bool IsCsect;
292 
293  XCOFFSectionKey(StringRef SectionName,
294  XCOFF::StorageMappingClass MappingClass)
295  : SectionName(SectionName), MappingClass(MappingClass),
296  IsCsect(true) {}
297 
298  XCOFFSectionKey(StringRef SectionName,
299  XCOFF::DwarfSectionSubtypeFlags DwarfSubtypeFlags)
300  : SectionName(SectionName), DwarfSubtypeFlags(DwarfSubtypeFlags),
301  IsCsect(false) {}
302 
303  bool operator<(const XCOFFSectionKey &Other) const {
304  if (IsCsect && Other.IsCsect)
305  return std::tie(SectionName, MappingClass) <
306  std::tie(Other.SectionName, Other.MappingClass);
307  if (IsCsect != Other.IsCsect)
308  return IsCsect;
309  return std::tie(SectionName, DwarfSubtypeFlags) <
310  std::tie(Other.SectionName, Other.DwarfSubtypeFlags);
311  }
312  };
313 
314  StringMap<MCSectionMachO *> MachOUniquingMap;
315  std::map<ELFSectionKey, MCSectionELF *> ELFUniquingMap;
316  std::map<COFFSectionKey, MCSectionCOFF *> COFFUniquingMap;
317  std::map<WasmSectionKey, MCSectionWasm *> WasmUniquingMap;
318  std::map<XCOFFSectionKey, MCSectionXCOFF *> XCOFFUniquingMap;
319  StringMap<bool> RelSecNames;
320 
321  SpecificBumpPtrAllocator<MCSubtargetInfo> MCSubtargetAllocator;
322 
323  /// Do automatic reset in destructor
324  bool AutoReset;
325 
326  MCTargetOptions const *TargetOptions;
327 
328  bool HadError = false;
329 
330  void reportCommon(SMLoc Loc,
331  std::function<void(SMDiagnostic &, const SourceMgr *)>);
332 
333  MCSymbol *createSymbolImpl(const StringMapEntry<bool> *Name,
334  bool CanBeUnnamed);
335  MCSymbol *createSymbol(StringRef Name, bool AlwaysAddSuffix,
336  bool IsTemporary);
337 
338  MCSymbol *getOrCreateDirectionalLocalSymbol(unsigned LocalLabelVal,
339  unsigned Instance);
340 
341  MCSectionELF *createELFSectionImpl(StringRef Section, unsigned Type,
342  unsigned Flags, SectionKind K,
343  unsigned EntrySize,
344  const MCSymbolELF *Group, bool IsComdat,
345  unsigned UniqueID,
346  const MCSymbolELF *LinkedToSym);
347 
348  MCSymbolXCOFF *createXCOFFSymbolImpl(const StringMapEntry<bool> *Name,
349  bool IsTemporary);
350 
351  /// Map of currently defined macros.
352  StringMap<MCAsmMacro> MacroMap;
353 
354  struct ELFEntrySizeKey {
355  std::string SectionName;
356  unsigned Flags;
357  unsigned EntrySize;
358 
359  ELFEntrySizeKey(StringRef SectionName, unsigned Flags, unsigned EntrySize)
360  : SectionName(SectionName), Flags(Flags), EntrySize(EntrySize) {}
361 
362  bool operator<(const ELFEntrySizeKey &Other) const {
363  if (SectionName != Other.SectionName)
364  return SectionName < Other.SectionName;
365  if ((Flags & ELF::SHF_STRINGS) != (Other.Flags & ELF::SHF_STRINGS))
366  return Other.Flags & ELF::SHF_STRINGS;
367  return EntrySize < Other.EntrySize;
368  }
369  };
370 
371  // Symbols must be assigned to a section with a compatible entry
372  // size. This map is used to assign unique IDs to sections to
373  // distinguish between sections with identical names but incompatible entry
374  // sizes. This can occur when a symbol is explicitly assigned to a
375  // section, e.g. via __attribute__((section("myname"))).
376  std::map<ELFEntrySizeKey, unsigned> ELFEntrySizeMap;
377 
378  // This set is used to record the generic mergeable section names seen.
379  // These are sections that are created as mergeable e.g. .debug_str. We need
380  // to avoid assigning non-mergeable symbols to these sections. It is used
381  // to prevent non-mergeable symbols being explicitly assigned to mergeable
382  // sections (e.g. via _attribute_((section("myname")))).
383  DenseSet<StringRef> ELFSeenGenericMergeableSections;
384 
385  public:
386  explicit MCContext(const MCAsmInfo *MAI, const MCRegisterInfo *MRI,
387  const MCObjectFileInfo *MOFI,
388  const SourceMgr *Mgr = nullptr,
389  MCTargetOptions const *TargetOpts = nullptr,
390  bool DoAutoReset = true);
391  MCContext(const MCContext &) = delete;
392  MCContext &operator=(const MCContext &) = delete;
393  ~MCContext();
394 
395  const SourceMgr *getSourceManager() const { return SrcMgr; }
396 
399  return InlineSrcMgr.get();
400  }
401  std::vector<const MDNode *> &getLocInfos() { return LocInfos; }
403  this->DiagHandler = DiagHandler;
404  }
405 
406  const MCAsmInfo *getAsmInfo() const { return MAI; }
407 
408  const MCRegisterInfo *getRegisterInfo() const { return MRI; }
409 
410  const MCObjectFileInfo *getObjectFileInfo() const { return MOFI; }
411 
413 
414  void setAllowTemporaryLabels(bool Value) { AllowTemporaryLabels = Value; }
415  void setUseNamesOnTempLabels(bool Value) { UseNamesOnTempLabels = Value; }
416 
417  /// \name Module Lifetime Management
418  /// @{
419 
420  /// reset - return object to right after construction state to prepare
421  /// to process a new module
422  void reset();
423 
424  /// @}
425 
426  /// \name McInst Management
427 
428  /// Create and return a new MC instruction.
429  MCInst *createMCInst();
430 
431  /// \name Symbol Management
432  /// @{
433 
434  /// Create and return a new linker temporary symbol with a unique but
435  /// unspecified name.
437 
438  /// Create a temporary symbol with a unique name. The name will be omitted
439  /// in the symbol table if UseNamesOnTempLabels is false (default except
440  /// MCAsmStreamer). The overload without Name uses an unspecified name.
442  MCSymbol *createTempSymbol(const Twine &Name, bool AlwaysAddSuffix = true);
443 
444  /// Create a temporary symbol with a unique name whose name cannot be
445  /// omitted in the symbol table. This is rarely used.
448 
449  /// Create the definition of a directional local symbol for numbered label
450  /// (used for "1:" definitions).
451  MCSymbol *createDirectionalLocalSymbol(unsigned LocalLabelVal);
452 
453  /// Create and return a directional local symbol for numbered label (used
454  /// for "1b" or 1f" references).
455  MCSymbol *getDirectionalLocalSymbol(unsigned LocalLabelVal, bool Before);
456 
457  /// Lookup the symbol inside with the specified \p Name. If it exists,
458  /// return it. If not, create a forward reference and return it.
459  ///
460  /// \param Name - The symbol name, which must be unique across all symbols.
462 
463  /// Gets a symbol that will be defined to the final stack offset of a local
464  /// variable after codegen.
465  ///
466  /// \param Idx - The index of a local variable passed to \@llvm.localescape.
467  MCSymbol *getOrCreateFrameAllocSymbol(StringRef FuncName, unsigned Idx);
468 
470 
472 
473  /// Get the symbol for \p Name, or null.
474  MCSymbol *lookupSymbol(const Twine &Name) const;
475 
476  /// Set value for a symbol.
477  void setSymbolValue(MCStreamer &Streamer, StringRef Sym, uint64_t Val);
478 
479  /// getSymbols - Get a reference for the symbol table for clients that
480  /// want to, for example, iterate over all symbols. 'const' because we
481  /// still want any modifications to the table itself to use the MCContext
482  /// APIs.
483  const SymbolTable &getSymbols() const { return Symbols; }
484 
485  /// isInlineAsmLabel - Return true if the name is a label referenced in
486  /// inline assembly.
488  return InlineAsmUsedLabelNames.lookup(Name);
489  }
490 
491  /// registerInlineAsmLabel - Records that the name is a label referenced in
492  /// inline assembly.
493  void registerInlineAsmLabel(MCSymbol *Sym);
494 
495  /// @}
496 
497  /// \name Section Management
498  /// @{
499 
500  enum : unsigned {
501  /// Pass this value as the UniqueID during section creation to get the
502  /// generic section with the given name and characteristics. The usual
503  /// sections such as .text use this ID.
505  };
506 
507  /// Return the MCSection for the specified mach-o section. This requires
508  /// the operands to be valid.
510  unsigned TypeAndAttributes,
511  unsigned Reserved2, SectionKind K,
512  const char *BeginSymName = nullptr);
513 
515  unsigned TypeAndAttributes, SectionKind K,
516  const char *BeginSymName = nullptr) {
517  return getMachOSection(Segment, Section, TypeAndAttributes, 0, K,
518  BeginSymName);
519  }
520 
522  unsigned Flags) {
523  return getELFSection(Section, Type, Flags, 0, "", false);
524  }
525 
527  unsigned Flags, unsigned EntrySize) {
528  return getELFSection(Section, Type, Flags, EntrySize, "", false,
529  MCSection::NonUniqueID, nullptr);
530  }
531 
533  unsigned Flags, unsigned EntrySize,
534  const Twine &Group, bool IsComdat) {
535  return getELFSection(Section, Type, Flags, EntrySize, Group, IsComdat,
536  MCSection::NonUniqueID, nullptr);
537  }
538 
539  MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
540  unsigned Flags, unsigned EntrySize,
541  const Twine &Group, bool IsComdat,
542  unsigned UniqueID,
543  const MCSymbolELF *LinkedToSym);
544 
545  MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
546  unsigned Flags, unsigned EntrySize,
547  const MCSymbolELF *Group, bool IsComdat,
548  unsigned UniqueID,
549  const MCSymbolELF *LinkedToSym);
550 
551  /// Get a section with the provided group identifier. This section is
552  /// named by concatenating \p Prefix with '.' then \p Suffix. The \p Type
553  /// describes the type of the section and \p Flags are used to further
554  /// configure this named section.
555  MCSectionELF *getELFNamedSection(const Twine &Prefix, const Twine &Suffix,
556  unsigned Type, unsigned Flags,
557  unsigned EntrySize = 0);
558 
559  MCSectionELF *createELFRelSection(const Twine &Name, unsigned Type,
560  unsigned Flags, unsigned EntrySize,
561  const MCSymbolELF *Group,
562  const MCSectionELF *RelInfoSection);
563 
565 
567  bool IsComdat);
568 
570  unsigned UniqueID, unsigned EntrySize);
571 
573 
575 
577  unsigned Flags,
578  unsigned EntrySize);
579 
581  SectionKind Kind, StringRef COMDATSymName,
582  int Selection,
583  unsigned UniqueID = GenericSectionID,
584  const char *BeginSymName = nullptr);
585 
588  const char *BeginSymName = nullptr);
589 
590  /// Gets or creates a section equivalent to Sec that is associated with the
591  /// section containing KeySym. For example, to create a debug info section
592  /// associated with an inline function, pass the normal debug info section
593  /// as Sec and the function symbol as KeySym.
594  MCSectionCOFF *
596  unsigned UniqueID = GenericSectionID);
597 
599  return getWasmSection(Section, K, nullptr);
600  }
601 
603  const char *BeginSymName) {
604  return getWasmSection(Section, K, "", ~0, BeginSymName);
605  }
606 
608  const Twine &Group, unsigned UniqueID) {
609  return getWasmSection(Section, K, Group, UniqueID, nullptr);
610  }
611 
613  const Twine &Group, unsigned UniqueID,
614  const char *BeginSymName);
615 
617  const MCSymbolWasm *Group, unsigned UniqueID,
618  const char *BeginSymName);
619 
623  bool MultiSymbolsAllowed = false, const char *BeginSymName = nullptr,
624  Optional<XCOFF::DwarfSectionSubtypeFlags> DwarfSubtypeFlags = None);
625 
626  // Create and save a copy of STI and return a reference to the copy.
628 
629  /// @}
630 
631  /// \name Dwarf Management
632  /// @{
633 
634  /// Get the compilation directory for DW_AT_comp_dir
635  /// The compilation directory should be set with \c setCompilationDir before
636  /// calling this function. If it is unset, an empty string will be returned.
637  StringRef getCompilationDir() const { return CompilationDir; }
638 
639  /// Set the compilation directory for DW_AT_comp_dir
640  void setCompilationDir(StringRef S) { CompilationDir = S.str(); }
641 
642  /// Add an entry to the debug prefix map.
643  void addDebugPrefixMapEntry(const std::string &From, const std::string &To);
644 
645  // Remaps all debug directory paths in-place as per the debug prefix map.
646  void RemapDebugPaths();
647 
648  /// Get the main file name for use in error messages and debug
649  /// info. This can be set to ensure we've got the correct file name
650  /// after preprocessing or for -save-temps.
651  const std::string &getMainFileName() const { return MainFileName; }
652 
653  /// Set the main file name and override the default.
654  void setMainFileName(StringRef S) { MainFileName = std::string(S); }
655 
656  /// Creates an entry in the dwarf file and directory tables.
658  unsigned FileNumber,
659  Optional<MD5::MD5Result> Checksum,
660  Optional<StringRef> Source, unsigned CUID);
661 
662  bool isValidDwarfFileNumber(unsigned FileNumber, unsigned CUID = 0);
663 
664  const std::map<unsigned, MCDwarfLineTable> &getMCDwarfLineTables() const {
665  return MCDwarfLineTablesCUMap;
666  }
667 
669  return MCDwarfLineTablesCUMap[CUID];
670  }
671 
672  const MCDwarfLineTable &getMCDwarfLineTable(unsigned CUID) const {
673  auto I = MCDwarfLineTablesCUMap.find(CUID);
674  assert(I != MCDwarfLineTablesCUMap.end());
675  return I->second;
676  }
677 
678  const SmallVectorImpl<MCDwarfFile> &getMCDwarfFiles(unsigned CUID = 0) {
679  return getMCDwarfLineTable(CUID).getMCDwarfFiles();
680  }
681 
682  const SmallVectorImpl<std::string> &getMCDwarfDirs(unsigned CUID = 0) {
683  return getMCDwarfLineTable(CUID).getMCDwarfDirs();
684  }
685 
686  unsigned getDwarfCompileUnitID() { return DwarfCompileUnitID; }
687 
688  void setDwarfCompileUnitID(unsigned CUIndex) {
689  DwarfCompileUnitID = CUIndex;
690  }
691 
692  /// Specifies the "root" file and directory of the compilation unit.
693  /// These are "file 0" and "directory 0" in DWARF v5.
694  void setMCLineTableRootFile(unsigned CUID, StringRef CompilationDir,
695  StringRef Filename,
696  Optional<MD5::MD5Result> Checksum,
698  getMCDwarfLineTable(CUID).setRootFile(CompilationDir, Filename, Checksum,
699  Source);
700  }
701 
702  /// Reports whether MD5 checksum usage is consistent (all-or-none).
703  bool isDwarfMD5UsageConsistent(unsigned CUID) const {
705  }
706 
707  /// Saves the information from the currently parsed dwarf .loc directive
708  /// and sets DwarfLocSeen. When the next instruction is assembled an entry
709  /// in the line number table with this information and the address of the
710  /// instruction will be created.
711  void setCurrentDwarfLoc(unsigned FileNum, unsigned Line, unsigned Column,
712  unsigned Flags, unsigned Isa,
713  unsigned Discriminator) {
714  CurrentDwarfLoc.setFileNum(FileNum);
715  CurrentDwarfLoc.setLine(Line);
716  CurrentDwarfLoc.setColumn(Column);
717  CurrentDwarfLoc.setFlags(Flags);
718  CurrentDwarfLoc.setIsa(Isa);
719  CurrentDwarfLoc.setDiscriminator(Discriminator);
720  DwarfLocSeen = true;
721  }
722 
723  void clearDwarfLocSeen() { DwarfLocSeen = false; }
724 
725  bool getDwarfLocSeen() { return DwarfLocSeen; }
726  const MCDwarfLoc &getCurrentDwarfLoc() { return CurrentDwarfLoc; }
727 
728  bool getGenDwarfForAssembly() { return GenDwarfForAssembly; }
729  void setGenDwarfForAssembly(bool Value) { GenDwarfForAssembly = Value; }
730  unsigned getGenDwarfFileNumber() { return GenDwarfFileNumber; }
731 
732  void setGenDwarfFileNumber(unsigned FileNumber) {
733  GenDwarfFileNumber = FileNumber;
734  }
735 
736  /// Specifies information about the "root file" for assembler clients
737  /// (e.g., llvm-mc). Assumes compilation dir etc. have been set up.
738  void setGenDwarfRootFile(StringRef FileName, StringRef Buffer);
739 
741  return SectionsForRanges;
742  }
743 
745  return SectionsForRanges.insert(Sec);
746  }
747 
748  void finalizeDwarfSections(MCStreamer &MCOS);
749 
750  const std::vector<MCGenDwarfLabelEntry> &getMCGenDwarfLabelEntries() const {
751  return MCGenDwarfLabelEntries;
752  }
753 
755  MCGenDwarfLabelEntries.push_back(E);
756  }
757 
758  void setDwarfDebugFlags(StringRef S) { DwarfDebugFlags = S; }
759  StringRef getDwarfDebugFlags() { return DwarfDebugFlags; }
760 
761  void setDwarfDebugProducer(StringRef S) { DwarfDebugProducer = S; }
762  StringRef getDwarfDebugProducer() { return DwarfDebugProducer; }
763 
764  void setDwarfFormat(dwarf::DwarfFormat f) { DwarfFormat = f; }
765  dwarf::DwarfFormat getDwarfFormat() const { return DwarfFormat; }
766 
767  void setDwarfVersion(uint16_t v) { DwarfVersion = v; }
768  uint16_t getDwarfVersion() const { return DwarfVersion; }
769 
770  /// @}
771 
772  char *getSecureLogFile() { return SecureLogFile; }
773  raw_fd_ostream *getSecureLog() { return SecureLog.get(); }
774 
775  void setSecureLog(std::unique_ptr<raw_fd_ostream> Value) {
776  SecureLog = std::move(Value);
777  }
778 
779  bool getSecureLogUsed() { return SecureLogUsed; }
780  void setSecureLogUsed(bool Value) { SecureLogUsed = Value; }
781 
782  void *allocate(unsigned Size, unsigned Align = 8) {
783  return Allocator.Allocate(Size, Align);
784  }
785 
786  void deallocate(void *Ptr) {}
787 
788  bool hadError() { return HadError; }
789  void diagnose(const SMDiagnostic &SMD);
790  void reportError(SMLoc L, const Twine &Msg);
791  void reportWarning(SMLoc L, const Twine &Msg);
792  // Unrecoverable error has occurred. Display the best diagnostic we can
793  // and bail via exit(1). For now, most MC backend errors are unrecoverable.
794  // FIXME: We should really do something about that.
796 
798  StringMap<MCAsmMacro>::iterator I = MacroMap.find(Name);
799  return (I == MacroMap.end()) ? nullptr : &I->getValue();
800  }
801 
803  MacroMap.insert(std::make_pair(Name, std::move(Macro)));
804  }
805 
806  void undefineMacro(StringRef Name) { MacroMap.erase(Name); }
807 
808  MCPseudoProbeTable &getMCPseudoProbeTable() { return PseudoProbeTable; }
809  };
810 
811 } // end namespace llvm
812 
813 // operator new and delete aren't allowed inside namespaces.
814 // The throw specifications are mandated by the standard.
815 /// Placement new for using the MCContext's allocator.
816 ///
817 /// This placement form of operator new uses the MCContext's allocator for
818 /// obtaining memory. It is a non-throwing new, which means that it returns
819 /// null on error. (If that is what the allocator does. The current does, so if
820 /// this ever changes, this operator will have to be changed, too.)
821 /// Usage looks like this (assuming there's an MCContext 'Context' in scope):
822 /// \code
823 /// // Default alignment (8)
824 /// IntegerLiteral *Ex = new (Context) IntegerLiteral(arguments);
825 /// // Specific alignment
826 /// IntegerLiteral *Ex2 = new (Context, 4) IntegerLiteral(arguments);
827 /// \endcode
828 /// Please note that you cannot use delete on the pointer; it must be
829 /// deallocated using an explicit destructor call followed by
830 /// \c Context.Deallocate(Ptr).
831 ///
832 /// \param Bytes The number of bytes to allocate. Calculated by the compiler.
833 /// \param C The MCContext that provides the allocator.
834 /// \param Alignment The alignment of the allocated memory (if the underlying
835 /// allocator supports it).
836 /// \return The allocated memory. Could be NULL.
837 inline void *operator new(size_t Bytes, llvm::MCContext &C,
838  size_t Alignment = 8) noexcept {
839  return C.allocate(Bytes, Alignment);
840 }
841 /// Placement delete companion to the new above.
842 ///
843 /// This operator is just a companion to the new above. There is no way of
844 /// invoking it directly; see the new operator for more details. This operator
845 /// is called implicitly by the compiler if a placement new expression using
846 /// the MCContext throws in the object constructor.
847 inline void operator delete(void *Ptr, llvm::MCContext &C, size_t) noexcept {
848  C.deallocate(Ptr);
849 }
850 
851 /// This placement form of operator new[] uses the MCContext's allocator for
852 /// obtaining memory. It is a non-throwing new[], which means that it returns
853 /// null on error.
854 /// Usage looks like this (assuming there's an MCContext 'Context' in scope):
855 /// \code
856 /// // Default alignment (8)
857 /// char *data = new (Context) char[10];
858 /// // Specific alignment
859 /// char *data = new (Context, 4) char[10];
860 /// \endcode
861 /// Please note that you cannot use delete on the pointer; it must be
862 /// deallocated using an explicit destructor call followed by
863 /// \c Context.Deallocate(Ptr).
864 ///
865 /// \param Bytes The number of bytes to allocate. Calculated by the compiler.
866 /// \param C The MCContext that provides the allocator.
867 /// \param Alignment The alignment of the allocated memory (if the underlying
868 /// allocator supports it).
869 /// \return The allocated memory. Could be NULL.
870 inline void *operator new[](size_t Bytes, llvm::MCContext &C,
871  size_t Alignment = 8) noexcept {
872  return C.allocate(Bytes, Alignment);
873 }
874 
875 /// Placement delete[] companion to the new[] above.
876 ///
877 /// This operator is just a companion to the new[] above. There is no way of
878 /// invoking it directly; see the new[] operator for more details. This operator
879 /// is called implicitly by the compiler if a placement new[] expression using
880 /// the MCContext throws in the object constructor.
881 inline void operator delete[](void *Ptr, llvm::MCContext &C) noexcept {
882  C.deallocate(Ptr);
883 }
884 
885 #endif // LLVM_MC_MCCONTEXT_H
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
llvm::EngineKind::Kind
Kind
Definition: ExecutionEngine.h:524
llvm::MCContext::getObjectFileInfo
const MCObjectFileInfo * getObjectFileInfo() const
Definition: MCContext.h:410
llvm::MCContext::getMCDwarfDirs
const SmallVectorImpl< std::string > & getMCDwarfDirs(unsigned CUID=0)
Definition: MCContext.h:682
MCDwarf.h
llvm
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
llvm::MCSectionXCOFF
Definition: MCSectionXCOFF.h:32
Optional.h
llvm::MCContext::GenericSectionID
@ GenericSectionID
Pass this value as the UniqueID during section creation to get the generic section with the given nam...
Definition: MCContext.h:504
MCTargetOptions.h
llvm::MCDwarfLoc::setIsa
void setIsa(unsigned isa)
Set the Isa of this MCDwarfLoc.
Definition: MCDwarf.h:143
llvm::MCContext::getDwarfFormat
dwarf::DwarfFormat getDwarfFormat() const
Definition: MCContext.h:765
llvm::MCContext::getCurrentDwarfLoc
const MCDwarfLoc & getCurrentDwarfLoc()
Definition: MCContext.h:726
llvm::MCDwarfLoc::setFileNum
void setFileNum(unsigned fileNum)
Set the FileNum of this MCDwarfLoc.
Definition: MCDwarf.h:125
llvm::MCContext::getCVContext
CodeViewContext & getCVContext()
Definition: MCContext.cpp:862
llvm::cl::Prefix
@ Prefix
Definition: CommandLine.h:161
llvm::MCContext::getOrCreateParentFrameOffsetSymbol
MCSymbol * getOrCreateParentFrameOffsetSymbol(StringRef FuncName)
Definition: MCContext.cpp:176
llvm::XCOFF::DwarfSectionSubtypeFlags
DwarfSectionSubtypeFlags
Values for defining the section subtype of sections of type STYP_DWARF as they would appear in the (s...
Definition: XCOFF.h:89
llvm::MCContext::getGenDwarfFileNumber
unsigned getGenDwarfFileNumber()
Definition: MCContext.h:730
llvm::MCContext
Context object for machine code objects.
Definition: MCContext.h:71
llvm::MCContext::getMachOSection
MCSectionMachO * getMachOSection(StringRef Segment, StringRef Section, unsigned TypeAndAttributes, SectionKind K, const char *BeginSymName=nullptr)
Definition: MCContext.h:514
llvm::MCContext::getRegisterInfo
const MCRegisterInfo * getRegisterInfo() const
Definition: MCContext.h:408
StringRef.h
llvm::MCContext::lookupMacro
const MCAsmMacro * lookupMacro(StringRef Name)
Definition: MCContext.h:797
llvm::MCContext::getSymbols
const SymbolTable & getSymbols() const
getSymbols - Get a reference for the symbol table for clients that want to, for example,...
Definition: MCContext.h:483
llvm::MCAsmInfo
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
llvm::MCContext::setGenDwarfRootFile
void setGenDwarfRootFile(StringRef FileName, StringRef Buffer)
Specifies information about the "root file" for assembler clients (e.g., llvm-mc).
Definition: MCContext.cpp:792
Allocator.h
Error.h
llvm::MCContext::setSecureLog
void setSecureLog(std::unique_ptr< raw_fd_ostream > Value)
Definition: MCContext.h:775
llvm::SpecificBumpPtrAllocator
A BumpPtrAllocator that allows only elements of a specific type to be allocated.
Definition: Allocator.h:376
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:46
DenseMap.h
llvm::MCContext::getELFSection
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags, unsigned EntrySize, const Twine &Group, bool IsComdat)
Definition: MCContext.h:532
MCPseudoProbe.h
llvm::MCContext::undefineMacro
void undefineMacro(StringRef Name)
Definition: MCContext.h:806
llvm::MCContext::allocate
void * allocate(unsigned Size, unsigned Align=8)
Definition: MCContext.h:782
llvm::Optional< unsigned >
llvm::MCContext::setDwarfVersion
void setDwarfVersion(uint16_t v)
Definition: MCContext.h:767
llvm::MCContext::MCContext
MCContext(const MCAsmInfo *MAI, const MCRegisterInfo *MRI, const MCObjectFileInfo *MOFI, const SourceMgr *Mgr=nullptr, MCTargetOptions const *TargetOpts=nullptr, bool DoAutoReset=true)
Definition: MCContext.cpp:65
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:42
llvm::MCInst
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:183
llvm::MCContext::getDwarfDebugFlags
StringRef getDwarfDebugFlags()
Definition: MCContext.h:759
llvm::MCSectionELF
This represents a section on linux, lots of unix variants and some bare metal systems.
Definition: MCSectionELF.h:28
llvm::MCContext::createNamedTempSymbol
MCSymbol * createNamedTempSymbol()
Create a temporary symbol with a unique name whose name cannot be omitted in the symbol table.
Definition: MCContext.cpp:270
llvm::MCDwarfLoc::setColumn
void setColumn(unsigned column)
Set the Column of this MCDwarfLoc.
Definition: MCDwarf.h:131
llvm::MCContext::addGenDwarfSection
bool addGenDwarfSection(MCSection *Sec)
Definition: MCContext.h:744
llvm::MCContext::diagnose
void diagnose(const SMDiagnostic &SMD)
Definition: MCContext.cpp:872
llvm::MCContext::getLocInfos
std::vector< const MDNode * > & getLocInfos()
Definition: MCContext.h:401
llvm::MCContext::lookupSymbol
MCSymbol * lookupSymbol(const Twine &Name) const
Get the symbol for Name, or null.
Definition: MCContext.cpp:309
llvm::MCContext::isELFImplicitMergeableSectionNamePrefix
bool isELFImplicitMergeableSectionNamePrefix(StringRef Name)
Definition: MCContext.cpp:566
size_t
llvm::MCContext::getDwarfFile
Expected< unsigned > getDwarfFile(StringRef Directory, StringRef FileName, unsigned FileNumber, Optional< MD5::MD5Result > Checksum, Optional< StringRef > Source, unsigned CUID)
Creates an entry in the dwarf file and directory tables.
Definition: MCContext.cpp:832
llvm::MCDwarfLineTable::setRootFile
void setRootFile(StringRef Directory, StringRef FileName, Optional< MD5::MD5Result > Checksum, Optional< StringRef > Source)
Definition: MCDwarf.h:332
llvm::MCContext::setSymbolValue
void setSymbolValue(MCStreamer &Streamer, StringRef Sym, uint64_t Val)
Set value for a symbol.
Definition: MCContext.cpp:315
llvm::MCContext::getOrCreateLSDASymbol
MCSymbol * getOrCreateLSDASymbol(StringRef FuncName)
Definition: MCContext.cpp:181
llvm::MCContext::getMachOSection
MCSectionMachO * getMachOSection(StringRef Segment, StringRef Section, unsigned TypeAndAttributes, unsigned Reserved2, SectionKind K, const char *BeginSymName=nullptr)
Return the MCSection for the specified mach-o section.
Definition: MCContext.cpp:385
llvm::MCGenDwarfLabelEntry
Definition: MCDwarf.h:413
llvm::MCSymbolELF
Definition: MCSymbolELF.h:14
llvm::ARMBuildAttrs::Section
@ Section
Legacy Tags.
Definition: ARMBuildAttributes.h:78
XCOFF.h
llvm::MCDwarfLoc::setFlags
void setFlags(unsigned flags)
Set the Flags of this MCDwarfLoc.
Definition: MCDwarf.h:137
llvm::MCStreamer
Streaming machine code generation interface.
Definition: MCStreamer.h:197
llvm::MCContext::getOrCreateSymbol
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
Definition: MCContext.cpp:157
llvm::MCContext::setMainFileName
void setMainFileName(StringRef S)
Set the main file name and override the default.
Definition: MCContext.h:654
llvm::MCDwarfLoc::setDiscriminator
void setDiscriminator(unsigned discriminator)
Set the Discriminator of this MCDwarfLoc.
Definition: MCDwarf.h:149
llvm::MCDwarfLoc::setLine
void setLine(unsigned line)
Set the Line of this MCDwarfLoc.
Definition: MCDwarf.h:128
ELF.h
llvm::MCContext::isELFGenericMergeableSection
bool isELFGenericMergeableSection(StringRef Name)
Definition: MCContext.cpp:571
llvm::SMLoc
Represents a location in source code.
Definition: SMLoc.h:23
llvm::MCContext::getDwarfDebugProducer
StringRef getDwarfDebugProducer()
Definition: MCContext.h:762
llvm::MCContext::getDwarfCompileUnitID
unsigned getDwarfCompileUnitID()
Definition: MCContext.h:686
MD5.h
SmallString.h
f
Itanium Name Demangler i e convert the string _Z1fv into f()". You can also use the CRTP base ManglingParser to perform some simple analysis on the mangled name
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::MCSectionWasm
This represents a section on wasm.
Definition: MCSectionWasm.h:26
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
Twine.h
llvm::MCContext::getMCPseudoProbeTable
MCPseudoProbeTable & getMCPseudoProbeTable()
Definition: MCContext.h:808
llvm::CodeViewContext
Holds state from .cv_file and .cv_loc directives for later emission.
Definition: MCCodeView.h:137
llvm::SrcMgr
SourceMgr SrcMgr
Definition: Error.cpp:24
llvm::MCContext::createMCInst
MCInst * createMCInst()
Create and return a new MC instruction.
Definition: MCContext.cpp:149
llvm::SMDiagnostic
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...
Definition: SourceMgr.h:251
llvm::MCContext::getELFSection
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)
Definition: MCContext.h:521
false
Definition: StackSlotColoring.cpp:142
llvm::MCContext::getDwarfVersion
uint16_t getDwarfVersion() const
Definition: MCContext.h:768
MCSubtargetInfo.h
llvm::MCDwarfLineTable
Definition: MCDwarf.h:308
llvm::MCContext::setDwarfDebugFlags
void setDwarfDebugFlags(StringRef S)
Definition: MCContext.h:758
llvm::MCContext::setAllowTemporaryLabels
void setAllowTemporaryLabels(bool Value)
Definition: MCContext.h:414
llvm::MCContext::getGenDwarfForAssembly
bool getGenDwarfForAssembly()
Definition: MCContext.h:728
llvm::MCContext::getCompilationDir
StringRef getCompilationDir() const
Get the compilation directory for DW_AT_comp_dir The compilation directory should be set with setComp...
Definition: MCContext.h:637
llvm::MCContext::getXCOFFSection
MCSectionXCOFF * getXCOFFSection(StringRef Section, SectionKind K, Optional< XCOFF::CsectProperties > CsectProp=None, bool MultiSymbolsAllowed=false, const char *BeginSymName=nullptr, Optional< XCOFF::DwarfSectionSubtypeFlags > DwarfSubtypeFlags=None)
Definition: MCContext.cpp:689
llvm::AMDGPU::ElfNote::SectionName
const char SectionName[]
Definition: AMDGPUPTNote.h:24
llvm::MCContext::registerInlineAsmLabel
void registerInlineAsmLabel(MCSymbol *Sym)
registerInlineAsmLabel - Records that the name is a label referenced in inline assembly.
Definition: MCContext.cpp:322
StringMap.h
llvm::Align
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
llvm::dwarf::DwarfFormat
DwarfFormat
Constants that define the DWARF format as 32 or 64 bit.
Definition: Dwarf.h:92
llvm::MCContext::getWasmSection
MCSectionWasm * getWasmSection(const Twine &Section, SectionKind K, const Twine &Group, unsigned UniqueID)
Definition: MCContext.h:607
llvm::MCContext::reportFatalError
LLVM_ATTRIBUTE_NORETURN void reportFatalError(SMLoc L, const Twine &Msg)
Definition: MCContext.cpp:936
llvm::MCContext::getAssociativeCOFFSection
MCSectionCOFF * getAssociativeCOFFSection(MCSectionCOFF *Sec, const MCSymbol *KeySym, unsigned UniqueID=GenericSectionID)
Gets or creates a section equivalent to Sec that is associated with the section containing KeySym.
Definition: MCContext.cpp:624
llvm::None
const NoneType None
Definition: None.h:23
llvm::MCContext::setDwarfCompileUnitID
void setDwarfCompileUnitID(unsigned CUIndex)
Definition: MCContext.h:688
llvm::XCOFF::StorageMappingClass
StorageMappingClass
Storage Mapping Class definitions.
Definition: XCOFF.h:38
llvm::StringMap< MCSymbol *, BumpPtrAllocator & >
llvm::SmallString< 128 >
llvm::MCContext::getMCDwarfLineTables
const std::map< unsigned, MCDwarfLineTable > & getMCDwarfLineTables() const
Definition: MCContext.h:664
llvm::MCContext::setDiagnosticHandler
void setDiagnosticHandler(DiagHandlerTy DiagHandler)
Definition: MCContext.h:402
llvm::MCContext::RemapDebugPaths
void RemapDebugPaths()
Definition: MCContext.cpp:762
llvm::MCContext::getSecureLogFile
char * getSecureLogFile()
Definition: MCContext.h:772
llvm::MCContext::defineMacro
void defineMacro(StringRef Name, MCAsmMacro Macro)
Definition: MCContext.h:802
llvm::MCContext::setGenDwarfFileNumber
void setGenDwarfFileNumber(unsigned FileNumber)
Definition: MCContext.h:732
llvm::MCContext::deallocate
void deallocate(void *Ptr)
Definition: MCContext.h:786
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:128
llvm::StringMapIterator
Definition: StringMap.h:25
llvm::MCContext::isDwarfMD5UsageConsistent
bool isDwarfMD5UsageConsistent(unsigned CUID) const
Reports whether MD5 checksum usage is consistent (all-or-none).
Definition: MCContext.h:703
llvm::MCContext::getMCDwarfLineTable
MCDwarfLineTable & getMCDwarfLineTable(unsigned CUID)
Definition: MCContext.h:668
llvm::MCContext::getAsmInfo
const MCAsmInfo * getAsmInfo() const
Definition: MCContext.h:406
llvm::MCContext::getMCGenDwarfLabelEntries
const std::vector< MCGenDwarfLabelEntry > & getMCGenDwarfLabelEntries() const
Definition: MCContext.h:750
llvm::BumpPtrAllocatorImpl
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:67
llvm::MCSymbolWasm
Definition: MCSymbolWasm.h:16
llvm::MCContext::getSecureLogUsed
bool getSecureLogUsed()
Definition: MCContext.h:779
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::DenseMap
Definition: DenseMap.h:714
llvm::MCContext::getInlineSourceManager
SourceMgr * getInlineSourceManager()
Definition: MCContext.h:398
llvm::operator<
bool operator<(int64_t V1, const APSInt &V2)
Definition: APSInt.h:343
llvm::MCContext::getELFSection
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags, unsigned EntrySize)
Definition: MCContext.h:526
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::StringMap::lookup
ValueTy lookup(StringRef Key) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
Definition: StringMap.h:234
llvm::MCContext::createLinkerPrivateTempSymbol
MCSymbol * createLinkerPrivateTempSymbol()
Create and return a new linker temporary symbol with a unique but unspecified name.
Definition: MCContext.cpp:262
llvm::MCContext::setCurrentDwarfLoc
void setCurrentDwarfLoc(unsigned FileNum, unsigned Line, unsigned Column, unsigned Flags, unsigned Isa, unsigned Discriminator)
Saves the information from the currently parsed dwarf .loc directive and sets DwarfLocSeen.
Definition: MCContext.h:711
llvm::MCContext::getInlineAsmLabel
MCSymbol * getInlineAsmLabel(StringRef Name) const
isInlineAsmLabel - Return true if the name is a label referenced in inline assembly.
Definition: MCContext.h:487
llvm::HighlightColor::Macro
@ Macro
llvm::MCSection::NonUniqueID
static constexpr unsigned NonUniqueID
Definition: MCSection.h:41
llvm::MCContext::createELFGroupSection
MCSectionELF * createELFGroupSection(const MCSymbolELF *Group, bool IsComdat)
Definition: MCContext.cpp:543
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::MCSectionCOFF
This represents a section on Windows.
Definition: MCSectionCOFF.h:26
llvm::MCContext::reportError
void reportError(SMLoc L, const Twine &Msg)
Definition: MCContext.cpp:917
function
print Print MemDeps of function
Definition: MemDepPrinter.cpp:83
llvm::MCPseudoProbeTable
Definition: MCPseudoProbe.h:158
llvm::MCDwarfLineTable::getMCDwarfFiles
const SmallVectorImpl< MCDwarfFile > & getMCDwarfFiles() const
Definition: MCDwarf.h:368
llvm::MCContext::getOrCreateFrameAllocSymbol
MCSymbol * getOrCreateFrameAllocSymbol(StringRef FuncName, unsigned Idx)
Gets a symbol that will be defined to the final stack offset of a local variable after codegen.
Definition: MCContext.cpp:170
llvm::MCContext::getMCDwarfFiles
const SmallVectorImpl< MCDwarfFile > & getMCDwarfFiles(unsigned CUID=0)
Definition: MCContext.h:678
llvm::MCContext::recordELFMergeableSectionInfo
void recordELFMergeableSectionInfo(StringRef SectionName, unsigned Flags, unsigned UniqueID, unsigned EntrySize)
Definition: MCContext.cpp:550
llvm::SetVector::insert
bool insert(const value_type &X)
Insert a new element into the SetVector.
Definition: SetVector.h:141
llvm::Sched::Source
@ Source
Definition: TargetLowering.h:98
llvm::MCContext::initInlineSourceManager
void initInlineSourceManager()
Definition: MCContext.cpp:88
LLVM_ATTRIBUTE_NORETURN
#define LLVM_ATTRIBUTE_NORETURN
Definition: Compiler.h:250
llvm::MCDwarfLoc
Instances of this class represent the information from a dwarf .loc directive.
Definition: MCDwarf.h:76
llvm::ELF::SHF_STRINGS
@ SHF_STRINGS
Definition: ELF.h:990
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
Dwarf.h
llvm::MCContext::isValidDwarfFileNumber
bool isValidDwarfFileNumber(unsigned FileNumber, unsigned CUID=0)
isValidDwarfFileNumber - takes a dwarf file number and returns true if it currently is assigned and f...
Definition: MCContext.cpp:845
llvm::SourceMgr
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling.
Definition: SourceMgr.h:31
Compiler.h
llvm::MCContext::setMCLineTableRootFile
void setMCLineTableRootFile(unsigned CUID, StringRef CompilationDir, StringRef Filename, Optional< MD5::MD5Result > Checksum, Optional< StringRef > Source)
Specifies the "root" file and directory of the compilation unit.
Definition: MCContext.h:694
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::MCContext::getCOFFSection
MCSectionCOFF * getCOFFSection(StringRef Section, unsigned Characteristics, SectionKind Kind, StringRef COMDATSymName, int Selection, unsigned UniqueID=GenericSectionID, const char *BeginSymName=nullptr)
Definition: MCContext.cpp:584
llvm::MCRegisterInfo
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Definition: MCRegisterInfo.h:135
llvm::MCContext::createTempSymbol
MCSymbol * createTempSymbol()
Create a temporary symbol with a unique name.
Definition: MCContext.cpp:268
llvm::raw_fd_ostream
A raw_ostream that writes to a file descriptor.
Definition: raw_ostream.h:432
llvm::MCContext::clearDwarfLocSeen
void clearDwarfLocSeen()
Definition: MCContext.h:723
llvm::MCContext::getMCDwarfLineTable
const MCDwarfLineTable & getMCDwarfLineTable(unsigned CUID) const
Definition: MCContext.h:672
llvm::MCContext::operator=
MCContext & operator=(const MCContext &)=delete
MRI
unsigned const MachineRegisterInfo * MRI
Definition: AArch64AdvSIMDScalarPass.cpp:105
llvm::MCContext::getDirectionalLocalSymbol
MCSymbol * getDirectionalLocalSymbol(unsigned LocalLabelVal, bool Before)
Create and return a directional local symbol for numbered label (used for "1b" or 1f" references).
Definition: MCContext.cpp:301
llvm::MCContext::getGenDwarfSectionSyms
const SetVector< MCSection * > & getGenDwarfSectionSyms()
Definition: MCContext.h:740
llvm::MCAsmMacro
Definition: MCAsmMacro.h:142
MCAsmMacro.h
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:80
llvm::SectionKind
SectionKind - This is a simple POD value that classifies the properties of a section.
Definition: SectionKind.h:22
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
uint16_t
llvm::SectionName
Definition: DWARFSection.h:21
llvm::MCSectionMachO
This represents a section on a Mach-O system (used by Mac OS X).
Definition: MCSectionMachO.h:24
llvm::MCContext::renameELFSection
void renameELFSection(MCSectionELF *Section, StringRef Name)
Definition: MCContext.cpp:415
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
llvm::MCContext::addMCGenDwarfLabelEntry
void addMCGenDwarfLabelEntry(const MCGenDwarfLabelEntry &E)
Definition: MCContext.h:754
SectionKind.h
llvm::MCContext::getWasmSection
MCSectionWasm * getWasmSection(const Twine &Section, SectionKind K)
Definition: MCContext.h:598
Selection
amdgpu AMDGPU DAG DAG Pattern Instruction Selection
Definition: AMDGPUISelDAGToDAG.cpp:376
llvm::MCDwarfLineTable::isMD5UsageConsistent
bool isMD5UsageConsistent() const
Definition: MCDwarf.h:350
llvm::MCContext::setGenDwarfForAssembly
void setGenDwarfForAssembly(bool Value)
Definition: MCContext.h:729
llvm::MCDwarfLineTable::getMCDwarfDirs
const SmallVectorImpl< std::string > & getMCDwarfDirs() const
Definition: MCDwarf.h:360
llvm::MCContext::setCompilationDir
void setCompilationDir(StringRef S)
Set the compilation directory for DW_AT_comp_dir.
Definition: MCContext.h:640
SmallVector.h
Allocator
Basic Register Allocator
Definition: RegAllocBasic.cpp:146
llvm::MCContext::getMainFileName
const std::string & getMainFileName() const
Get the main file name for use in error messages and debug info.
Definition: MCContext.h:651
llvm::MCContext::getSourceManager
const SourceMgr * getSourceManager() const
Definition: MCContext.h:395
llvm::MCContext::getELFUniqueIDForEntsize
Optional< unsigned > getELFUniqueIDForEntsize(StringRef SectionName, unsigned Flags, unsigned EntrySize)
Definition: MCContext.cpp:576
Characteristics
COFFYAML::WeakExternalCharacteristics Characteristics
Definition: COFFYAML.cpp:325
llvm::MCContext::addDebugPrefixMapEntry
void addDebugPrefixMapEntry(const std::string &From, const std::string &To)
Add an entry to the debug prefix map.
Definition: MCContext.cpp:757
llvm::MCContext::getSubtargetCopy
MCSubtargetInfo & getSubtargetCopy(const MCSubtargetInfo &STI)
Definition: MCContext.cpp:753
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:43
llvm::MCContext::getDwarfLocSeen
bool getDwarfLocSeen()
Definition: MCContext.h:725
llvm::MCContext::setUseNamesOnTempLabels
void setUseNamesOnTempLabels(bool Value)
Definition: MCContext.h:415
llvm::MCContext::reset
void reset()
reset - return object to right after construction state to prepare to process a new module
Definition: MCContext.cpp:97
llvm::MCContext::getWasmSection
MCSectionWasm * getWasmSection(const Twine &Section, SectionKind K, const char *BeginSymName)
Definition: MCContext.h:602
llvm::MCContext::createELFRelSection
MCSectionELF * createELFRelSection(const Twine &Name, unsigned Type, unsigned Flags, unsigned EntrySize, const MCSymbolELF *Group, const MCSectionELF *RelInfoSection)
Definition: MCContext.cpp:469
llvm::MCContext::createDirectionalLocalSymbol
MCSymbol * createDirectionalLocalSymbol(unsigned LocalLabelVal)
Create the definition of a directional local symbol for numbered label (used for "1:" definitions).
Definition: MCContext.cpp:296
llvm::MCContext::hadError
bool hadError()
Definition: MCContext.h:788
From
BlockVerifier::State From
Definition: BlockVerifier.cpp:55
llvm::MCContext::getELFNamedSection
MCSectionELF * getELFNamedSection(const Twine &Prefix, const Twine &Suffix, unsigned Type, unsigned Flags, unsigned EntrySize=0)
Get a section with the provided group identifier.
Definition: MCContext.cpp:483
llvm::MCContext::~MCContext
~MCContext()
Definition: MCContext.cpp:80
raw_ostream.h
llvm::MCContext::setSecureLogUsed
void setSecureLogUsed(bool Value)
Definition: MCContext.h:780
llvm::SetVector
A vector that has set insertion semantics.
Definition: SetVector.h:40
llvm::MCContext::DiagHandlerTy
std::function< void(const SMDiagnostic &, bool, const SourceMgr &, std::vector< const MDNode * > &)> DiagHandlerTy
Definition: MCContext.h:76
true
basic Basic Alias true
Definition: BasicAliasAnalysis.cpp:1789
llvm::MCSubtargetInfo
Generic base class for all target subtargets.
Definition: MCSubtargetInfo.h:75
llvm::MCContext::setDwarfDebugProducer
void setDwarfDebugProducer(StringRef S)
Definition: MCContext.h:761
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
llvm::MCContext::setDwarfFormat
void setDwarfFormat(dwarf::DwarfFormat f)
Definition: MCContext.h:764
llvm::StringRef::compare
LLVM_NODISCARD int compare(StringRef RHS) const
compare - Compare two strings; the result is -1, 0, or 1 if this string is lexicographically less tha...
Definition: StringRef.h:204
llvm::MCObjectFileInfo
Definition: MCObjectFileInfo.h:26
llvm::MCContext::finalizeDwarfSections
void finalizeDwarfSections(MCStreamer &MCOS)
Remove empty sections from SectionsForRanges, to avoid generating useless debug info for them.
Definition: MCContext.cpp:857
llvm::ISD::MCSymbol
@ MCSymbol
Definition: ISDOpcodes.h:165
llvm::dwarf::DWARF32
@ DWARF32
Definition: Dwarf.h:92
SetVector.h
Other
Optional< std::vector< StOtherPiece > > Other
Definition: ELFYAML.cpp:1163
llvm::MCContext::reportWarning
void reportWarning(SMLoc L, const Twine &Msg)
Definition: MCContext.cpp:924
llvm::MCContext::getSecureLog
raw_fd_ostream * getSecureLog()
Definition: MCContext.h:773