LLVM 23.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/SetVector.h"
15#include "llvm/ADT/StringMap.h"
16#include "llvm/ADT/StringRef.h"
17#include "llvm/ADT/Twine.h"
20#include "llvm/MC/MCAsmMacro.h"
21#include "llvm/MC/MCDwarf.h"
24#include "llvm/MC/MCSection.h"
27#include "llvm/MC/SectionKind.h"
30#include "llvm/Support/Error.h"
31#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 <optional>
42#include <string>
43#include <utility>
44#include <vector>
45
46namespace llvm {
47
48class CodeViewContext;
49class MCAsmInfo;
50class MCInst;
51class MCLabel;
53class MCRegisterInfo;
54class MCSection;
55class MCSectionCOFF;
57class MCSectionELF;
58class MCSectionMachO;
59class MCSectionSPIRV;
60class MCSectionWasm;
61class MCSectionXCOFF;
62class MCStreamer;
63class MCSubtargetInfo;
64class MCSymbol;
65class MCSymbolELF;
66class MCSymbolWasm;
67class MCSymbolXCOFF;
68class MCTargetOptions;
69class MDNode;
70template <typename T> class SmallVectorImpl;
71class SMDiagnostic;
72class SMLoc;
73class SourceMgr;
74enum class EmitDwarfUnwindType;
75
76namespace wasm {
77struct WasmSignature;
78}
79
80/// Context object for machine code objects. This class owns all of the
81/// sections that it creates.
82///
83class MCContext {
84public:
87 std::function<void(const SMDiagnostic &, bool, const SourceMgr &,
88 std::vector<const MDNode *> &)>;
99
100private:
101 Environment Env;
102
103 /// The name of the Segment where Swift5 Reflection Section data will be
104 /// outputted
105 StringRef Swift5ReflectionSegmentName;
106
107 /// The triple for this object.
108 Triple TT;
109
110 /// The SourceMgr for this object, if any.
111 const SourceMgr *SrcMgr = nullptr;
112
113 /// The SourceMgr for inline assembly, if any.
114 std::unique_ptr<SourceMgr> InlineSrcMgr;
115 std::vector<const MDNode *> LocInfos;
116
118
119 /// The MCAsmInfo for this target.
120 const MCAsmInfo *MAI = nullptr;
121
122 /// The MCRegisterInfo for this target.
123 const MCRegisterInfo *MRI = nullptr;
124
125 /// The MCObjectFileInfo for this target.
126 const MCObjectFileInfo *MOFI = nullptr;
127
128 /// The MCSubtargetInfo for this target.
129 const MCSubtargetInfo *MSTI = nullptr;
130
131 std::unique_ptr<CodeViewContext> CVContext;
132
133 /// Allocator object used for creating machine code objects.
134 ///
135 /// We use a bump pointer allocator to avoid the need to track all allocated
136 /// objects.
138
139 /// For MCFragment instances.
140 BumpPtrAllocator FragmentAllocator;
141
150 SpecificBumpPtrAllocator<MCInst> MCInstAllocator;
151
153
154 /// Bindings of names to symbol table values.
155 SymbolTable Symbols;
156
157 /// A mapping from a local label number and an instance count to a symbol.
158 /// For example, in the assembly
159 /// 1:
160 /// 2:
161 /// 1:
162 /// We have three labels represented by the pairs (1, 0), (2, 0) and (1, 1)
164
165 /// Keeps track of labels that are used in inline assembly.
166 StringMap<MCSymbol *, BumpPtrAllocator &> InlineAsmUsedLabelNames;
167
168 /// Instances of directional local labels.
170 /// NextInstance() creates the next instance of the directional local label
171 /// for the LocalLabelVal and adds it to the map if needed.
172 unsigned NextInstance(unsigned LocalLabelVal);
173 /// GetInstance() gets the current instance of the directional local label
174 /// for the LocalLabelVal and adds it to the map if needed.
175 unsigned GetInstance(unsigned LocalLabelVal);
176
177 /// SHT_LLVM_BB_ADDR_MAP version to emit.
178 uint8_t BBAddrMapVersion = 5;
179
180 /// The file name of the log file from the environment variable
181 /// AS_SECURE_LOG_FILE. Which must be set before the .secure_log_unique
182 /// directive is used or it is an error.
183 std::string SecureLogFile;
184 /// The stream that gets written to for the .secure_log_unique directive.
185 std::unique_ptr<raw_fd_ostream> SecureLog;
186 /// Boolean toggled when .secure_log_unique / .secure_log_reset is seen to
187 /// catch errors if .secure_log_unique appears twice without
188 /// .secure_log_reset appearing between them.
189 bool SecureLogUsed = false;
190
191 /// The compilation directory to use for DW_AT_comp_dir.
192 SmallString<128> CompilationDir;
193
194 /// Prefix replacement map for source file information.
196
197 /// The main file name if passed in explicitly.
198 std::string MainFileName;
199
200 /// The dwarf file and directory tables from the dwarf .file directive.
201 /// We now emit a line table for each compile unit. To reduce the prologue
202 /// size of each line table, the files and directories used by each compile
203 /// unit are separated.
204 std::map<unsigned, MCDwarfLineTable> MCDwarfLineTablesCUMap;
205
206 /// The current dwarf line information from the last dwarf .loc directive.
207 MCDwarfLoc CurrentDwarfLoc;
208 bool DwarfLocSeen = false;
209
210 /// Generate dwarf debugging info for assembly source files.
211 bool GenDwarfForAssembly = false;
212
213 /// The current dwarf file number when generate dwarf debugging info for
214 /// assembly source files.
215 unsigned GenDwarfFileNumber = 0;
216
217 /// Sections for generating the .debug_ranges and .debug_aranges sections.
218 SetVector<MCSection *> SectionsForRanges;
219
220 /// The information gathered from labels that will have dwarf label
221 /// entries when generating dwarf assembly source files.
222 std::vector<MCGenDwarfLabelEntry> MCGenDwarfLabelEntries;
223
224 /// The string to embed in the debug information for the compile unit, if
225 /// non-empty.
226 StringRef DwarfDebugFlags;
227
228 /// The string to embed in as the dwarf AT_producer for the compile unit, if
229 /// non-empty.
230 StringRef DwarfDebugProducer;
231
232 /// The maximum version of dwarf that we should emit.
233 uint16_t DwarfVersion = 4;
234
235 /// The format of dwarf that we emit.
237
238 /// Honor temporary labels, this is useful for debugging semantic
239 /// differences between temporary and non-temporary labels (primarily on
240 /// Darwin).
241 bool SaveTempLabels = false;
242 bool UseNamesOnTempLabels = false;
243
244 /// The Compile Unit ID that we are currently processing.
245 unsigned DwarfCompileUnitID = 0;
246
247 /// A collection of MCPseudoProbe in the current module
248 MCPseudoProbeTable PseudoProbeTable;
249
250 struct COFFSectionKey {
251 std::string SectionName;
252 StringRef GroupName;
253 int SelectionKey;
254 unsigned UniqueID;
255
256 COFFSectionKey(StringRef SectionName, StringRef GroupName, int SelectionKey,
257 unsigned UniqueID)
258 : SectionName(SectionName), GroupName(GroupName),
259 SelectionKey(SelectionKey), UniqueID(UniqueID) {}
260
261 bool operator<(const COFFSectionKey &Other) const {
262 return std::tie(SectionName, GroupName, SelectionKey, UniqueID) <
263 std::tie(Other.SectionName, Other.GroupName, Other.SelectionKey,
264 Other.UniqueID);
265 }
266 };
267
268 struct WasmSectionKey {
269 std::string SectionName;
270 StringRef GroupName;
271 unsigned UniqueID;
272
273 WasmSectionKey(StringRef SectionName, StringRef GroupName,
274 unsigned UniqueID)
275 : SectionName(SectionName), GroupName(GroupName), UniqueID(UniqueID) {}
276
277 bool operator<(const WasmSectionKey &Other) const {
278 return std::tie(SectionName, GroupName, UniqueID) <
279 std::tie(Other.SectionName, Other.GroupName, Other.UniqueID);
280 }
281 };
282
283 struct XCOFFSectionKey {
284 // Section name.
285 std::string SectionName;
286 // Section property.
287 // For csect section, it is storage mapping class.
288 // For debug section, it is section type flags.
289 union {
290 XCOFF::StorageMappingClass MappingClass;
291 XCOFF::DwarfSectionSubtypeFlags DwarfSubtypeFlags;
292 };
293 bool IsCsect;
294
295 XCOFFSectionKey(StringRef SectionName,
296 XCOFF::StorageMappingClass MappingClass)
297 : SectionName(SectionName), MappingClass(MappingClass), IsCsect(true) {}
298
299 XCOFFSectionKey(StringRef SectionName,
300 XCOFF::DwarfSectionSubtypeFlags DwarfSubtypeFlags)
301 : SectionName(SectionName), DwarfSubtypeFlags(DwarfSubtypeFlags),
302 IsCsect(false) {}
303
304 bool operator<(const XCOFFSectionKey &Other) const {
305 if (IsCsect && Other.IsCsect)
306 return std::tie(SectionName, MappingClass) <
307 std::tie(Other.SectionName, Other.MappingClass);
308 if (IsCsect != Other.IsCsect)
309 return IsCsect;
310 return std::tie(SectionName, DwarfSubtypeFlags) <
311 std::tie(Other.SectionName, Other.DwarfSubtypeFlags);
312 }
313 };
314
315 StringMap<MCSectionMachO *> MachOUniquingMap;
316 std::map<COFFSectionKey, MCSectionCOFF *> COFFUniquingMap;
317 StringMap<MCSectionELF *> ELFUniquingMap;
318 std::map<std::string, MCSectionGOFF *> GOFFUniquingMap;
319 std::map<WasmSectionKey, MCSectionWasm *> WasmUniquingMap;
320 std::map<XCOFFSectionKey, MCSectionXCOFF *> XCOFFUniquingMap;
321 StringMap<MCSectionDXContainer *> DXCUniquingMap;
322 StringMap<bool> RelSecNames;
323
324 SpecificBumpPtrAllocator<MCSubtargetInfo> MCSubtargetAllocator;
325
326 /// Do automatic reset in destructor
327 bool AutoReset;
328
329 bool HadError = false;
330
331 void reportCommon(SMLoc Loc,
332 std::function<void(SMDiagnostic &, const SourceMgr *)>);
333
334 MCSymbolTableEntry &getSymbolTableEntry(StringRef Name);
335
336 MCSymbol *createSymbolImpl(const MCSymbolTableEntry *Name, bool IsTemporary);
337 MCSymbol *createRenamableSymbol(const Twine &Name, bool AlwaysAddSuffix,
338 bool IsTemporary);
339
340 MCSymbol *getOrCreateDirectionalLocalSymbol(unsigned LocalLabelVal,
341 unsigned Instance);
342
343 template <typename Symbol>
344 Symbol *getOrCreateSectionSymbol(StringRef Section);
345
346 MCSectionELF *createELFSectionImpl(StringRef Section, unsigned Type,
347 unsigned Flags, unsigned EntrySize,
348 const MCSymbolELF *Group, bool IsComdat,
349 unsigned UniqueID,
350 const MCSymbolELF *LinkedToSym);
351
352 MCSymbolXCOFF *createXCOFFSymbolImpl(const MCSymbolTableEntry *Name,
353 bool IsTemporary);
354
355 template <typename TAttr>
356 MCSectionGOFF *getGOFFSection(SectionKind Kind, StringRef Name,
357 TAttr SDAttributes, MCSection *Parent,
358 bool IsVirtual);
359
360 /// Map of currently defined macros.
361 StringMap<MCAsmMacro> MacroMap;
362
363 // Symbols must be assigned to a section with a compatible entry size and
364 // flags. This map is used to assign unique IDs to sections to distinguish
365 // between sections with identical names but incompatible entry sizes and/or
366 // flags. This can occur when a symbol is explicitly assigned to a section,
367 // e.g. via __attribute__((section("myname"))). The map key is the tuple
368 // (section name, flags, entry size).
369 DenseMap<std::tuple<StringRef, unsigned, unsigned>, unsigned> ELFEntrySizeMap;
370
371 // This set is used to record the generic mergeable section names seen.
372 // These are sections that are created as mergeable e.g. .debug_str. We need
373 // to avoid assigning non-mergeable symbols to these sections. It is used
374 // to prevent non-mergeable symbols being explicitly assigned to mergeable
375 // sections (e.g. via _attribute_((section("myname")))).
376 DenseSet<StringRef> ELFSeenGenericMergeableSections;
377
378public:
379 LLVM_ABI explicit MCContext(const Triple &TheTriple, const MCAsmInfo *MAI,
380 const MCRegisterInfo *MRI,
381 const MCSubtargetInfo *MSTI,
382 const SourceMgr *Mgr = nullptr,
383 MCTargetOptions const *TargetOpts = nullptr,
384 bool DoAutoReset = true,
385 StringRef Swift5ReflSegmentName = {});
386 MCContext(const MCContext &) = delete;
387 MCContext &operator=(const MCContext &) = delete;
389
390 Environment getObjectFileType() const { return Env; }
391 bool isELF() const { return Env == IsELF; }
392 bool isMachO() const { return Env == IsMachO; }
393 bool isXCOFF() const { return Env == IsXCOFF; }
394
396 return Swift5ReflectionSegmentName;
397 }
398 const Triple &getTargetTriple() const { return TT; }
399 const SourceMgr *getSourceManager() const { return SrcMgr; }
400
402 SourceMgr *getInlineSourceManager() { return InlineSrcMgr.get(); }
403 std::vector<const MDNode *> &getLocInfos() { return LocInfos; }
405 this->DiagHandler = DiagHandler;
406 }
407
408 void setObjectFileInfo(const MCObjectFileInfo *Mofi) { MOFI = Mofi; }
409
410 const MCAsmInfo *getAsmInfo() const { return MAI; }
411
412 const MCRegisterInfo *getRegisterInfo() const { return MRI; }
413
414 const MCObjectFileInfo *getObjectFileInfo() const { return MOFI; }
415
416 const MCSubtargetInfo *getSubtargetInfo() const { return MSTI; }
417
419
421
422 void setUseNamesOnTempLabels(bool Value) { UseNamesOnTempLabels = Value; }
423
424 /// \name Module Lifetime Management
425 /// @{
426
427 /// reset - return object to right after construction state to prepare
428 /// to process a new module
429 LLVM_ABI void reset();
430
431 /// @}
432
433 /// \name McInst Management
434
435 /// Create and return a new MC instruction.
437
438 /// \name Symbol Management
439 /// @{
440
441 /// Create a new linker temporary symbol with the specified prefix (Name) or
442 /// "tmp". This creates a "l"-prefixed symbol for Mach-O and is identical to
443 /// createNamedTempSymbol for other object file formats.
446
447 /// Create a temporary symbol with a unique name. The name will be omitted
448 /// in the symbol table if UseNamesOnTempLabels is false (default except
449 /// MCAsmStreamer). The overload without Name uses an unspecified name.
452 bool AlwaysAddSuffix = true);
453
454 /// Create a temporary symbol with a unique name whose name cannot be
455 /// omitted in the symbol table. This is rarely used.
458
459 /// Get or create a symbol for a basic block. For non-always-emit symbols,
460 /// this behaves like createTempSymbol, except that it uses the
461 /// PrivateLabelPrefix instead of the InternalSymbolPrefix. When AlwaysEmit is
462 /// true, behaves like getOrCreateSymbol, prefixed with PrivateLabelPrefix.
464 bool AlwaysEmit = false);
465
466 /// Create a local, non-temporary symbol like an ELF mapping symbol. Calling
467 /// the function with the same name will generate new, unique instances.
469
470 /// Create the definition of a directional local symbol for numbered label
471 /// (used for "1:" definitions).
472 LLVM_ABI MCSymbol *createDirectionalLocalSymbol(unsigned LocalLabelVal);
473
474 /// Create and return a directional local symbol for numbered label (used
475 /// for "1b" or 1f" references).
476 LLVM_ABI MCSymbol *getDirectionalLocalSymbol(unsigned LocalLabelVal,
477 bool Before);
478
479 /// Lookup the symbol inside with the specified \p Name. If it exists,
480 /// return it. If not, create a forward reference and return it.
481 ///
482 /// \param Name - The symbol name, which must be unique across all symbols.
484
485 /// Variant of getOrCreateSymbol that handles backslash-escaped symbols.
486 /// For example, parse "a\"b\\" as a"\.
487 LLVM_ABI MCSymbol *parseSymbol(const Twine &Name);
488
489 /// Gets a symbol that will be defined to the final stack offset of a local
490 /// variable after codegen.
491 ///
492 /// \param Idx - The index of a local variable passed to \@llvm.localescape.
494 unsigned Idx);
495
497
499
500 /// Get the symbol for \p Name, or null.
501 LLVM_ABI MCSymbol *lookupSymbol(const Twine &Name) const;
502
503 /// Clone a symbol for the .set directive, replacing it in the symbol table.
504 /// Existing references to the original symbol remain unchanged, and the
505 /// original symbol is not emitted to the symbol table.
507
508 /// Set value for a symbol.
509 LLVM_ABI void setSymbolValue(MCStreamer &Streamer, const Twine &Sym,
510 uint64_t Val);
511
512 /// getSymbols - Get a reference for the symbol table for clients that
513 /// want to, for example, iterate over all symbols. 'const' because we
514 /// still want any modifications to the table itself to use the MCContext
515 /// APIs.
516 const SymbolTable &getSymbols() const { return Symbols; }
517
518 /// isInlineAsmLabel - Return true if the name is a label referenced in
519 /// inline assembly.
521 return InlineAsmUsedLabelNames.lookup(Name);
522 }
523
524 /// registerInlineAsmLabel - Records that the name is a label referenced in
525 /// inline assembly.
527
528 /// Allocates and returns a new `WasmSignature` instance (with empty parameter
529 /// and return type lists).
531
532 /// @}
533
534 /// \name Section Management
535 /// @{
536
537 /// Return the MCSection for the specified mach-o section. This requires
538 /// the operands to be valid.
540 unsigned TypeAndAttributes,
541 unsigned Reserved2, SectionKind K,
542 const char *BeginSymName = nullptr);
543
545 unsigned TypeAndAttributes, SectionKind K,
546 const char *BeginSymName = nullptr) {
547 return getMachOSection(Segment, Section, TypeAndAttributes, 0, K,
548 BeginSymName);
549 }
550
551 MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
552 unsigned Flags) {
553 return getELFSection(Section, Type, Flags, 0, "", false);
554 }
555
556 MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
557 unsigned Flags, unsigned EntrySize) {
558 return getELFSection(Section, Type, Flags, EntrySize, "", false,
559 MCSection::NonUniqueID, nullptr);
560 }
561
562 MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
563 unsigned Flags, unsigned EntrySize,
564 const Twine &Group, bool IsComdat) {
565 return getELFSection(Section, Type, Flags, EntrySize, Group, IsComdat,
566 MCSection::NonUniqueID, nullptr);
567 }
568
569 LLVM_ABI MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
570 unsigned Flags, unsigned EntrySize,
571 const Twine &Group, bool IsComdat,
572 unsigned UniqueID,
573 const MCSymbolELF *LinkedToSym);
574
575 LLVM_ABI MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
576 unsigned Flags, unsigned EntrySize,
577 const MCSymbolELF *Group, bool IsComdat,
578 unsigned UniqueID,
579 const MCSymbolELF *LinkedToSym);
580
581 /// Get a section with the provided group identifier. This section is
582 /// named by concatenating \p Prefix with '.' then \p Suffix. The \p Type
583 /// describes the type of the section and \p Flags are used to further
584 /// configure this named section.
586 const Twine &Suffix, unsigned Type,
587 unsigned Flags,
588 unsigned EntrySize = 0);
589
591 createELFRelSection(const Twine &Name, unsigned Type, unsigned Flags,
592 unsigned EntrySize, const MCSymbolELF *Group,
593 const MCSectionELF *RelInfoSection);
594
596 bool IsComdat);
597
599 unsigned Flags, unsigned UniqueID,
600 unsigned EntrySize);
601
603
605
606 /// Return the unique ID of the section with the given name, flags and entry
607 /// size, if it exists.
608 LLVM_ABI std::optional<unsigned>
610 unsigned EntrySize);
611
612 LLVM_ABI MCSectionGOFF *getGOFFSection(SectionKind Kind, StringRef Name,
613 GOFF::SDAttr SDAttributes);
614 LLVM_ABI MCSectionGOFF *getGOFFSection(SectionKind Kind, StringRef Name,
615 GOFF::EDAttr EDAttributes,
616 MCSection *Parent);
617 LLVM_ABI MCSectionGOFF *getGOFFSection(SectionKind Kind, StringRef Name,
618 GOFF::PRAttr PRAttributes,
619 MCSection *Parent);
620
622 getCOFFSection(StringRef Section, unsigned Characteristics,
623 StringRef COMDATSymName, int Selection,
625
627 unsigned Characteristics);
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.
636
638
640 unsigned Flags = 0) {
641 return getWasmSection(Section, K, Flags, "", ~0);
642 }
643
645 unsigned Flags, const Twine &Group,
646 unsigned UniqueID);
647
649 unsigned Flags,
650 const MCSymbolWasm *Group,
651 unsigned UniqueID);
652
653 /// Get the section for the provided Section name
655 SectionKind K);
656
658 XCOFF::CsectProperties CsectProp) const;
659
661 StringRef Section, SectionKind K,
662 std::optional<XCOFF::CsectProperties> CsectProp = std::nullopt,
663 bool MultiSymbolsAllowed = false,
664 std::optional<XCOFF::DwarfSectionSubtypeFlags> DwarfSubtypeFlags =
665 std::nullopt);
666
667 // Create and save a copy of STI and return a reference to the copy.
669
670 uint8_t getBBAddrMapVersion() const { return BBAddrMapVersion; }
671
672 /// @}
673
674 /// \name Dwarf Management
675 /// @{
676
677 /// Get the compilation directory for DW_AT_comp_dir
678 /// The compilation directory should be set with \c setCompilationDir before
679 /// calling this function. If it is unset, an empty string will be returned.
680 StringRef getCompilationDir() const { return CompilationDir; }
681
682 /// Set the compilation directory for DW_AT_comp_dir
683 void setCompilationDir(StringRef S) { CompilationDir = S.str(); }
684
685 /// Add an entry to the debug prefix map.
686 LLVM_ABI void addDebugPrefixMapEntry(const std::string &From,
687 const std::string &To);
688
689 /// Remap one path in-place as per the debug prefix map.
691
692 // Remaps all debug directory paths in-place as per the debug prefix map.
694
695 /// Get the main file name for use in error messages and debug
696 /// info. This can be set to ensure we've got the correct file name
697 /// after preprocessing or for -save-temps.
698 const std::string &getMainFileName() const { return MainFileName; }
699
700 /// Set the main file name and override the default.
701 void setMainFileName(StringRef S) { MainFileName = std::string(S); }
702
703 /// Creates an entry in the dwarf file and directory tables.
705 getDwarfFile(StringRef Directory, StringRef FileName, unsigned FileNumber,
706 std::optional<MD5::MD5Result> Checksum,
707 std::optional<StringRef> Source, unsigned CUID);
708
709 LLVM_ABI bool isValidDwarfFileNumber(unsigned FileNumber, unsigned CUID = 0);
710
711 const std::map<unsigned, MCDwarfLineTable> &getMCDwarfLineTables() const {
712 return MCDwarfLineTablesCUMap;
713 }
714
716 return MCDwarfLineTablesCUMap[CUID];
717 }
718
719 const MCDwarfLineTable &getMCDwarfLineTable(unsigned CUID) const {
720 auto I = MCDwarfLineTablesCUMap.find(CUID);
721 assert(I != MCDwarfLineTablesCUMap.end());
722 return I->second;
723 }
724
727 }
728
730 return getMCDwarfLineTable(CUID).getMCDwarfDirs();
731 }
732
733 unsigned getDwarfCompileUnitID() { return DwarfCompileUnitID; }
734
735 void setDwarfCompileUnitID(unsigned CUIndex) { DwarfCompileUnitID = CUIndex; }
736
737 /// Specifies the "root" file and directory of the compilation unit.
738 /// These are "file 0" and "directory 0" in DWARF v5.
739 void setMCLineTableRootFile(unsigned CUID, StringRef CompilationDir,
741 std::optional<MD5::MD5Result> Checksum,
742 std::optional<StringRef> Source) {
743 getMCDwarfLineTable(CUID).setRootFile(CompilationDir, Filename, Checksum,
744 Source);
745 }
746
747 /// Reports whether MD5 checksum usage is consistent (all-or-none).
748 bool isDwarfMD5UsageConsistent(unsigned CUID) const {
750 }
751
752 /// Saves the information from the currently parsed dwarf .loc directive
753 /// and sets DwarfLocSeen. When the next instruction is assembled an entry
754 /// in the line number table with this information and the address of the
755 /// instruction will be created.
756 void setCurrentDwarfLoc(unsigned FileNum, unsigned Line, unsigned Column,
757 unsigned Flags, unsigned Isa,
758 unsigned Discriminator) {
759 CurrentDwarfLoc.setFileNum(FileNum);
760 CurrentDwarfLoc.setLine(Line);
761 CurrentDwarfLoc.setColumn(Column);
762 CurrentDwarfLoc.setFlags(Flags);
763 CurrentDwarfLoc.setIsa(Isa);
764 CurrentDwarfLoc.setDiscriminator(Discriminator);
765 DwarfLocSeen = true;
766 }
767
768 void clearDwarfLocSeen() { DwarfLocSeen = false; }
769
770 bool getDwarfLocSeen() { return DwarfLocSeen; }
771 const MCDwarfLoc &getCurrentDwarfLoc() { return CurrentDwarfLoc; }
772
773 bool getGenDwarfForAssembly() { return GenDwarfForAssembly; }
774 void setGenDwarfForAssembly(bool Value) { GenDwarfForAssembly = Value; }
775 unsigned getGenDwarfFileNumber() { return GenDwarfFileNumber; }
778
779 void setGenDwarfFileNumber(unsigned FileNumber) {
780 GenDwarfFileNumber = FileNumber;
781 }
782
783 /// Specifies information about the "root file" for assembler clients
784 /// (e.g., llvm-mc). Assumes compilation dir etc. have been set up.
785 LLVM_ABI void setGenDwarfRootFile(StringRef FileName, StringRef Buffer);
786
788 return SectionsForRanges;
789 }
790
792 return SectionsForRanges.insert(Sec);
793 }
794
796
797 const std::vector<MCGenDwarfLabelEntry> &getMCGenDwarfLabelEntries() const {
798 return MCGenDwarfLabelEntries;
799 }
800
802 MCGenDwarfLabelEntries.push_back(E);
803 }
804
805 void setDwarfDebugFlags(StringRef S) { DwarfDebugFlags = S; }
806 StringRef getDwarfDebugFlags() { return DwarfDebugFlags; }
807
808 void setDwarfDebugProducer(StringRef S) { DwarfDebugProducer = S; }
809 StringRef getDwarfDebugProducer() { return DwarfDebugProducer; }
810
811 void setDwarfFormat(dwarf::DwarfFormat f) { DwarfFormat = f; }
812 dwarf::DwarfFormat getDwarfFormat() const { return DwarfFormat; }
813
814 void setDwarfVersion(uint16_t v) { DwarfVersion = v; }
815 uint16_t getDwarfVersion() const { return DwarfVersion; }
816
817 /// @}
818
819 StringRef getSecureLogFile() { return SecureLogFile; }
820 raw_fd_ostream *getSecureLog() { return SecureLog.get(); }
821
822 void setSecureLog(std::unique_ptr<raw_fd_ostream> Value) {
823 SecureLog = std::move(Value);
824 }
825
826 bool getSecureLogUsed() { return SecureLogUsed; }
827 void setSecureLogUsed(bool Value) { SecureLogUsed = Value; }
828
829 void *allocate(unsigned Size, unsigned Align = 8) {
830 return Allocator.Allocate(Size, Align);
831 }
832
833 void deallocate(void *Ptr) {}
834
835 /// Allocates a copy of the given string on the allocator managed by this
836 /// context and returns the result.
838 return StringSaver(Allocator).save(s);
839 }
840
841 bool hadError() { return HadError; }
842 LLVM_ABI void diagnose(const SMDiagnostic &SMD);
843 LLVM_ABI void reportError(SMLoc L, const Twine &Msg);
844 LLVM_ABI void reportWarning(SMLoc L, const Twine &Msg);
845
847 StringMap<MCAsmMacro>::iterator I = MacroMap.find(Name);
848 return (I == MacroMap.end()) ? nullptr : &I->getValue();
849 }
850
852 MacroMap.insert(std::make_pair(Name, std::move(Macro)));
853 }
854
855 void undefineMacro(StringRef Name) { MacroMap.erase(Name); }
856
857 MCPseudoProbeTable &getMCPseudoProbeTable() { return PseudoProbeTable; }
858};
859
860} // end namespace llvm
861
862// operator new and delete aren't allowed inside namespaces.
863// The throw specifications are mandated by the standard.
864/// Placement new for using the MCContext's allocator.
865///
866/// This placement form of operator new uses the MCContext's allocator for
867/// obtaining memory. It is a non-throwing new, which means that it returns
868/// null on error. (If that is what the allocator does. The current does, so if
869/// this ever changes, this operator will have to be changed, too.)
870/// Usage looks like this (assuming there's an MCContext 'Context' in scope):
871/// \code
872/// // Default alignment (8)
873/// IntegerLiteral *Ex = new (Context) IntegerLiteral(arguments);
874/// // Specific alignment
875/// IntegerLiteral *Ex2 = new (Context, 4) IntegerLiteral(arguments);
876/// \endcode
877/// Please note that you cannot use delete on the pointer; it must be
878/// deallocated using an explicit destructor call followed by
879/// \c Context.Deallocate(Ptr).
880///
881/// \param Bytes The number of bytes to allocate. Calculated by the compiler.
882/// \param C The MCContext that provides the allocator.
883/// \param Alignment The alignment of the allocated memory (if the underlying
884/// allocator supports it).
885/// \return The allocated memory. Could be NULL.
886inline void *operator new(size_t Bytes, llvm::MCContext &C,
887 size_t Alignment = 8) noexcept {
888 return C.allocate(Bytes, Alignment);
889}
890/// Placement delete companion to the new above.
891///
892/// This operator is just a companion to the new above. There is no way of
893/// invoking it directly; see the new operator for more details. This operator
894/// is called implicitly by the compiler if a placement new expression using
895/// the MCContext throws in the object constructor.
896inline void operator delete(void *Ptr, llvm::MCContext &C, size_t) noexcept {
897 C.deallocate(Ptr);
898}
899
900/// This placement form of operator new[] uses the MCContext's allocator for
901/// obtaining memory. It is a non-throwing new[], which means that it returns
902/// null on error.
903/// Usage looks like this (assuming there's an MCContext 'Context' in scope):
904/// \code
905/// // Default alignment (8)
906/// char *data = new (Context) char[10];
907/// // Specific alignment
908/// char *data = new (Context, 4) char[10];
909/// \endcode
910/// Please note that you cannot use delete on the pointer; it must be
911/// deallocated using an explicit destructor call followed by
912/// \c Context.Deallocate(Ptr).
913///
914/// \param Bytes The number of bytes to allocate. Calculated by the compiler.
915/// \param C The MCContext that provides the allocator.
916/// \param Alignment The alignment of the allocated memory (if the underlying
917/// allocator supports it).
918/// \return The allocated memory. Could be NULL.
919inline void *operator new[](size_t Bytes, llvm::MCContext &C,
920 size_t Alignment = 8) noexcept {
921 return C.allocate(Bytes, Alignment);
922}
923
924/// Placement delete[] companion to the new[] above.
925///
926/// This operator is just a companion to the new[] above. There is no way of
927/// invoking it directly; see the new[] operator for more details. This operator
928/// is called implicitly by the compiler if a placement new[] expression using
929/// the MCContext throws in the object constructor.
930inline void operator delete[](void *Ptr, llvm::MCContext &C) noexcept {
931 C.deallocate(Ptr);
932}
933
934#endif // LLVM_MC_MCCONTEXT_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the StringMap class.
amdgpu AMDGPU DAG DAG Pattern Instruction Selection
Function Alias Analysis false
This file defines the BumpPtrAllocator interface.
basic Basic Alias true
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define LLVM_ABI
Definition Compiler.h:213
This file defines the DenseMap class.
This file contains constants used for implementing Dwarf debug support.
bool operator<(const DeltaInfo &LHS, int64_t Delta)
Definition LineTable.cpp:30
This file declares the MCSectionGOFF class, which contains all of the necessary machine code sections...
#define I(x, y, z)
Definition MD5.cpp:57
static constexpr StringLiteral Filename
Basic Register Allocator
This file implements a set that has insertion order iteration characteristics.
This file defines the SmallString class.
static void DiagHandler(const SMDiagnostic &Diag, void *Context)
Holds state from .cv_file and .cv_loc directives for later emission.
Definition MCCodeView.h:144
Tagged union holding either a T or a Error.
Definition Error.h:485
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition MCAsmInfo.h:64
Context object for machine code objects.
Definition MCContext.h:83
MCPseudoProbeTable & getMCPseudoProbeTable()
Definition MCContext.h:857
const MCObjectFileInfo * getObjectFileInfo() const
Definition MCContext.h:414
LLVM_ABI void remapDebugPath(SmallVectorImpl< char > &Path)
Remap one path in-place as per the debug prefix map.
LLVM_ABI MCSymbol * createBlockSymbol(const Twine &Name, bool AlwaysEmit=false)
Get or create a symbol for a basic block.
LLVM_ABI MCSubtargetInfo & getSubtargetCopy(const MCSubtargetInfo &STI)
LLVM_ABI 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.
void * allocate(unsigned Size, unsigned Align=8)
Definition MCContext.h:829
const SetVector< MCSection * > & getGenDwarfSectionSyms()
Definition MCContext.h:787
void deallocate(void *Ptr)
Definition MCContext.h:833
const SmallVectorImpl< std::string > & getMCDwarfDirs(unsigned CUID=0)
Definition MCContext.h:729
Environment getObjectFileType() const
Definition MCContext.h:390
bool isDwarfMD5UsageConsistent(unsigned CUID) const
Reports whether MD5 checksum usage is consistent (all-or-none).
Definition MCContext.h:748
void setObjectFileInfo(const MCObjectFileInfo *Mofi)
Definition MCContext.h:408
LLVM_ABI const MCTargetOptions * getTargetOptions() const
StringRef getDwarfDebugProducer()
Definition MCContext.h:809
LLVM_ABI void setSymbolValue(MCStreamer &Streamer, const Twine &Sym, uint64_t Val)
Set value for a symbol.
bool isMachO() const
Definition MCContext.h:392
const std::string & getMainFileName() const
Get the main file name for use in error messages and debug info.
Definition MCContext.h:698
LLVM_ABI MCSectionCOFF * getCOFFSection(StringRef Section, unsigned Characteristics, StringRef COMDATSymName, int Selection, unsigned UniqueID=MCSection::NonUniqueID)
StringRef getDwarfDebugFlags()
Definition MCContext.h:806
bool getDwarfLocSeen()
Definition MCContext.h:770
LLVM_ABI void addDebugPrefixMapEntry(const std::string &From, const std::string &To)
Add an entry to the debug prefix map.
MCContext(const MCContext &)=delete
LLVM_ABI MCSymbol * createTempSymbol()
Create a temporary symbol with a unique name.
StringRef getCompilationDir() const
Get the compilation directory for DW_AT_comp_dir The compilation directory should be set with setComp...
Definition MCContext.h:680
bool getGenDwarfForAssembly()
Definition MCContext.h:773
LLVM_ABI void RemapDebugPaths()
LLVM_ABI MCInst * createMCInst()
Create and return a new MC instruction.
LLVM_ABI MCSymbol * getOrCreateFrameAllocSymbol(const Twine &FuncName, unsigned Idx)
Gets a symbol that will be defined to the final stack offset of a local variable after codegen.
LLVM_ABI MCSectionELF * createELFRelSection(const Twine &Name, unsigned Type, unsigned Flags, unsigned EntrySize, const MCSymbolELF *Group, const MCSectionELF *RelInfoSection)
void setSecureLogUsed(bool Value)
Definition MCContext.h:827
void defineMacro(StringRef Name, MCAsmMacro Macro)
Definition MCContext.h:851
LLVM_ABI MCSymbol * createLinkerPrivateTempSymbol()
Create a new linker temporary symbol with the specified prefix (Name) or "tmp".
MCSectionWasm * getWasmSection(const Twine &Section, SectionKind K, unsigned Flags=0)
Definition MCContext.h:639
LLVM_ABI void recordELFMergeableSectionInfo(StringRef SectionName, unsigned Flags, unsigned UniqueID, unsigned EntrySize)
MCSymbol * getInlineAsmLabel(StringRef Name) const
isInlineAsmLabel - Return true if the name is a label referenced in inline assembly.
Definition MCContext.h:520
LLVM_ABI Expected< unsigned > getDwarfFile(StringRef Directory, StringRef FileName, unsigned FileNumber, std::optional< MD5::MD5Result > Checksum, std::optional< StringRef > Source, unsigned CUID)
Creates an entry in the dwarf file and directory tables.
bool isXCOFF() const
Definition MCContext.h:393
LLVM_ABI wasm::WasmSignature * createWasmSignature()
Allocates and returns a new WasmSignature instance (with empty parameter and return type lists).
LLVM_ABI MCSectionELF * getELFNamedSection(const Twine &Prefix, const Twine &Suffix, unsigned Type, unsigned Flags, unsigned EntrySize=0)
Get a section with the provided group identifier.
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags, unsigned EntrySize, const Twine &Group, bool IsComdat)
Definition MCContext.h:562
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags, unsigned EntrySize)
Definition MCContext.h:556
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)
Definition MCContext.h:551
LLVM_ABI MCSectionXCOFF * getXCOFFSection(StringRef Section, SectionKind K, std::optional< XCOFF::CsectProperties > CsectProp=std::nullopt, bool MultiSymbolsAllowed=false, std::optional< XCOFF::DwarfSectionSubtypeFlags > DwarfSubtypeFlags=std::nullopt)
void setGenDwarfForAssembly(bool Value)
Definition MCContext.h:774
uint8_t getBBAddrMapVersion() const
Definition MCContext.h:670
LLVM_ABI void diagnose(const SMDiagnostic &SMD)
LLVM_ABI bool isValidDwarfFileNumber(unsigned FileNumber, unsigned CUID=0)
isValidDwarfFileNumber - takes a dwarf file number and returns true if it currently is assigned and f...
void setDwarfVersion(uint16_t v)
Definition MCContext.h:814
void clearDwarfLocSeen()
Definition MCContext.h:768
const StringRef & getSwift5ReflectionSegmentName() const
Definition MCContext.h:395
LLVM_ABI void registerInlineAsmLabel(MCSymbol *Sym)
registerInlineAsmLabel - Records that the name is a label referenced in inline assembly.
LLVM_ABI MCSymbol * createLocalSymbol(StringRef Name)
Create a local, non-temporary symbol like an ELF mapping symbol.
bool addGenDwarfSection(MCSection *Sec)
Definition MCContext.h:791
StringRef allocateString(StringRef s)
Allocates a copy of the given string on the allocator managed by this context and returns the result.
Definition MCContext.h:837
MCAsmMacro * lookupMacro(StringRef Name)
Definition MCContext.h:846
MCDwarfLineTable & getMCDwarfLineTable(unsigned CUID)
Definition MCContext.h:715
bool getSecureLogUsed()
Definition MCContext.h:826
raw_fd_ostream * getSecureLog()
Definition MCContext.h:820
LLVM_ABI void initInlineSourceManager()
void setDiagnosticHandler(DiagHandlerTy DiagHandler)
Definition MCContext.h:404
unsigned getDwarfCompileUnitID()
Definition MCContext.h:733
LLVM_ABI MCSymbol * getOrCreateParentFrameOffsetSymbol(const Twine &FuncName)
LLVM_ABI MCSymbol * lookupSymbol(const Twine &Name) const
Get the symbol for Name, or null.
LLVM_ABI bool emitCompactUnwindNonCanonical() const
LLVM_ABI ~MCContext()
void undefineMacro(StringRef Name)
Definition MCContext.h:855
LLVM_ABI CodeViewContext & getCVContext()
const MCRegisterInfo * getRegisterInfo() const
Definition MCContext.h:412
const SmallVectorImpl< MCDwarfFile > & getMCDwarfFiles(unsigned CUID=0)
Definition MCContext.h:725
LLVM_ABI void reset()
reset - return object to right after construction state to prepare to process a new module
void setDwarfFormat(dwarf::DwarfFormat f)
Definition MCContext.h:811
void setCompilationDir(StringRef S)
Set the compilation directory for DW_AT_comp_dir.
Definition MCContext.h:683
const std::map< unsigned, MCDwarfLineTable > & getMCDwarfLineTables() const
Definition MCContext.h:711
LLVM_ABI bool isELFGenericMergeableSection(StringRef Name)
unsigned getGenDwarfFileNumber()
Definition MCContext.h:775
void setDwarfDebugFlags(StringRef S)
Definition MCContext.h:805
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:756
LLVM_ABI 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:65
void setDwarfDebugProducer(StringRef S)
Definition MCContext.h:808
LLVM_ABI std::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.
LLVM_ABI MCSymbol * createDirectionalLocalSymbol(unsigned LocalLabelVal)
Create the definition of a directional local symbol for numbered label (used for "1:" definitions).
LLVM_ABI void reportWarning(SMLoc L, const Twine &Msg)
uint16_t getDwarfVersion() const
Definition MCContext.h:815
std::function< void(const SMDiagnostic &, bool, const SourceMgr &, std::vector< const MDNode * > &)> DiagHandlerTy
Definition MCContext.h:86
const SourceMgr * getSourceManager() const
Definition MCContext.h:399
const SymbolTable & getSymbols() const
getSymbols - Get a reference for the symbol table for clients that want to, for example,...
Definition MCContext.h:516
const MCAsmInfo * getAsmInfo() const
Definition MCContext.h:410
StringMap< MCSymbolTableValue, BumpPtrAllocator & > SymbolTable
Definition MCContext.h:85
LLVM_ABI void finalizeDwarfSections(MCStreamer &MCOS)
Remove empty sections from SectionsForRanges, to avoid generating useless debug info for them.
void setSecureLog(std::unique_ptr< raw_fd_ostream > Value)
Definition MCContext.h:822
LLVM_ABI void reportError(SMLoc L, const Twine &Msg)
void addMCGenDwarfLabelEntry(const MCGenDwarfLabelEntry &E)
Definition MCContext.h:801
LLVM_ABI MCSymbol * getOrCreateLSDASymbol(const Twine &FuncName)
LLVM_ABI MCSectionDXContainer * getDXContainerSection(StringRef Section, SectionKind K)
Get the section for the provided Section name.
MCContext & operator=(const MCContext &)=delete
LLVM_ABI bool hasXCOFFSection(StringRef Section, XCOFF::CsectProperties CsectProp) const
void setMainFileName(StringRef S)
Set the main file name and override the default.
Definition MCContext.h:701
LLVM_ABI MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
SourceMgr * getInlineSourceManager()
Definition MCContext.h:402
LLVM_ABI MCSymbol * createLinkerPrivateSymbol(const Twine &Name)
bool isELF() const
Definition MCContext.h:391
void setGenDwarfFileNumber(unsigned FileNumber)
Definition MCContext.h:779
LLVM_ABI MCSectionSPIRV * getSPIRVSection()
LLVM_ABI MCSectionCOFF * getAssociativeCOFFSection(MCSectionCOFF *Sec, const MCSymbol *KeySym, unsigned UniqueID=MCSection::NonUniqueID)
Gets or creates a section equivalent to Sec that is associated with the section containing KeySym.
LLVM_ABI MCSymbol * cloneSymbol(MCSymbol &Sym)
Clone a symbol for the .set directive, replacing it in the symbol table.
void setDwarfCompileUnitID(unsigned CUIndex)
Definition MCContext.h:735
const MCDwarfLineTable & getMCDwarfLineTable(unsigned CUID) const
Definition MCContext.h:719
LLVM_ABI MCSymbol * parseSymbol(const Twine &Name)
Variant of getOrCreateSymbol that handles backslash-escaped symbols.
LLVM_ABI EmitDwarfUnwindType emitDwarfUnwindInfo() const
LLVM_ABI bool isELFImplicitMergeableSectionNamePrefix(StringRef Name)
LLVM_ABI MCSectionELF * createELFGroupSection(const MCSymbolELF *Group, bool IsComdat)
void setUseNamesOnTempLabels(bool Value)
Definition MCContext.h:422
const MCDwarfLoc & getCurrentDwarfLoc()
Definition MCContext.h:771
LLVM_ABI void setGenDwarfRootFile(StringRef FileName, StringRef Buffer)
Specifies information about the "root file" for assembler clients (e.g., llvm-mc).
dwarf::DwarfFormat getDwarfFormat() const
Definition MCContext.h:812
const std::vector< MCGenDwarfLabelEntry > & getMCGenDwarfLabelEntries() const
Definition MCContext.h:797
StringRef getSecureLogFile()
Definition MCContext.h:819
MCSectionMachO * getMachOSection(StringRef Segment, StringRef Section, unsigned TypeAndAttributes, SectionKind K, const char *BeginSymName=nullptr)
Definition MCContext.h:544
std::vector< const MDNode * > & getLocInfos()
Definition MCContext.h:403
void setMCLineTableRootFile(unsigned CUID, StringRef CompilationDir, StringRef Filename, std::optional< MD5::MD5Result > Checksum, std::optional< StringRef > Source)
Specifies the "root" file and directory of the compilation unit.
Definition MCContext.h:739
LLVM_ABI MCSymbol * getDirectionalLocalSymbol(unsigned LocalLabelVal, bool Before)
Create and return a directional local symbol for numbered label (used for "1b" or 1f" references).
const MCSubtargetInfo * getSubtargetInfo() const
Definition MCContext.h:416
LLVM_ABI MCSymbol * createNamedTempSymbol()
Create a temporary symbol with a unique name whose name cannot be omitted in the symbol table.
const Triple & getTargetTriple() const
Definition MCContext.h:398
bool isMD5UsageConsistent() const
Definition MCDwarf.h:425
const SmallVectorImpl< std::string > & getMCDwarfDirs() const
Definition MCDwarf.h:435
void setRootFile(StringRef Directory, StringRef FileName, std::optional< MD5::MD5Result > Checksum, std::optional< StringRef > Source)
Definition MCDwarf.h:405
const SmallVectorImpl< MCDwarfFile > & getMCDwarfFiles() const
Definition MCDwarf.h:443
Instances of this class represent the information from a dwarf .loc directive.
Definition MCDwarf.h:107
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:188
Instances of this class represent a label name in the MC file, and MCLabel are created and uniqued by...
Definition MCLabel.h:23
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
This represents a section on Windows.
This represents a section on linux, lots of unix variants and some bare metal systems.
This represents a section on a Mach-O system (used by Mac OS X).
This represents a section on wasm.
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition MCSection.h:516
static constexpr unsigned NonUniqueID
Definition MCSection.h:521
Streaming machine code generation interface.
Definition MCStreamer.h:222
Generic base class for all target subtargets.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition MCSymbol.h:42
Metadata node.
Definition Metadata.h:1080
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...
Definition SourceMgr.h:297
Represents a location in source code.
Definition SMLoc.h:22
SectionKind - This is a simple POD value that classifies the properties of a section.
Definition SectionKind.h:22
A vector that has set insertion semantics.
Definition SetVector.h:57
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition SmallString.h:26
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling.
Definition SourceMgr.h:37
A BumpPtrAllocator that allows only elements of a specific type to be allocated.
Definition Allocator.h:390
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition StringMap.h:133
StringMapIterBase< ValueTy, false > iterator
Definition StringMap.h:221
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
std::string str() const
str - Get the contents as an std::string.
Definition StringRef.h:222
Saves strings in the provided stable storage and returns a StringRef with a stable character pointer.
Definition StringSaver.h:22
StringRef save(const char *S)
Definition StringSaver.h:31
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:47
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition Twine.h:82
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:46
LLVM Value Representation.
Definition Value.h:75
A raw_ostream that writes to a file descriptor.
DwarfSectionSubtypeFlags
Values for defining the section subtype of sections of type STYP_DWARF as they would appear in the (s...
Definition XCOFF.h:155
StorageMappingClass
Storage Mapping Class definitions.
Definition XCOFF.h:104
DwarfFormat
Constants that define the DWARF format as 32 or 64 bit.
Definition Dwarf.h:93
@ DWARF32
Definition Dwarf.h:93
This is an optimization pass for GlobalISel generic memory operations.
SourceMgr SrcMgr
Definition Error.cpp:24
EmitDwarfUnwindType
@ Other
Any other memory.
Definition ModRef.h:68
StringMapEntry< MCSymbolTableValue > MCSymbolTableEntry
MCContext stores MCSymbolTableValue in a string map (see MCSymbol::operator new).
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
Definition Allocator.h:383
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39