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