diff --git a/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h b/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h --- a/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h +++ b/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h @@ -16,6 +16,7 @@ #include "llvm/ADT/SmallPtrSet.h" #include "llvm/BinaryFormat/XCOFF.h" +#include "llvm/MC/MCExpr.h" #include "llvm/Target/TargetLoweringObjectFile.h" namespace llvm { diff --git a/llvm/include/llvm/MC/MCAsmBackend.h b/llvm/include/llvm/MC/MCAsmBackend.h --- a/llvm/include/llvm/MC/MCAsmBackend.h +++ b/llvm/include/llvm/MC/MCAsmBackend.h @@ -13,12 +13,17 @@ #include "llvm/ADT/Optional.h" #include "llvm/MC/MCDirectives.h" #include "llvm/MC/MCFixup.h" -#include "llvm/MC/MCFragment.h" #include "llvm/Support/Endian.h" #include namespace llvm { +class MCAlignFragment; +class MCDwarfCallFrameFragment; +class MCDwarfLineAddrFragment; +class MCFragment; +class MCRelaxableFragment; +class MCSymbol; class MCAsmLayout; class MCAssembler; class MCCFIInstruction; @@ -31,6 +36,7 @@ class MCValue; class raw_pwrite_stream; class StringRef; +class raw_ostream; /// Generic interface to target specific assembler backends. class MCAsmBackend { diff --git a/llvm/include/llvm/MC/MCAssembler.h b/llvm/include/llvm/MC/MCAssembler.h --- a/llvm/include/llvm/MC/MCAssembler.h +++ b/llvm/include/llvm/MC/MCAssembler.h @@ -10,7 +10,6 @@ #define LLVM_MC_MCASSEMBLER_H #include "llvm/ADT/ArrayRef.h" -#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/iterator.h" @@ -18,20 +17,34 @@ #include "llvm/BinaryFormat/MachO.h" #include "llvm/MC/MCDirectives.h" #include "llvm/MC/MCDwarf.h" -#include "llvm/MC/MCFixup.h" -#include "llvm/MC/MCFragment.h" #include "llvm/MC/MCLinkerOptimizationHint.h" #include "llvm/MC/MCSymbol.h" +#include "llvm/Support/SMLoc.h" #include "llvm/Support/VersionTuple.h" +#include #include #include #include +#include #include +#include #include #include namespace llvm { +class MCBoundaryAlignFragment; +class MCCVDefRangeFragment; +class MCCVInlineLineTableFragment; +class MCDwarfCallFrameFragment; +class MCDwarfLineAddrFragment; +class MCEncodedFragment; +class MCFixup; +class MCLEBFragment; +class MCPseudoProbeAddrFragment; +class MCRelaxableFragment; +class MCSymbolRefExpr; +class raw_ostream; class MCAsmBackend; class MCAsmLayout; class MCContext; diff --git a/llvm/include/llvm/MC/MCCodeView.h b/llvm/include/llvm/MC/MCCodeView.h --- a/llvm/include/llvm/MC/MCCodeView.h +++ b/llvm/include/llvm/MC/MCCodeView.h @@ -13,18 +13,25 @@ #ifndef LLVM_MC_MCCODEVIEW_H #define LLVM_MC_MCCODEVIEW_H +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" -#include "llvm/MC/MCFragment.h" -#include "llvm/MC/MCObjectStreamer.h" #include #include namespace llvm { +class MCAsmLayout; +class MCCVDefRangeFragment; +class MCCVInlineLineTableFragment; +class MCDataFragment; +class MCFragment; +class MCSection; +class MCSymbol; class MCContext; class MCObjectStreamer; class MCStreamer; -class CodeViewContext; /// Instances of this class represent the information from a /// .cv_loc directive. diff --git a/llvm/include/llvm/MC/MCContext.h b/llvm/include/llvm/MC/MCContext.h --- a/llvm/include/llvm/MC/MCContext.h +++ b/llvm/include/llvm/MC/MCContext.h @@ -13,18 +13,15 @@ #include "llvm/ADT/Optional.h" #include "llvm/ADT/SetVector.h" #include "llvm/ADT/SmallString.h" -#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/Twine.h" #include "llvm/BinaryFormat/Dwarf.h" -#include "llvm/BinaryFormat/ELF.h" #include "llvm/BinaryFormat/XCOFF.h" #include "llvm/MC/MCAsmMacro.h" #include "llvm/MC/MCDwarf.h" #include "llvm/MC/MCPseudoProbe.h" -#include "llvm/MC/MCSubtargetInfo.h" -#include "llvm/MC/MCTargetOptions.h" +#include "llvm/MC/MCSection.h" #include "llvm/MC/SectionKind.h" #include "llvm/Support/Allocator.h" #include "llvm/Support/Compiler.h" @@ -43,802 +40,798 @@ #include namespace llvm { +class MCInst; +class MCSubtargetInfo; +class MCTargetOptions; +template class SmallVectorImpl; + +class CodeViewContext; +class MCAsmInfo; +class MCLabel; +class MCObjectFileInfo; +class MCRegisterInfo; +class MCSectionCOFF; +class MCSectionELF; +class MCSectionGOFF; +class MCSectionMachO; +class MCSectionWasm; +class MCSectionXCOFF; +class MCStreamer; +class MCSymbol; +class MCSymbolELF; +class MCSymbolWasm; +class MCSymbolXCOFF; +class MDNode; +class SMDiagnostic; +class SMLoc; +class SourceMgr; + +/// Context object for machine code objects. This class owns all of the +/// sections that it creates. +/// +class MCContext { +public: + using SymbolTable = StringMap; + using DiagHandlerTy = + std::function &)>; + enum Environment { IsMachO, IsELF, IsGOFF, IsCOFF, IsWasm, IsXCOFF }; - class CodeViewContext; - class MCAsmInfo; - class MCLabel; - class MCObjectFileInfo; - class MCRegisterInfo; - class MCSection; - class MCSectionCOFF; - class MCSectionELF; - class MCSectionGOFF; - class MCSectionMachO; - class MCSectionWasm; - class MCSectionXCOFF; - class MCStreamer; - class MCSymbol; - class MCSymbolELF; - class MCSymbolWasm; - class MCSymbolXCOFF; - class MDNode; - class SMDiagnostic; - class SMLoc; - class SourceMgr; - - /// Context object for machine code objects. This class owns all of the - /// sections that it creates. - /// - class MCContext { - public: - using SymbolTable = StringMap; - using DiagHandlerTy = - std::function &)>; - enum Environment { IsMachO, IsELF, IsGOFF, IsCOFF, IsWasm, IsXCOFF }; - - private: - Environment Env; - - /// The name of the Segment where Swift5 Reflection Section data will be - /// outputted - StringRef Swift5ReflectionSegmentName; - - /// The triple for this object. - Triple TT; - - /// The SourceMgr for this object, if any. - const SourceMgr *SrcMgr; - - /// The SourceMgr for inline assembly, if any. - std::unique_ptr InlineSrcMgr; - std::vector LocInfos; - - DiagHandlerTy DiagHandler; - - /// The MCAsmInfo for this target. - const MCAsmInfo *MAI; - - /// The MCRegisterInfo for this target. - const MCRegisterInfo *MRI; - - /// The MCObjectFileInfo for this target. - const MCObjectFileInfo *MOFI; - - /// The MCSubtargetInfo for this target. - const MCSubtargetInfo *MSTI; - - std::unique_ptr CVContext; - - /// Allocator object used for creating machine code objects. - /// - /// We use a bump pointer allocator to avoid the need to track all allocated - /// objects. - BumpPtrAllocator Allocator; - - SpecificBumpPtrAllocator COFFAllocator; - SpecificBumpPtrAllocator ELFAllocator; - SpecificBumpPtrAllocator MachOAllocator; - SpecificBumpPtrAllocator GOFFAllocator; - SpecificBumpPtrAllocator WasmAllocator; - SpecificBumpPtrAllocator XCOFFAllocator; - SpecificBumpPtrAllocator MCInstAllocator; - - /// Bindings of names to symbols. - SymbolTable Symbols; - - /// A mapping from a local label number and an instance count to a symbol. - /// For example, in the assembly - /// 1: - /// 2: - /// 1: - /// We have three labels represented by the pairs (1, 0), (2, 0) and (1, 1) - DenseMap, MCSymbol *> LocalSymbols; - - /// Keeps tracks of names that were used both for used declared and - /// artificial symbols. The value is "true" if the name has been used for a - /// non-section symbol (there can be at most one of those, plus an unlimited - /// number of section symbols with the same name). - StringMap UsedNames; - - /// Keeps track of labels that are used in inline assembly. - SymbolTable InlineAsmUsedLabelNames; - - /// The next ID to dole out to an unnamed assembler temporary symbol with - /// a given prefix. - StringMap NextID; - - /// Instances of directional local labels. - DenseMap Instances; - /// NextInstance() creates the next instance of the directional local label - /// for the LocalLabelVal and adds it to the map if needed. - unsigned NextInstance(unsigned LocalLabelVal); - /// GetInstance() gets the current instance of the directional local label - /// for the LocalLabelVal and adds it to the map if needed. - unsigned GetInstance(unsigned LocalLabelVal); - - /// The file name of the log file from the environment variable - /// AS_SECURE_LOG_FILE. Which must be set before the .secure_log_unique - /// directive is used or it is an error. - char *SecureLogFile; - /// The stream that gets written to for the .secure_log_unique directive. - std::unique_ptr SecureLog; - /// Boolean toggled when .secure_log_unique / .secure_log_reset is seen to - /// catch errors if .secure_log_unique appears twice without - /// .secure_log_reset appearing between them. - bool SecureLogUsed = false; - - /// The compilation directory to use for DW_AT_comp_dir. - SmallString<128> CompilationDir; - - /// Prefix replacement map for source file information. - std::map DebugPrefixMap; - - /// The main file name if passed in explicitly. - std::string MainFileName; - - /// The dwarf file and directory tables from the dwarf .file directive. - /// We now emit a line table for each compile unit. To reduce the prologue - /// size of each line table, the files and directories used by each compile - /// unit are separated. - std::map MCDwarfLineTablesCUMap; - - /// The current dwarf line information from the last dwarf .loc directive. - MCDwarfLoc CurrentDwarfLoc; - bool DwarfLocSeen = false; - - /// Generate dwarf debugging info for assembly source files. - bool GenDwarfForAssembly = false; - - /// The current dwarf file number when generate dwarf debugging info for - /// assembly source files. - unsigned GenDwarfFileNumber = 0; - - /// Sections for generating the .debug_ranges and .debug_aranges sections. - SetVector SectionsForRanges; - - /// The information gathered from labels that will have dwarf label - /// entries when generating dwarf assembly source files. - std::vector MCGenDwarfLabelEntries; - - /// The string to embed in the debug information for the compile unit, if - /// non-empty. - StringRef DwarfDebugFlags; - - /// The string to embed in as the dwarf AT_producer for the compile unit, if - /// non-empty. - StringRef DwarfDebugProducer; - - /// The maximum version of dwarf that we should emit. - uint16_t DwarfVersion = 4; - - /// The format of dwarf that we emit. - dwarf::DwarfFormat DwarfFormat = dwarf::DWARF32; - - /// Honor temporary labels, this is useful for debugging semantic - /// differences between temporary and non-temporary labels (primarily on - /// Darwin). - bool AllowTemporaryLabels = true; - bool UseNamesOnTempLabels = false; - - /// The Compile Unit ID that we are currently processing. - unsigned DwarfCompileUnitID = 0; - - /// A collection of MCPseudoProbe in the current module - MCPseudoProbeTable PseudoProbeTable; - - // Sections are differentiated by the quadruple (section_name, group_name, - // unique_id, link_to_symbol_name). Sections sharing the same quadruple are - // combined into one section. - struct ELFSectionKey { - std::string SectionName; - StringRef GroupName; - StringRef LinkedToName; - unsigned UniqueID; - - ELFSectionKey(StringRef SectionName, StringRef GroupName, - StringRef LinkedToName, unsigned UniqueID) - : SectionName(SectionName), GroupName(GroupName), - LinkedToName(LinkedToName), UniqueID(UniqueID) {} - - bool operator<(const ELFSectionKey &Other) const { - if (SectionName != Other.SectionName) - return SectionName < Other.SectionName; - if (GroupName != Other.GroupName) - return GroupName < Other.GroupName; - if (int O = LinkedToName.compare(Other.LinkedToName)) - return O < 0; - return UniqueID < Other.UniqueID; - } - }; - - struct COFFSectionKey { - std::string SectionName; - StringRef GroupName; - int SelectionKey; - unsigned UniqueID; - - COFFSectionKey(StringRef SectionName, StringRef GroupName, - int SelectionKey, unsigned UniqueID) - : SectionName(SectionName), GroupName(GroupName), - SelectionKey(SelectionKey), UniqueID(UniqueID) {} - - bool operator<(const COFFSectionKey &Other) const { - if (SectionName != Other.SectionName) - return SectionName < Other.SectionName; - if (GroupName != Other.GroupName) - return GroupName < Other.GroupName; - if (SelectionKey != Other.SelectionKey) - return SelectionKey < Other.SelectionKey; - return UniqueID < Other.UniqueID; - } - }; - - struct WasmSectionKey { - std::string SectionName; - StringRef GroupName; - unsigned UniqueID; - - WasmSectionKey(StringRef SectionName, StringRef GroupName, - unsigned UniqueID) - : SectionName(SectionName), GroupName(GroupName), UniqueID(UniqueID) { - } - - bool operator<(const WasmSectionKey &Other) const { - if (SectionName != Other.SectionName) - return SectionName < Other.SectionName; - if (GroupName != Other.GroupName) - return GroupName < Other.GroupName; - return UniqueID < Other.UniqueID; - } - }; - - struct XCOFFSectionKey { - // Section name. - std::string SectionName; - // Section property. - // For csect section, it is storage mapping class. - // For debug section, it is section type flags. - union { - XCOFF::StorageMappingClass MappingClass; - XCOFF::DwarfSectionSubtypeFlags DwarfSubtypeFlags; - }; - bool IsCsect; - - XCOFFSectionKey(StringRef SectionName, - XCOFF::StorageMappingClass MappingClass) - : SectionName(SectionName), MappingClass(MappingClass), - IsCsect(true) {} - - XCOFFSectionKey(StringRef SectionName, - XCOFF::DwarfSectionSubtypeFlags DwarfSubtypeFlags) - : SectionName(SectionName), DwarfSubtypeFlags(DwarfSubtypeFlags), - IsCsect(false) {} - - bool operator<(const XCOFFSectionKey &Other) const { - if (IsCsect && Other.IsCsect) - return std::tie(SectionName, MappingClass) < - std::tie(Other.SectionName, Other.MappingClass); - if (IsCsect != Other.IsCsect) - return IsCsect; - return std::tie(SectionName, DwarfSubtypeFlags) < - std::tie(Other.SectionName, Other.DwarfSubtypeFlags); - } - }; - - StringMap MachOUniquingMap; - std::map ELFUniquingMap; - std::map COFFUniquingMap; - std::map GOFFUniquingMap; - std::map WasmUniquingMap; - std::map XCOFFUniquingMap; - StringMap RelSecNames; - - SpecificBumpPtrAllocator MCSubtargetAllocator; - - /// Do automatic reset in destructor - bool AutoReset; +private: + Environment Env; - MCTargetOptions const *TargetOptions; + /// The name of the Segment where Swift5 Reflection Section data will be + /// outputted + StringRef Swift5ReflectionSegmentName; - bool HadError = false; + /// The triple for this object. + Triple TT; - void reportCommon(SMLoc Loc, - std::function); + /// The SourceMgr for this object, if any. + const SourceMgr *SrcMgr; - MCSymbol *createSymbolImpl(const StringMapEntry *Name, - bool CanBeUnnamed); - MCSymbol *createSymbol(StringRef Name, bool AlwaysAddSuffix, - bool IsTemporary); + /// The SourceMgr for inline assembly, if any. + std::unique_ptr InlineSrcMgr; + std::vector LocInfos; - MCSymbol *getOrCreateDirectionalLocalSymbol(unsigned LocalLabelVal, - unsigned Instance); + DiagHandlerTy DiagHandler; - MCSectionELF *createELFSectionImpl(StringRef Section, unsigned Type, - unsigned Flags, SectionKind K, - unsigned EntrySize, - const MCSymbolELF *Group, bool IsComdat, - unsigned UniqueID, - const MCSymbolELF *LinkedToSym); + /// The MCAsmInfo for this target. + const MCAsmInfo *MAI; - MCSymbolXCOFF *createXCOFFSymbolImpl(const StringMapEntry *Name, - bool IsTemporary); + /// The MCRegisterInfo for this target. + const MCRegisterInfo *MRI; - /// Map of currently defined macros. - StringMap MacroMap; + /// The MCObjectFileInfo for this target. + const MCObjectFileInfo *MOFI; - struct ELFEntrySizeKey { - std::string SectionName; - unsigned Flags; - unsigned EntrySize; + /// The MCSubtargetInfo for this target. + const MCSubtargetInfo *MSTI; - ELFEntrySizeKey(StringRef SectionName, unsigned Flags, unsigned EntrySize) - : SectionName(SectionName), Flags(Flags), EntrySize(EntrySize) {} + std::unique_ptr CVContext; - bool operator<(const ELFEntrySizeKey &Other) const { - if (SectionName != Other.SectionName) - return SectionName < Other.SectionName; - if (Flags != Other.Flags) - return Flags < Other.Flags; - return EntrySize < Other.EntrySize; - } - }; - - // Symbols must be assigned to a section with a compatible entry size and - // flags. This map is used to assign unique IDs to sections to distinguish - // between sections with identical names but incompatible entry sizes and/or - // flags. This can occur when a symbol is explicitly assigned to a section, - // e.g. via __attribute__((section("myname"))). - std::map ELFEntrySizeMap; - - // This set is used to record the generic mergeable section names seen. - // These are sections that are created as mergeable e.g. .debug_str. We need - // to avoid assigning non-mergeable symbols to these sections. It is used - // to prevent non-mergeable symbols being explicitly assigned to mergeable - // sections (e.g. via _attribute_((section("myname")))). - DenseSet ELFSeenGenericMergeableSections; - - public: - explicit 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 = {}); - MCContext(const MCContext &) = delete; - MCContext &operator=(const MCContext &) = delete; - ~MCContext(); - - Environment getObjectFileType() const { return Env; } - - const StringRef &getSwift5ReflectionSegmentName() const { - return Swift5ReflectionSegmentName; + /// Allocator object used for creating machine code objects. + /// + /// We use a bump pointer allocator to avoid the need to track all allocated + /// objects. + BumpPtrAllocator Allocator; + + SpecificBumpPtrAllocator COFFAllocator; + SpecificBumpPtrAllocator ELFAllocator; + SpecificBumpPtrAllocator MachOAllocator; + SpecificBumpPtrAllocator GOFFAllocator; + SpecificBumpPtrAllocator WasmAllocator; + SpecificBumpPtrAllocator XCOFFAllocator; + SpecificBumpPtrAllocator MCInstAllocator; + + /// Bindings of names to symbols. + SymbolTable Symbols; + + /// A mapping from a local label number and an instance count to a symbol. + /// For example, in the assembly + /// 1: + /// 2: + /// 1: + /// We have three labels represented by the pairs (1, 0), (2, 0) and (1, 1) + DenseMap, MCSymbol *> LocalSymbols; + + /// Keeps tracks of names that were used both for used declared and + /// artificial symbols. The value is "true" if the name has been used for a + /// non-section symbol (there can be at most one of those, plus an unlimited + /// number of section symbols with the same name). + StringMap UsedNames; + + /// Keeps track of labels that are used in inline assembly. + SymbolTable InlineAsmUsedLabelNames; + + /// The next ID to dole out to an unnamed assembler temporary symbol with + /// a given prefix. + StringMap NextID; + + /// Instances of directional local labels. + DenseMap Instances; + /// NextInstance() creates the next instance of the directional local label + /// for the LocalLabelVal and adds it to the map if needed. + unsigned NextInstance(unsigned LocalLabelVal); + /// GetInstance() gets the current instance of the directional local label + /// for the LocalLabelVal and adds it to the map if needed. + unsigned GetInstance(unsigned LocalLabelVal); + + /// The file name of the log file from the environment variable + /// AS_SECURE_LOG_FILE. Which must be set before the .secure_log_unique + /// directive is used or it is an error. + char *SecureLogFile; + /// The stream that gets written to for the .secure_log_unique directive. + std::unique_ptr SecureLog; + /// Boolean toggled when .secure_log_unique / .secure_log_reset is seen to + /// catch errors if .secure_log_unique appears twice without + /// .secure_log_reset appearing between them. + bool SecureLogUsed = false; + + /// The compilation directory to use for DW_AT_comp_dir. + SmallString<128> CompilationDir; + + /// Prefix replacement map for source file information. + std::map DebugPrefixMap; + + /// The main file name if passed in explicitly. + std::string MainFileName; + + /// The dwarf file and directory tables from the dwarf .file directive. + /// We now emit a line table for each compile unit. To reduce the prologue + /// size of each line table, the files and directories used by each compile + /// unit are separated. + std::map MCDwarfLineTablesCUMap; + + /// The current dwarf line information from the last dwarf .loc directive. + MCDwarfLoc CurrentDwarfLoc; + bool DwarfLocSeen = false; + + /// Generate dwarf debugging info for assembly source files. + bool GenDwarfForAssembly = false; + + /// The current dwarf file number when generate dwarf debugging info for + /// assembly source files. + unsigned GenDwarfFileNumber = 0; + + /// Sections for generating the .debug_ranges and .debug_aranges sections. + SetVector SectionsForRanges; + + /// The information gathered from labels that will have dwarf label + /// entries when generating dwarf assembly source files. + std::vector MCGenDwarfLabelEntries; + + /// The string to embed in the debug information for the compile unit, if + /// non-empty. + StringRef DwarfDebugFlags; + + /// The string to embed in as the dwarf AT_producer for the compile unit, if + /// non-empty. + StringRef DwarfDebugProducer; + + /// The maximum version of dwarf that we should emit. + uint16_t DwarfVersion = 4; + + /// The format of dwarf that we emit. + dwarf::DwarfFormat DwarfFormat = dwarf::DWARF32; + + /// Honor temporary labels, this is useful for debugging semantic + /// differences between temporary and non-temporary labels (primarily on + /// Darwin). + bool AllowTemporaryLabels = true; + bool UseNamesOnTempLabels = false; + + /// The Compile Unit ID that we are currently processing. + unsigned DwarfCompileUnitID = 0; + + /// A collection of MCPseudoProbe in the current module + MCPseudoProbeTable PseudoProbeTable; + + // Sections are differentiated by the quadruple (section_name, group_name, + // unique_id, link_to_symbol_name). Sections sharing the same quadruple are + // combined into one section. + struct ELFSectionKey { + std::string SectionName; + StringRef GroupName; + StringRef LinkedToName; + unsigned UniqueID; + + ELFSectionKey(StringRef SectionName, StringRef GroupName, + StringRef LinkedToName, unsigned UniqueID) + : SectionName(SectionName), GroupName(GroupName), + LinkedToName(LinkedToName), UniqueID(UniqueID) {} + + bool operator<(const ELFSectionKey &Other) const { + if (SectionName != Other.SectionName) + return SectionName < Other.SectionName; + if (GroupName != Other.GroupName) + return GroupName < Other.GroupName; + if (int O = LinkedToName.compare(Other.LinkedToName)) + return O < 0; + return UniqueID < Other.UniqueID; } - const Triple &getTargetTriple() const { return TT; } - const SourceMgr *getSourceManager() const { return SrcMgr; } + }; - void initInlineSourceManager(); - SourceMgr *getInlineSourceManager() { - return InlineSrcMgr.get(); - } - std::vector &getLocInfos() { return LocInfos; } - void setDiagnosticHandler(DiagHandlerTy DiagHandler) { - this->DiagHandler = DiagHandler; + struct COFFSectionKey { + std::string SectionName; + StringRef GroupName; + int SelectionKey; + unsigned UniqueID; + + COFFSectionKey(StringRef SectionName, StringRef GroupName, int SelectionKey, + unsigned UniqueID) + : SectionName(SectionName), GroupName(GroupName), + SelectionKey(SelectionKey), UniqueID(UniqueID) {} + + bool operator<(const COFFSectionKey &Other) const { + if (SectionName != Other.SectionName) + return SectionName < Other.SectionName; + if (GroupName != Other.GroupName) + return GroupName < Other.GroupName; + if (SelectionKey != Other.SelectionKey) + return SelectionKey < Other.SelectionKey; + return UniqueID < Other.UniqueID; } + }; - void setObjectFileInfo(const MCObjectFileInfo *Mofi) { MOFI = Mofi; } - - const MCAsmInfo *getAsmInfo() const { return MAI; } - - const MCRegisterInfo *getRegisterInfo() const { return MRI; } - - const MCObjectFileInfo *getObjectFileInfo() const { return MOFI; } - - const MCSubtargetInfo *getSubtargetInfo() const { return MSTI; } - - CodeViewContext &getCVContext(); - - void setAllowTemporaryLabels(bool Value) { AllowTemporaryLabels = Value; } - void setUseNamesOnTempLabels(bool Value) { UseNamesOnTempLabels = Value; } - - /// \name Module Lifetime Management - /// @{ - - /// reset - return object to right after construction state to prepare - /// to process a new module - void reset(); - - /// @} - - /// \name McInst Management - - /// Create and return a new MC instruction. - MCInst *createMCInst(); - - /// \name Symbol Management - /// @{ - - /// Create and return a new linker temporary symbol with a unique but - /// unspecified name. - MCSymbol *createLinkerPrivateTempSymbol(); - - /// Create a temporary symbol with a unique name. The name will be omitted - /// in the symbol table if UseNamesOnTempLabels is false (default except - /// MCAsmStreamer). The overload without Name uses an unspecified name. - MCSymbol *createTempSymbol(); - MCSymbol *createTempSymbol(const Twine &Name, bool AlwaysAddSuffix = true); - - /// Create a temporary symbol with a unique name whose name cannot be - /// omitted in the symbol table. This is rarely used. - MCSymbol *createNamedTempSymbol(); - MCSymbol *createNamedTempSymbol(const Twine &Name); - - /// Create the definition of a directional local symbol for numbered label - /// (used for "1:" definitions). - MCSymbol *createDirectionalLocalSymbol(unsigned LocalLabelVal); - - /// Create and return a directional local symbol for numbered label (used - /// for "1b" or 1f" references). - MCSymbol *getDirectionalLocalSymbol(unsigned LocalLabelVal, bool Before); - - /// Lookup the symbol inside with the specified \p Name. If it exists, - /// return it. If not, create a forward reference and return it. - /// - /// \param Name - The symbol name, which must be unique across all symbols. - MCSymbol *getOrCreateSymbol(const Twine &Name); + struct WasmSectionKey { + std::string SectionName; + StringRef GroupName; + unsigned UniqueID; + + WasmSectionKey(StringRef SectionName, StringRef GroupName, + unsigned UniqueID) + : SectionName(SectionName), GroupName(GroupName), UniqueID(UniqueID) {} + + bool operator<(const WasmSectionKey &Other) const { + if (SectionName != Other.SectionName) + return SectionName < Other.SectionName; + if (GroupName != Other.GroupName) + return GroupName < Other.GroupName; + return UniqueID < Other.UniqueID; + } + }; - /// Gets a symbol that will be defined to the final stack offset of a local - /// variable after codegen. - /// - /// \param Idx - The index of a local variable passed to \@llvm.localescape. - MCSymbol *getOrCreateFrameAllocSymbol(StringRef FuncName, unsigned Idx); + struct XCOFFSectionKey { + // Section name. + std::string SectionName; + // Section property. + // For csect section, it is storage mapping class. + // For debug section, it is section type flags. + union { + XCOFF::StorageMappingClass MappingClass; + XCOFF::DwarfSectionSubtypeFlags DwarfSubtypeFlags; + }; + bool IsCsect; + + XCOFFSectionKey(StringRef SectionName, + XCOFF::StorageMappingClass MappingClass) + : SectionName(SectionName), MappingClass(MappingClass), IsCsect(true) {} + + XCOFFSectionKey(StringRef SectionName, + XCOFF::DwarfSectionSubtypeFlags DwarfSubtypeFlags) + : SectionName(SectionName), DwarfSubtypeFlags(DwarfSubtypeFlags), + IsCsect(false) {} + + bool operator<(const XCOFFSectionKey &Other) const { + if (IsCsect && Other.IsCsect) + return std::tie(SectionName, MappingClass) < + std::tie(Other.SectionName, Other.MappingClass); + if (IsCsect != Other.IsCsect) + return IsCsect; + return std::tie(SectionName, DwarfSubtypeFlags) < + std::tie(Other.SectionName, Other.DwarfSubtypeFlags); + } + }; - MCSymbol *getOrCreateParentFrameOffsetSymbol(StringRef FuncName); + StringMap MachOUniquingMap; + std::map ELFUniquingMap; + std::map COFFUniquingMap; + std::map GOFFUniquingMap; + std::map WasmUniquingMap; + std::map XCOFFUniquingMap; + StringMap RelSecNames; - MCSymbol *getOrCreateLSDASymbol(StringRef FuncName); + SpecificBumpPtrAllocator MCSubtargetAllocator; - /// Get the symbol for \p Name, or null. - MCSymbol *lookupSymbol(const Twine &Name) const; + /// Do automatic reset in destructor + bool AutoReset; - /// Set value for a symbol. - void setSymbolValue(MCStreamer &Streamer, StringRef Sym, uint64_t Val); + MCTargetOptions const *TargetOptions; - /// getSymbols - Get a reference for the symbol table for clients that - /// want to, for example, iterate over all symbols. 'const' because we - /// still want any modifications to the table itself to use the MCContext - /// APIs. - const SymbolTable &getSymbols() const { return Symbols; } + bool HadError = false; - /// isInlineAsmLabel - Return true if the name is a label referenced in - /// inline assembly. - MCSymbol *getInlineAsmLabel(StringRef Name) const { - return InlineAsmUsedLabelNames.lookup(Name); - } + void reportCommon(SMLoc Loc, + std::function); - /// registerInlineAsmLabel - Records that the name is a label referenced in - /// inline assembly. - void registerInlineAsmLabel(MCSymbol *Sym); + MCSymbol *createSymbolImpl(const StringMapEntry *Name, + bool CanBeUnnamed); + MCSymbol *createSymbol(StringRef Name, bool AlwaysAddSuffix, + bool IsTemporary); - /// @} + MCSymbol *getOrCreateDirectionalLocalSymbol(unsigned LocalLabelVal, + unsigned Instance); - /// \name Section Management - /// @{ + MCSectionELF *createELFSectionImpl(StringRef Section, unsigned Type, + unsigned Flags, SectionKind K, + unsigned EntrySize, + const MCSymbolELF *Group, bool IsComdat, + unsigned UniqueID, + const MCSymbolELF *LinkedToSym); - enum : unsigned { - /// Pass this value as the UniqueID during section creation to get the - /// generic section with the given name and characteristics. The usual - /// sections such as .text use this ID. - GenericSectionID = ~0U - }; + MCSymbolXCOFF *createXCOFFSymbolImpl(const StringMapEntry *Name, + bool IsTemporary); - /// Return the MCSection for the specified mach-o section. This requires - /// the operands to be valid. - MCSectionMachO *getMachOSection(StringRef Segment, StringRef Section, - unsigned TypeAndAttributes, - unsigned Reserved2, SectionKind K, - const char *BeginSymName = nullptr); - - MCSectionMachO *getMachOSection(StringRef Segment, StringRef Section, - unsigned TypeAndAttributes, SectionKind K, - const char *BeginSymName = nullptr) { - return getMachOSection(Segment, Section, TypeAndAttributes, 0, K, - BeginSymName); - } + /// Map of currently defined macros. + StringMap MacroMap; - MCSectionELF *getELFSection(const Twine &Section, unsigned Type, - unsigned Flags) { - return getELFSection(Section, Type, Flags, 0, "", false); - } + struct ELFEntrySizeKey { + std::string SectionName; + unsigned Flags; + unsigned EntrySize; - MCSectionELF *getELFSection(const Twine &Section, unsigned Type, - unsigned Flags, unsigned EntrySize) { - return getELFSection(Section, Type, Flags, EntrySize, "", false, - MCSection::NonUniqueID, nullptr); - } + ELFEntrySizeKey(StringRef SectionName, unsigned Flags, unsigned EntrySize) + : SectionName(SectionName), Flags(Flags), EntrySize(EntrySize) {} - MCSectionELF *getELFSection(const Twine &Section, unsigned Type, - unsigned Flags, unsigned EntrySize, - const Twine &Group, bool IsComdat) { - return getELFSection(Section, Type, Flags, EntrySize, Group, IsComdat, - MCSection::NonUniqueID, nullptr); + bool operator<(const ELFEntrySizeKey &Other) const { + if (SectionName != Other.SectionName) + return SectionName < Other.SectionName; + if (Flags != Other.Flags) + return Flags < Other.Flags; + return EntrySize < Other.EntrySize; } + }; - MCSectionELF *getELFSection(const Twine &Section, unsigned Type, - unsigned Flags, unsigned EntrySize, - const Twine &Group, bool IsComdat, - unsigned UniqueID, - const MCSymbolELF *LinkedToSym); + // Symbols must be assigned to a section with a compatible entry size and + // flags. This map is used to assign unique IDs to sections to distinguish + // between sections with identical names but incompatible entry sizes and/or + // flags. This can occur when a symbol is explicitly assigned to a section, + // e.g. via __attribute__((section("myname"))). + std::map ELFEntrySizeMap; - MCSectionELF *getELFSection(const Twine &Section, unsigned Type, - unsigned Flags, unsigned EntrySize, - const MCSymbolELF *Group, bool IsComdat, - unsigned UniqueID, - const MCSymbolELF *LinkedToSym); + // This set is used to record the generic mergeable section names seen. + // These are sections that are created as mergeable e.g. .debug_str. We need + // to avoid assigning non-mergeable symbols to these sections. It is used + // to prevent non-mergeable symbols being explicitly assigned to mergeable + // sections (e.g. via _attribute_((section("myname")))). + DenseSet ELFSeenGenericMergeableSections; - /// Get a section with the provided group identifier. This section is - /// named by concatenating \p Prefix with '.' then \p Suffix. The \p Type - /// describes the type of the section and \p Flags are used to further - /// configure this named section. - MCSectionELF *getELFNamedSection(const Twine &Prefix, const Twine &Suffix, - unsigned Type, unsigned Flags, - unsigned EntrySize = 0); +public: + explicit 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 = {}); + MCContext(const MCContext &) = delete; + MCContext &operator=(const MCContext &) = delete; + ~MCContext(); - MCSectionELF *createELFRelSection(const Twine &Name, unsigned Type, - unsigned Flags, unsigned EntrySize, - const MCSymbolELF *Group, - const MCSectionELF *RelInfoSection); + Environment getObjectFileType() const { return Env; } - void renameELFSection(MCSectionELF *Section, StringRef Name); + const StringRef &getSwift5ReflectionSegmentName() const { + return Swift5ReflectionSegmentName; + } + const Triple &getTargetTriple() const { return TT; } + const SourceMgr *getSourceManager() const { return SrcMgr; } - MCSectionELF *createELFGroupSection(const MCSymbolELF *Group, - bool IsComdat); + void initInlineSourceManager(); + SourceMgr *getInlineSourceManager() { return InlineSrcMgr.get(); } + std::vector &getLocInfos() { return LocInfos; } + void setDiagnosticHandler(DiagHandlerTy DiagHandler) { + this->DiagHandler = DiagHandler; + } - void recordELFMergeableSectionInfo(StringRef SectionName, unsigned Flags, - unsigned UniqueID, unsigned EntrySize); + void setObjectFileInfo(const MCObjectFileInfo *Mofi) { MOFI = Mofi; } - bool isELFImplicitMergeableSectionNamePrefix(StringRef Name); + const MCAsmInfo *getAsmInfo() const { return MAI; } - bool isELFGenericMergeableSection(StringRef Name); + const MCRegisterInfo *getRegisterInfo() const { return MRI; } - /// Return the unique ID of the section with the given name, flags and entry - /// size, if it exists. - Optional getELFUniqueIDForEntsize(StringRef SectionName, - unsigned Flags, - unsigned EntrySize); + const MCObjectFileInfo *getObjectFileInfo() const { return MOFI; } - MCSectionGOFF *getGOFFSection(StringRef Section, SectionKind Kind); + const MCSubtargetInfo *getSubtargetInfo() const { return MSTI; } - MCSectionCOFF *getCOFFSection(StringRef Section, unsigned Characteristics, - SectionKind Kind, StringRef COMDATSymName, - int Selection, - unsigned UniqueID = GenericSectionID, - const char *BeginSymName = nullptr); - - MCSectionCOFF *getCOFFSection(StringRef Section, unsigned Characteristics, - SectionKind Kind, - const char *BeginSymName = nullptr); + CodeViewContext &getCVContext(); - /// Gets or creates a section equivalent to Sec that is associated with the - /// section containing KeySym. For example, to create a debug info section - /// associated with an inline function, pass the normal debug info section - /// as Sec and the function symbol as KeySym. - MCSectionCOFF * - getAssociativeCOFFSection(MCSectionCOFF *Sec, const MCSymbol *KeySym, - unsigned UniqueID = GenericSectionID); - - MCSectionWasm *getWasmSection(const Twine &Section, SectionKind K, - unsigned Flags = 0) { - return getWasmSection(Section, K, Flags, nullptr); - } + void setAllowTemporaryLabels(bool Value) { AllowTemporaryLabels = Value; } + void setUseNamesOnTempLabels(bool Value) { UseNamesOnTempLabels = Value; } - MCSectionWasm *getWasmSection(const Twine &Section, SectionKind K, - unsigned Flags, const char *BeginSymName) { - return getWasmSection(Section, K, Flags, "", ~0, BeginSymName); - } + /// \name Module Lifetime Management + /// @{ - MCSectionWasm *getWasmSection(const Twine &Section, SectionKind K, - unsigned Flags, const Twine &Group, - unsigned UniqueID) { - return getWasmSection(Section, K, Flags, Group, UniqueID, nullptr); - } + /// reset - return object to right after construction state to prepare + /// to process a new module + void reset(); - MCSectionWasm *getWasmSection(const Twine &Section, SectionKind K, - unsigned Flags, const Twine &Group, - unsigned UniqueID, const char *BeginSymName); + /// @} - MCSectionWasm *getWasmSection(const Twine &Section, SectionKind K, - unsigned Flags, const MCSymbolWasm *Group, - unsigned UniqueID, const char *BeginSymName); + /// \name McInst Management - bool hasXCOFFSection(StringRef Section, - XCOFF::CsectProperties CsectProp) const; + /// Create and return a new MC instruction. + MCInst *createMCInst(); - MCSectionXCOFF *getXCOFFSection( - StringRef Section, SectionKind K, - Optional CsectProp = None, - bool MultiSymbolsAllowed = false, const char *BeginSymName = nullptr, - Optional DwarfSubtypeFlags = None); + /// \name Symbol Management + /// @{ - // Create and save a copy of STI and return a reference to the copy. - MCSubtargetInfo &getSubtargetCopy(const MCSubtargetInfo &STI); + /// Create and return a new linker temporary symbol with a unique but + /// unspecified name. + MCSymbol *createLinkerPrivateTempSymbol(); - /// @} + /// Create a temporary symbol with a unique name. The name will be omitted + /// in the symbol table if UseNamesOnTempLabels is false (default except + /// MCAsmStreamer). The overload without Name uses an unspecified name. + MCSymbol *createTempSymbol(); + MCSymbol *createTempSymbol(const Twine &Name, bool AlwaysAddSuffix = true); - /// \name Dwarf Management - /// @{ + /// Create a temporary symbol with a unique name whose name cannot be + /// omitted in the symbol table. This is rarely used. + MCSymbol *createNamedTempSymbol(); + MCSymbol *createNamedTempSymbol(const Twine &Name); - /// Get the compilation directory for DW_AT_comp_dir - /// The compilation directory should be set with \c setCompilationDir before - /// calling this function. If it is unset, an empty string will be returned. - StringRef getCompilationDir() const { return CompilationDir; } + /// Create the definition of a directional local symbol for numbered label + /// (used for "1:" definitions). + MCSymbol *createDirectionalLocalSymbol(unsigned LocalLabelVal); - /// Set the compilation directory for DW_AT_comp_dir - void setCompilationDir(StringRef S) { CompilationDir = S.str(); } + /// Create and return a directional local symbol for numbered label (used + /// for "1b" or 1f" references). + MCSymbol *getDirectionalLocalSymbol(unsigned LocalLabelVal, bool Before); - /// Add an entry to the debug prefix map. - void addDebugPrefixMapEntry(const std::string &From, const std::string &To); + /// Lookup the symbol inside with the specified \p Name. If it exists, + /// return it. If not, create a forward reference and return it. + /// + /// \param Name - The symbol name, which must be unique across all symbols. + MCSymbol *getOrCreateSymbol(const Twine &Name); - // Remaps all debug directory paths in-place as per the debug prefix map. - void RemapDebugPaths(); + /// Gets a symbol that will be defined to the final stack offset of a local + /// variable after codegen. + /// + /// \param Idx - The index of a local variable passed to \@llvm.localescape. + MCSymbol *getOrCreateFrameAllocSymbol(StringRef FuncName, unsigned Idx); - /// Get the main file name for use in error messages and debug - /// info. This can be set to ensure we've got the correct file name - /// after preprocessing or for -save-temps. - const std::string &getMainFileName() const { return MainFileName; } + MCSymbol *getOrCreateParentFrameOffsetSymbol(StringRef FuncName); - /// Set the main file name and override the default. - void setMainFileName(StringRef S) { MainFileName = std::string(S); } + MCSymbol *getOrCreateLSDASymbol(StringRef FuncName); - /// Creates an entry in the dwarf file and directory tables. - Expected getDwarfFile(StringRef Directory, StringRef FileName, - unsigned FileNumber, - Optional Checksum, - Optional Source, unsigned CUID); + /// Get the symbol for \p Name, or null. + MCSymbol *lookupSymbol(const Twine &Name) const; - bool isValidDwarfFileNumber(unsigned FileNumber, unsigned CUID = 0); + /// Set value for a symbol. + void setSymbolValue(MCStreamer &Streamer, StringRef Sym, uint64_t Val); - const std::map &getMCDwarfLineTables() const { - return MCDwarfLineTablesCUMap; - } + /// getSymbols - Get a reference for the symbol table for clients that + /// want to, for example, iterate over all symbols. 'const' because we + /// still want any modifications to the table itself to use the MCContext + /// APIs. + const SymbolTable &getSymbols() const { return Symbols; } - MCDwarfLineTable &getMCDwarfLineTable(unsigned CUID) { - return MCDwarfLineTablesCUMap[CUID]; - } + /// isInlineAsmLabel - Return true if the name is a label referenced in + /// inline assembly. + MCSymbol *getInlineAsmLabel(StringRef Name) const { + return InlineAsmUsedLabelNames.lookup(Name); + } - const MCDwarfLineTable &getMCDwarfLineTable(unsigned CUID) const { - auto I = MCDwarfLineTablesCUMap.find(CUID); - assert(I != MCDwarfLineTablesCUMap.end()); - return I->second; - } + /// registerInlineAsmLabel - Records that the name is a label referenced in + /// inline assembly. + void registerInlineAsmLabel(MCSymbol *Sym); - const SmallVectorImpl &getMCDwarfFiles(unsigned CUID = 0) { - return getMCDwarfLineTable(CUID).getMCDwarfFiles(); - } + /// @} - const SmallVectorImpl &getMCDwarfDirs(unsigned CUID = 0) { - return getMCDwarfLineTable(CUID).getMCDwarfDirs(); - } + /// \name Section Management + /// @{ - unsigned getDwarfCompileUnitID() { return DwarfCompileUnitID; } + enum : unsigned { + /// Pass this value as the UniqueID during section creation to get the + /// generic section with the given name and characteristics. The usual + /// sections such as .text use this ID. + GenericSectionID = ~0U + }; - void setDwarfCompileUnitID(unsigned CUIndex) { - DwarfCompileUnitID = CUIndex; - } + /// Return the MCSection for the specified mach-o section. This requires + /// the operands to be valid. + MCSectionMachO *getMachOSection(StringRef Segment, StringRef Section, + unsigned TypeAndAttributes, + unsigned Reserved2, SectionKind K, + const char *BeginSymName = nullptr); - /// Specifies the "root" file and directory of the compilation unit. - /// These are "file 0" and "directory 0" in DWARF v5. - void setMCLineTableRootFile(unsigned CUID, StringRef CompilationDir, - StringRef Filename, - Optional Checksum, - Optional Source) { - getMCDwarfLineTable(CUID).setRootFile(CompilationDir, Filename, Checksum, - Source); - } + MCSectionMachO *getMachOSection(StringRef Segment, StringRef Section, + unsigned TypeAndAttributes, SectionKind K, + const char *BeginSymName = nullptr) { + return getMachOSection(Segment, Section, TypeAndAttributes, 0, K, + BeginSymName); + } + + MCSectionELF *getELFSection(const Twine &Section, unsigned Type, + unsigned Flags) { + return getELFSection(Section, Type, Flags, 0, "", false); + } + + MCSectionELF *getELFSection(const Twine &Section, unsigned Type, + unsigned Flags, unsigned EntrySize) { + return getELFSection(Section, Type, Flags, EntrySize, "", false, + MCSection::NonUniqueID, nullptr); + } + + MCSectionELF *getELFSection(const Twine &Section, unsigned Type, + unsigned Flags, unsigned EntrySize, + const Twine &Group, bool IsComdat) { + return getELFSection(Section, Type, Flags, EntrySize, Group, IsComdat, + MCSection::NonUniqueID, nullptr); + } + + MCSectionELF *getELFSection(const Twine &Section, unsigned Type, + unsigned Flags, unsigned EntrySize, + const Twine &Group, bool IsComdat, + unsigned UniqueID, + const MCSymbolELF *LinkedToSym); + + MCSectionELF *getELFSection(const Twine &Section, unsigned Type, + unsigned Flags, unsigned EntrySize, + const MCSymbolELF *Group, bool IsComdat, + unsigned UniqueID, + const MCSymbolELF *LinkedToSym); + + /// Get a section with the provided group identifier. This section is + /// named by concatenating \p Prefix with '.' then \p Suffix. The \p Type + /// describes the type of the section and \p Flags are used to further + /// configure this named section. + MCSectionELF *getELFNamedSection(const Twine &Prefix, const Twine &Suffix, + unsigned Type, unsigned Flags, + unsigned EntrySize = 0); + + MCSectionELF *createELFRelSection(const Twine &Name, unsigned Type, + unsigned Flags, unsigned EntrySize, + const MCSymbolELF *Group, + const MCSectionELF *RelInfoSection); + + void renameELFSection(MCSectionELF *Section, StringRef Name); + + MCSectionELF *createELFGroupSection(const MCSymbolELF *Group, bool IsComdat); + + void recordELFMergeableSectionInfo(StringRef SectionName, unsigned Flags, + unsigned UniqueID, unsigned EntrySize); + + bool isELFImplicitMergeableSectionNamePrefix(StringRef Name); + + bool isELFGenericMergeableSection(StringRef Name); + + /// Return the unique ID of the section with the given name, flags and entry + /// size, if it exists. + Optional getELFUniqueIDForEntsize(StringRef SectionName, + unsigned Flags, + unsigned EntrySize); + + MCSectionGOFF *getGOFFSection(StringRef Section, SectionKind Kind); + + MCSectionCOFF *getCOFFSection(StringRef Section, unsigned Characteristics, + SectionKind Kind, StringRef COMDATSymName, + int Selection, + unsigned UniqueID = GenericSectionID, + const char *BeginSymName = nullptr); + + MCSectionCOFF *getCOFFSection(StringRef Section, unsigned Characteristics, + SectionKind Kind, + const char *BeginSymName = nullptr); + + /// Gets or creates a section equivalent to Sec that is associated with the + /// section containing KeySym. For example, to create a debug info section + /// associated with an inline function, pass the normal debug info section + /// as Sec and the function symbol as KeySym. + MCSectionCOFF * + getAssociativeCOFFSection(MCSectionCOFF *Sec, const MCSymbol *KeySym, + unsigned UniqueID = GenericSectionID); + + MCSectionWasm *getWasmSection(const Twine &Section, SectionKind K, + unsigned Flags = 0) { + return getWasmSection(Section, K, Flags, nullptr); + } + + MCSectionWasm *getWasmSection(const Twine &Section, SectionKind K, + unsigned Flags, const char *BeginSymName) { + return getWasmSection(Section, K, Flags, "", ~0, BeginSymName); + } + + MCSectionWasm *getWasmSection(const Twine &Section, SectionKind K, + unsigned Flags, const Twine &Group, + unsigned UniqueID) { + return getWasmSection(Section, K, Flags, Group, UniqueID, nullptr); + } + + MCSectionWasm *getWasmSection(const Twine &Section, SectionKind K, + unsigned Flags, const Twine &Group, + unsigned UniqueID, const char *BeginSymName); + + MCSectionWasm *getWasmSection(const Twine &Section, SectionKind K, + unsigned Flags, const MCSymbolWasm *Group, + unsigned UniqueID, const char *BeginSymName); + + bool hasXCOFFSection(StringRef Section, + XCOFF::CsectProperties CsectProp) const; + + MCSectionXCOFF *getXCOFFSection( + StringRef Section, SectionKind K, + Optional CsectProp = None, + bool MultiSymbolsAllowed = false, const char *BeginSymName = nullptr, + Optional DwarfSubtypeFlags = None); + + // Create and save a copy of STI and return a reference to the copy. + MCSubtargetInfo &getSubtargetCopy(const MCSubtargetInfo &STI); + + /// @} + + /// \name Dwarf Management + /// @{ + + /// Get the compilation directory for DW_AT_comp_dir + /// The compilation directory should be set with \c setCompilationDir before + /// calling this function. If it is unset, an empty string will be returned. + StringRef getCompilationDir() const { return CompilationDir; } + + /// Set the compilation directory for DW_AT_comp_dir + void setCompilationDir(StringRef S) { CompilationDir = S.str(); } + + /// Add an entry to the debug prefix map. + void addDebugPrefixMapEntry(const std::string &From, const std::string &To); + + // Remaps all debug directory paths in-place as per the debug prefix map. + void RemapDebugPaths(); + + /// Get the main file name for use in error messages and debug + /// info. This can be set to ensure we've got the correct file name + /// after preprocessing or for -save-temps. + const std::string &getMainFileName() const { return MainFileName; } + + /// Set the main file name and override the default. + void setMainFileName(StringRef S) { MainFileName = std::string(S); } + + /// Creates an entry in the dwarf file and directory tables. + Expected getDwarfFile(StringRef Directory, StringRef FileName, + unsigned FileNumber, + Optional Checksum, + Optional Source, unsigned CUID); + + bool isValidDwarfFileNumber(unsigned FileNumber, unsigned CUID = 0); + + const std::map &getMCDwarfLineTables() const { + return MCDwarfLineTablesCUMap; + } + + MCDwarfLineTable &getMCDwarfLineTable(unsigned CUID) { + return MCDwarfLineTablesCUMap[CUID]; + } + + const MCDwarfLineTable &getMCDwarfLineTable(unsigned CUID) const { + auto I = MCDwarfLineTablesCUMap.find(CUID); + assert(I != MCDwarfLineTablesCUMap.end()); + return I->second; + } + + const SmallVectorImpl &getMCDwarfFiles(unsigned CUID = 0) { + return getMCDwarfLineTable(CUID).getMCDwarfFiles(); + } + + const SmallVectorImpl &getMCDwarfDirs(unsigned CUID = 0) { + return getMCDwarfLineTable(CUID).getMCDwarfDirs(); + } + + unsigned getDwarfCompileUnitID() { return DwarfCompileUnitID; } + + void setDwarfCompileUnitID(unsigned CUIndex) { DwarfCompileUnitID = CUIndex; } + + /// Specifies the "root" file and directory of the compilation unit. + /// These are "file 0" and "directory 0" in DWARF v5. + void setMCLineTableRootFile(unsigned CUID, StringRef CompilationDir, + StringRef Filename, + Optional Checksum, + Optional Source) { + getMCDwarfLineTable(CUID).setRootFile(CompilationDir, Filename, Checksum, + Source); + } - /// Reports whether MD5 checksum usage is consistent (all-or-none). - bool isDwarfMD5UsageConsistent(unsigned CUID) const { - return getMCDwarfLineTable(CUID).isMD5UsageConsistent(); - } + /// Reports whether MD5 checksum usage is consistent (all-or-none). + bool isDwarfMD5UsageConsistent(unsigned CUID) const { + return getMCDwarfLineTable(CUID).isMD5UsageConsistent(); + } - /// Saves the information from the currently parsed dwarf .loc directive - /// and sets DwarfLocSeen. When the next instruction is assembled an entry - /// in the line number table with this information and the address of the - /// instruction will be created. - void setCurrentDwarfLoc(unsigned FileNum, unsigned Line, unsigned Column, - unsigned Flags, unsigned Isa, - unsigned Discriminator) { - CurrentDwarfLoc.setFileNum(FileNum); - CurrentDwarfLoc.setLine(Line); - CurrentDwarfLoc.setColumn(Column); - CurrentDwarfLoc.setFlags(Flags); - CurrentDwarfLoc.setIsa(Isa); - CurrentDwarfLoc.setDiscriminator(Discriminator); - DwarfLocSeen = true; - } + /// Saves the information from the currently parsed dwarf .loc directive + /// and sets DwarfLocSeen. When the next instruction is assembled an entry + /// in the line number table with this information and the address of the + /// instruction will be created. + void setCurrentDwarfLoc(unsigned FileNum, unsigned Line, unsigned Column, + unsigned Flags, unsigned Isa, + unsigned Discriminator) { + CurrentDwarfLoc.setFileNum(FileNum); + CurrentDwarfLoc.setLine(Line); + CurrentDwarfLoc.setColumn(Column); + CurrentDwarfLoc.setFlags(Flags); + CurrentDwarfLoc.setIsa(Isa); + CurrentDwarfLoc.setDiscriminator(Discriminator); + DwarfLocSeen = true; + } - void clearDwarfLocSeen() { DwarfLocSeen = false; } + void clearDwarfLocSeen() { DwarfLocSeen = false; } - bool getDwarfLocSeen() { return DwarfLocSeen; } - const MCDwarfLoc &getCurrentDwarfLoc() { return CurrentDwarfLoc; } + bool getDwarfLocSeen() { return DwarfLocSeen; } + const MCDwarfLoc &getCurrentDwarfLoc() { return CurrentDwarfLoc; } - bool getGenDwarfForAssembly() { return GenDwarfForAssembly; } - void setGenDwarfForAssembly(bool Value) { GenDwarfForAssembly = Value; } - unsigned getGenDwarfFileNumber() { return GenDwarfFileNumber; } + bool getGenDwarfForAssembly() { return GenDwarfForAssembly; } + void setGenDwarfForAssembly(bool Value) { GenDwarfForAssembly = Value; } + unsigned getGenDwarfFileNumber() { return GenDwarfFileNumber; } - void setGenDwarfFileNumber(unsigned FileNumber) { - GenDwarfFileNumber = FileNumber; - } + void setGenDwarfFileNumber(unsigned FileNumber) { + GenDwarfFileNumber = FileNumber; + } - /// Specifies information about the "root file" for assembler clients - /// (e.g., llvm-mc). Assumes compilation dir etc. have been set up. - void setGenDwarfRootFile(StringRef FileName, StringRef Buffer); + /// Specifies information about the "root file" for assembler clients + /// (e.g., llvm-mc). Assumes compilation dir etc. have been set up. + void setGenDwarfRootFile(StringRef FileName, StringRef Buffer); - const SetVector &getGenDwarfSectionSyms() { - return SectionsForRanges; - } + const SetVector &getGenDwarfSectionSyms() { + return SectionsForRanges; + } - bool addGenDwarfSection(MCSection *Sec) { - return SectionsForRanges.insert(Sec); - } + bool addGenDwarfSection(MCSection *Sec) { + return SectionsForRanges.insert(Sec); + } - void finalizeDwarfSections(MCStreamer &MCOS); + void finalizeDwarfSections(MCStreamer &MCOS); - const std::vector &getMCGenDwarfLabelEntries() const { - return MCGenDwarfLabelEntries; - } + const std::vector &getMCGenDwarfLabelEntries() const { + return MCGenDwarfLabelEntries; + } - void addMCGenDwarfLabelEntry(const MCGenDwarfLabelEntry &E) { - MCGenDwarfLabelEntries.push_back(E); - } + void addMCGenDwarfLabelEntry(const MCGenDwarfLabelEntry &E) { + MCGenDwarfLabelEntries.push_back(E); + } - void setDwarfDebugFlags(StringRef S) { DwarfDebugFlags = S; } - StringRef getDwarfDebugFlags() { return DwarfDebugFlags; } + void setDwarfDebugFlags(StringRef S) { DwarfDebugFlags = S; } + StringRef getDwarfDebugFlags() { return DwarfDebugFlags; } - void setDwarfDebugProducer(StringRef S) { DwarfDebugProducer = S; } - StringRef getDwarfDebugProducer() { return DwarfDebugProducer; } + void setDwarfDebugProducer(StringRef S) { DwarfDebugProducer = S; } + StringRef getDwarfDebugProducer() { return DwarfDebugProducer; } - void setDwarfFormat(dwarf::DwarfFormat f) { DwarfFormat = f; } - dwarf::DwarfFormat getDwarfFormat() const { return DwarfFormat; } + void setDwarfFormat(dwarf::DwarfFormat f) { DwarfFormat = f; } + dwarf::DwarfFormat getDwarfFormat() const { return DwarfFormat; } + + void setDwarfVersion(uint16_t v) { DwarfVersion = v; } + uint16_t getDwarfVersion() const { return DwarfVersion; } - void setDwarfVersion(uint16_t v) { DwarfVersion = v; } - uint16_t getDwarfVersion() const { return DwarfVersion; } + /// @} - /// @} + char *getSecureLogFile() { return SecureLogFile; } + raw_fd_ostream *getSecureLog() { return SecureLog.get(); } + + void setSecureLog(std::unique_ptr Value) { + SecureLog = std::move(Value); + } - char *getSecureLogFile() { return SecureLogFile; } - raw_fd_ostream *getSecureLog() { return SecureLog.get(); } + bool getSecureLogUsed() { return SecureLogUsed; } + void setSecureLogUsed(bool Value) { SecureLogUsed = Value; } - void setSecureLog(std::unique_ptr Value) { - SecureLog = std::move(Value); - } + void *allocate(unsigned Size, unsigned Align = 8) { + return Allocator.Allocate(Size, Align); + } - bool getSecureLogUsed() { return SecureLogUsed; } - void setSecureLogUsed(bool Value) { SecureLogUsed = Value; } + void deallocate(void *Ptr) {} - void *allocate(unsigned Size, unsigned Align = 8) { - return Allocator.Allocate(Size, Align); - } + bool hadError() { return HadError; } + void diagnose(const SMDiagnostic &SMD); + void reportError(SMLoc L, const Twine &Msg); + void reportWarning(SMLoc L, const Twine &Msg); + + const MCAsmMacro *lookupMacro(StringRef Name) { + StringMap::iterator I = MacroMap.find(Name); + return (I == MacroMap.end()) ? nullptr : &I->getValue(); + } - void deallocate(void *Ptr) {} + void defineMacro(StringRef Name, MCAsmMacro Macro) { + MacroMap.insert(std::make_pair(Name, std::move(Macro))); + } - bool hadError() { return HadError; } - void diagnose(const SMDiagnostic &SMD); - void reportError(SMLoc L, const Twine &Msg); - void reportWarning(SMLoc L, const Twine &Msg); - - const MCAsmMacro *lookupMacro(StringRef Name) { - StringMap::iterator I = MacroMap.find(Name); - return (I == MacroMap.end()) ? nullptr : &I->getValue(); - } + void undefineMacro(StringRef Name) { MacroMap.erase(Name); } - void defineMacro(StringRef Name, MCAsmMacro Macro) { - MacroMap.insert(std::make_pair(Name, std::move(Macro))); - } - - void undefineMacro(StringRef Name) { MacroMap.erase(Name); } - - MCPseudoProbeTable &getMCPseudoProbeTable() { return PseudoProbeTable; } - }; + MCPseudoProbeTable &getMCPseudoProbeTable() { return PseudoProbeTable; } +}; } // end namespace llvm diff --git a/llvm/include/llvm/MC/MCDwarf.h b/llvm/include/llvm/MC/MCDwarf.h --- a/llvm/include/llvm/MC/MCDwarf.h +++ b/llvm/include/llvm/MC/MCDwarf.h @@ -19,19 +19,19 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" -#include "llvm/MC/MCSection.h" #include "llvm/MC/StringTableBuilder.h" #include "llvm/Support/Error.h" #include "llvm/Support/MD5.h" #include #include #include -#include #include #include namespace llvm { +class MCSection; + template class ArrayRef; class MCAsmBackend; class MCContext; diff --git a/llvm/include/llvm/MC/MCELFStreamer.h b/llvm/include/llvm/MC/MCELFStreamer.h --- a/llvm/include/llvm/MC/MCELFStreamer.h +++ b/llvm/include/llvm/MC/MCELFStreamer.h @@ -10,12 +10,19 @@ #define LLVM_MC_MCELFSTREAMER_H #include "llvm/ADT/SmallVector.h" -#include "llvm/BinaryFormat/ELF.h" #include "llvm/MC/MCDirectives.h" #include "llvm/MC/MCObjectStreamer.h" namespace llvm { +class MCContext; +class MCDataFragment; +class MCFragment; +class MCObjectWriter; +class MCSection; +class MCSubtargetInfo; +class MCSymbol; +class MCSymbolRefExpr; class MCAsmBackend; class MCCodeEmitter; class MCExpr; diff --git a/llvm/include/llvm/MC/MCFragment.h b/llvm/include/llvm/MC/MCFragment.h --- a/llvm/include/llvm/MC/MCFragment.h +++ b/llvm/include/llvm/MC/MCFragment.h @@ -17,7 +17,6 @@ #include "llvm/MC/MCFixup.h" #include "llvm/MC/MCInst.h" #include "llvm/Support/Alignment.h" -#include "llvm/Support/Casting.h" #include "llvm/Support/SMLoc.h" #include #include diff --git a/llvm/include/llvm/MC/MCInstrAnalysis.h b/llvm/include/llvm/MC/MCInstrAnalysis.h --- a/llvm/include/llvm/MC/MCInstrAnalysis.h +++ b/llvm/include/llvm/MC/MCInstrAnalysis.h @@ -14,10 +14,13 @@ #ifndef LLVM_MC_MCINSTRANALYSIS_H #define LLVM_MC_MCINSTRANALYSIS_H +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/Optional.h" #include "llvm/MC/MCInst.h" #include "llvm/MC/MCInstrDesc.h" #include "llvm/MC/MCInstrInfo.h" #include +#include namespace llvm { diff --git a/llvm/include/llvm/MC/MCInstrDesc.h b/llvm/include/llvm/MC/MCInstrDesc.h --- a/llvm/include/llvm/MC/MCInstrDesc.h +++ b/llvm/include/llvm/MC/MCInstrDesc.h @@ -14,10 +14,11 @@ #ifndef LLVM_MC_MCINSTRDESC_H #define LLVM_MC_MCINSTRDESC_H -#include "llvm/MC/MCRegisterInfo.h" -#include "llvm/Support/DataTypes.h" +#include "llvm/ADT/iterator_range.h" +#include "llvm/MC/MCRegister.h" namespace llvm { +class MCRegisterInfo; class MCInst; diff --git a/llvm/include/llvm/MC/MCInstrInfo.h b/llvm/include/llvm/MC/MCInstrInfo.h --- a/llvm/include/llvm/MC/MCInstrInfo.h +++ b/llvm/include/llvm/MC/MCInstrInfo.h @@ -13,6 +13,7 @@ #ifndef LLVM_MC_MCINSTRINFO_H #define LLVM_MC_MCINSTRINFO_H +#include "llvm/ADT/StringRef.h" #include "llvm/MC/MCInstrDesc.h" #include diff --git a/llvm/include/llvm/MC/MCLinkerOptimizationHint.h b/llvm/include/llvm/MC/MCLinkerOptimizationHint.h --- a/llvm/include/llvm/MC/MCLinkerOptimizationHint.h +++ b/llvm/include/llvm/MC/MCLinkerOptimizationHint.h @@ -19,12 +19,12 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringSwitch.h" -#include "llvm/Support/raw_ostream.h" #include #include namespace llvm { +class raw_ostream; class MachObjectWriter; class MCAsmLayout; class MCSymbol; diff --git a/llvm/include/llvm/MC/MCObjectFileInfo.h b/llvm/include/llvm/MC/MCObjectFileInfo.h --- a/llvm/include/llvm/MC/MCObjectFileInfo.h +++ b/llvm/include/llvm/MC/MCObjectFileInfo.h @@ -13,13 +13,13 @@ #ifndef LLVM_MC_MCOBJECTFILEINFO_H #define LLVM_MC_MCOBJECTFILEINFO_H -#include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/Optional.h" #include "llvm/ADT/Triple.h" #include "llvm/BinaryFormat/Swift.h" -#include "llvm/MC/MCSymbol.h" -#include "llvm/Support/CodeGen.h" #include "llvm/Support/VersionTuple.h" +#include + namespace llvm { class MCContext; class MCSection; diff --git a/llvm/include/llvm/MC/MCObjectStreamer.h b/llvm/include/llvm/MC/MCObjectStreamer.h --- a/llvm/include/llvm/MC/MCObjectStreamer.h +++ b/llvm/include/llvm/MC/MCObjectStreamer.h @@ -11,11 +11,17 @@ #include "llvm/ADT/SetVector.h" #include "llvm/ADT/SmallVector.h" -#include "llvm/MC/MCAssembler.h" +#include "llvm/MC/MCFixup.h" +#include "llvm/MC/MCFragment.h" #include "llvm/MC/MCSection.h" #include "llvm/MC/MCStreamer.h" namespace llvm { +class MCContext; +class MCInst; +class MCObjectWriter; +class MCSymbol; +struct MCDwarfFrameInfo; class MCAssembler; class MCCodeEmitter; class MCSubtargetInfo; diff --git a/llvm/include/llvm/MC/MCPseudoProbe.h b/llvm/include/llvm/MC/MCPseudoProbe.h --- a/llvm/include/llvm/MC/MCPseudoProbe.h +++ b/llvm/include/llvm/MC/MCPseudoProbe.h @@ -82,7 +82,6 @@ void print(raw_ostream &OS); }; -class MCPseudoProbe; class MCDecodedPseudoProbe; // An inline frame has the form @@ -95,7 +94,6 @@ using AddressProbesMap = std::unordered_map>; -class MCPseudoProbeInlineTree; class MCDecodedPseudoProbeInlineTree; class MCPseudoProbeBase { diff --git a/llvm/include/llvm/MC/MCSectionELF.h b/llvm/include/llvm/MC/MCSectionELF.h --- a/llvm/include/llvm/MC/MCSectionELF.h +++ b/llvm/include/llvm/MC/MCSectionELF.h @@ -21,8 +21,6 @@ namespace llvm { -class MCSymbol; - /// This represents a section on linux, lots of unix variants and some bare /// metal systems. class MCSectionELF final : public MCSection { diff --git a/llvm/include/llvm/MC/MCStreamer.h b/llvm/include/llvm/MC/MCStreamer.h --- a/llvm/include/llvm/MC/MCStreamer.h +++ b/llvm/include/llvm/MC/MCStreamer.h @@ -13,22 +13,20 @@ #ifndef LLVM_MC_MCSTREAMER_H #define LLVM_MC_MCSTREAMER_H -#include "llvm/ADT/APInt.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" #include "llvm/MC/MCDirectives.h" +#include "llvm/MC/MCDwarf.h" #include "llvm/MC/MCLinkerOptimizationHint.h" #include "llvm/MC/MCPseudoProbe.h" -#include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCWinEH.h" +#include "llvm/Support/ARMTargetParser.h" #include "llvm/Support/Error.h" #include "llvm/Support/MD5.h" #include "llvm/Support/SMLoc.h" -#include "llvm/Support/ARMTargetParser.h" -#include "llvm/Support/TargetParser.h" #include "llvm/Support/VersionTuple.h" #include #include @@ -39,10 +37,14 @@ namespace llvm { +class APInt; +class MCAssembler; +class MCFragment; +class MCSymbol; +class Triple; class AssemblerConstantPools; class MCAsmBackend; class MCContext; -struct MCDwarfFrameInfo; class MCExpr; class MCInst; class MCInstPrinter; diff --git a/llvm/include/llvm/MC/MCSubtargetInfo.h b/llvm/include/llvm/MC/MCSubtargetInfo.h --- a/llvm/include/llvm/MC/MCSubtargetInfo.h +++ b/llvm/include/llvm/MC/MCSubtargetInfo.h @@ -14,12 +14,13 @@ #define LLVM_MC_MCSUBTARGETINFO_H #include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/Optional.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/Triple.h" #include "llvm/MC/MCInstrItineraries.h" #include "llvm/MC/MCSchedule.h" #include "llvm/MC/SubtargetFeature.h" -#include #include #include #include diff --git a/llvm/include/llvm/MC/MCSymbol.h b/llvm/include/llvm/MC/MCSymbol.h --- a/llvm/include/llvm/MC/MCSymbol.h +++ b/llvm/include/llvm/MC/MCSymbol.h @@ -14,7 +14,7 @@ #define LLVM_MC_MCSYMBOL_H #include "llvm/ADT/PointerIntPair.h" -#include "llvm/ADT/StringMap.h" +#include "llvm/ADT/StringMapEntry.h" #include "llvm/ADT/StringRef.h" #include "llvm/MC/MCExpr.h" #include "llvm/MC/MCFragment.h" diff --git a/llvm/include/llvm/MC/MCValue.h b/llvm/include/llvm/MC/MCValue.h --- a/llvm/include/llvm/MC/MCValue.h +++ b/llvm/include/llvm/MC/MCValue.h @@ -15,7 +15,6 @@ #include "llvm/MC/MCExpr.h" #include "llvm/Support/DataTypes.h" -#include namespace llvm { class raw_ostream; diff --git a/llvm/include/llvm/MC/SubtargetFeature.h b/llvm/include/llvm/MC/SubtargetFeature.h --- a/llvm/include/llvm/MC/SubtargetFeature.h +++ b/llvm/include/llvm/MC/SubtargetFeature.h @@ -17,11 +17,10 @@ #ifndef LLVM_MC_SUBTARGETFEATURE_H #define LLVM_MC_SUBTARGETFEATURE_H -#include "llvm/ADT/StringRef.h" #include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/StringRef.h" #include "llvm/Support/MathExtras.h" #include -#include #include #include #include diff --git a/llvm/include/llvm/MC/TargetRegistry.h b/llvm/include/llvm/MC/TargetRegistry.h --- a/llvm/include/llvm/MC/TargetRegistry.h +++ b/llvm/include/llvm/MC/TargetRegistry.h @@ -27,7 +27,6 @@ #include "llvm/Support/CodeGen.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FormattedStream.h" -#include #include #include #include @@ -56,7 +55,6 @@ class MCTargetOptions; class MCTargetStreamer; class raw_ostream; -class raw_pwrite_stream; class TargetMachine; class TargetOptions; namespace mca { diff --git a/llvm/include/llvm/Target/TargetLoweringObjectFile.h b/llvm/include/llvm/Target/TargetLoweringObjectFile.h --- a/llvm/include/llvm/Target/TargetLoweringObjectFile.h +++ b/llvm/include/llvm/Target/TargetLoweringObjectFile.h @@ -16,6 +16,7 @@ #include "llvm/MC/MCObjectFileInfo.h" #include "llvm/MC/MCRegister.h" +#include "llvm/Support/Alignment.h" #include namespace llvm { diff --git a/llvm/lib/CodeGen/LLVMTargetMachine.cpp b/llvm/lib/CodeGen/LLVMTargetMachine.cpp --- a/llvm/lib/CodeGen/LLVMTargetMachine.cpp +++ b/llvm/lib/CodeGen/LLVMTargetMachine.cpp @@ -23,6 +23,7 @@ #include "llvm/MC/MCContext.h" #include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCObjectWriter.h" +#include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/TargetRegistry.h" diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp --- a/llvm/lib/MC/ELFObjectWriter.cpp +++ b/llvm/lib/MC/ELFObjectWriter.cpp @@ -13,10 +13,10 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/STLExtras.h" -#include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/Twine.h" +#include "llvm/ADT/iterator.h" #include "llvm/BinaryFormat/ELF.h" #include "llvm/MC/MCAsmBackend.h" #include "llvm/MC/MCAsmInfo.h" @@ -28,18 +28,18 @@ #include "llvm/MC/MCFixup.h" #include "llvm/MC/MCFixupKindInfo.h" #include "llvm/MC/MCFragment.h" -#include "llvm/MC/MCObjectFileInfo.h" #include "llvm/MC/MCObjectWriter.h" #include "llvm/MC/MCSection.h" #include "llvm/MC/MCSectionELF.h" #include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCSymbolELF.h" +#include "llvm/MC/MCTargetOptions.h" #include "llvm/MC/MCValue.h" #include "llvm/MC/StringTableBuilder.h" #include "llvm/Support/Alignment.h" -#include "llvm/Support/Allocator.h" #include "llvm/Support/Casting.h" #include "llvm/Support/Compression.h" +#include "llvm/Support/Endian.h" #include "llvm/Support/EndianStream.h" #include "llvm/Support/Error.h" #include "llvm/Support/ErrorHandling.h" @@ -47,8 +47,6 @@ #include "llvm/Support/LEB128.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/SMLoc.h" -#include "llvm/Support/StringSaver.h" -#include "llvm/Support/SwapByteOrder.h" #include "llvm/Support/raw_ostream.h" #include #include diff --git a/llvm/lib/MC/MCAsmBackend.cpp b/llvm/lib/MC/MCAsmBackend.cpp --- a/llvm/lib/MC/MCAsmBackend.cpp +++ b/llvm/lib/MC/MCAsmBackend.cpp @@ -8,7 +8,7 @@ #include "llvm/MC/MCAsmBackend.h" #include "llvm/ADT/None.h" -#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/STLArrayExtras.h" #include "llvm/MC/MCELFObjectWriter.h" #include "llvm/MC/MCFixupKindInfo.h" #include "llvm/MC/MCMachObjectWriter.h" diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp --- a/llvm/lib/MC/MCAsmStreamer.cpp +++ b/llvm/lib/MC/MCAsmStreamer.cpp @@ -7,7 +7,6 @@ //===----------------------------------------------------------------------===// #include "llvm/ADT/Optional.h" -#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/Twine.h" @@ -31,13 +30,13 @@ #include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCSymbolXCOFF.h" #include "llvm/MC/TargetRegistry.h" +#include "llvm/Support/Casting.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/Format.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Support/LEB128.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/Path.h" -#include using namespace llvm; diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp --- a/llvm/lib/MC/MCAssembler.cpp +++ b/llvm/lib/MC/MCAssembler.cpp @@ -27,7 +27,6 @@ #include "llvm/MC/MCInst.h" #include "llvm/MC/MCObjectWriter.h" #include "llvm/MC/MCSection.h" -#include "llvm/MC/MCSectionELF.h" #include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCValue.h" #include "llvm/Support/Alignment.h" @@ -36,14 +35,16 @@ #include "llvm/Support/EndianStream.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/LEB128.h" -#include "llvm/Support/MathExtras.h" #include "llvm/Support/raw_ostream.h" #include #include -#include #include #include +namespace llvm { +class MCSubtargetInfo; +} + using namespace llvm; #define DEBUG_TYPE "assembler" diff --git a/llvm/lib/MC/MCCodeView.cpp b/llvm/lib/MC/MCCodeView.cpp --- a/llvm/lib/MC/MCCodeView.cpp +++ b/llvm/lib/MC/MCCodeView.cpp @@ -17,6 +17,7 @@ #include "llvm/DebugInfo/CodeView/Line.h" #include "llvm/DebugInfo/CodeView/SymbolRecord.h" #include "llvm/MC/MCAsmLayout.h" +#include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCObjectStreamer.h" #include "llvm/MC/MCValue.h" diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp --- a/llvm/lib/MC/MCContext.cpp +++ b/llvm/lib/MC/MCContext.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #include "llvm/MC/MCContext.h" +#include "llvm/ADT/DenseMapInfo.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h" @@ -15,14 +16,15 @@ #include "llvm/ADT/Twine.h" #include "llvm/BinaryFormat/COFF.h" #include "llvm/BinaryFormat/ELF.h" +#include "llvm/BinaryFormat/Wasm.h" #include "llvm/BinaryFormat/XCOFF.h" #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCCodeView.h" #include "llvm/MC/MCDwarf.h" #include "llvm/MC/MCExpr.h" #include "llvm/MC/MCFragment.h" +#include "llvm/MC/MCInst.h" #include "llvm/MC/MCLabel.h" -#include "llvm/MC/MCObjectFileInfo.h" #include "llvm/MC/MCSectionCOFF.h" #include "llvm/MC/MCSectionELF.h" #include "llvm/MC/MCSectionGOFF.h" @@ -30,6 +32,7 @@ #include "llvm/MC/MCSectionWasm.h" #include "llvm/MC/MCSectionXCOFF.h" #include "llvm/MC/MCStreamer.h" +#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCSymbolCOFF.h" #include "llvm/MC/MCSymbolELF.h" @@ -37,13 +40,14 @@ #include "llvm/MC/MCSymbolMachO.h" #include "llvm/MC/MCSymbolWasm.h" #include "llvm/MC/MCSymbolXCOFF.h" +#include "llvm/MC/MCTargetOptions.h" #include "llvm/MC/SectionKind.h" #include "llvm/Support/Casting.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Path.h" -#include "llvm/Support/Signals.h" +#include "llvm/Support/SMLoc.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Support/raw_ostream.h" #include diff --git a/llvm/lib/MC/MCExpr.cpp b/llvm/lib/MC/MCExpr.cpp --- a/llvm/lib/MC/MCExpr.cpp +++ b/llvm/lib/MC/MCExpr.cpp @@ -8,7 +8,6 @@ #include "llvm/MC/MCExpr.h" #include "llvm/ADT/Statistic.h" -#include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/Config/llvm-config.h" #include "llvm/MC/MCAsmBackend.h" diff --git a/llvm/lib/MC/MCInstPrinter.cpp b/llvm/lib/MC/MCInstPrinter.cpp --- a/llvm/lib/MC/MCInstPrinter.cpp +++ b/llvm/lib/MC/MCInstPrinter.cpp @@ -12,6 +12,7 @@ #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCInst.h" #include "llvm/MC/MCInstrInfo.h" +#include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCSubtargetInfo.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/Format.h" diff --git a/llvm/lib/MC/MCInstrAnalysis.cpp b/llvm/lib/MC/MCInstrAnalysis.cpp --- a/llvm/lib/MC/MCInstrAnalysis.cpp +++ b/llvm/lib/MC/MCInstrAnalysis.cpp @@ -9,11 +9,12 @@ #include "llvm/MC/MCInstrAnalysis.h" #include "llvm/ADT/APInt.h" -#include "llvm/MC/MCInst.h" -#include "llvm/MC/MCInstrDesc.h" -#include "llvm/MC/MCInstrInfo.h" #include +namespace llvm { +class MCSubtargetInfo; +} + using namespace llvm; bool MCInstrAnalysis::clearsSuperRegisters(const MCRegisterInfo &MRI, diff --git a/llvm/lib/MC/MCInstrDesc.cpp b/llvm/lib/MC/MCInstrDesc.cpp --- a/llvm/lib/MC/MCInstrDesc.cpp +++ b/llvm/lib/MC/MCInstrDesc.cpp @@ -14,7 +14,6 @@ #include "llvm/MC/MCInstrDesc.h" #include "llvm/MC/MCInst.h" #include "llvm/MC/MCRegisterInfo.h" -#include "llvm/MC/MCSubtargetInfo.h" using namespace llvm; diff --git a/llvm/lib/MC/MCMachOStreamer.cpp b/llvm/lib/MC/MCMachOStreamer.cpp --- a/llvm/lib/MC/MCMachOStreamer.cpp +++ b/llvm/lib/MC/MCMachOStreamer.cpp @@ -10,7 +10,6 @@ #include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" -#include "llvm/ADT/Triple.h" #include "llvm/MC/MCAsmBackend.h" #include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCCodeEmitter.h" @@ -19,17 +18,16 @@ #include "llvm/MC/MCExpr.h" #include "llvm/MC/MCFixup.h" #include "llvm/MC/MCFragment.h" -#include "llvm/MC/MCInst.h" #include "llvm/MC/MCLinkerOptimizationHint.h" #include "llvm/MC/MCObjectFileInfo.h" #include "llvm/MC/MCObjectStreamer.h" #include "llvm/MC/MCObjectWriter.h" #include "llvm/MC/MCSection.h" #include "llvm/MC/MCSectionMachO.h" -#include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCSymbolMachO.h" #include "llvm/MC/MCValue.h" +#include "llvm/MC/SectionKind.h" #include "llvm/MC/TargetRegistry.h" #include "llvm/Support/Casting.h" #include "llvm/Support/ErrorHandling.h" @@ -37,6 +35,13 @@ #include #include +namespace llvm { +class MCInst; +class MCStreamer; +class MCSubtargetInfo; +class Triple; +} // namespace llvm + using namespace llvm; namespace { diff --git a/llvm/lib/MC/MCNullStreamer.cpp b/llvm/lib/MC/MCNullStreamer.cpp --- a/llvm/lib/MC/MCNullStreamer.cpp +++ b/llvm/lib/MC/MCNullStreamer.cpp @@ -7,9 +7,15 @@ //===----------------------------------------------------------------------===// #include "llvm/ADT/StringRef.h" -#include "llvm/MC/MCInst.h" +#include "llvm/MC/MCDirectives.h" #include "llvm/MC/MCStreamer.h" -#include "llvm/MC/MCSymbol.h" +#include "llvm/Support/SMLoc.h" +namespace llvm { +class MCContext; +class MCExpr; +class MCSection; +class MCSymbol; +} // namespace llvm using namespace llvm; diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp --- a/llvm/lib/MC/MCObjectFileInfo.cpp +++ b/llvm/lib/MC/MCObjectFileInfo.cpp @@ -21,6 +21,7 @@ #include "llvm/MC/MCSectionMachO.h" #include "llvm/MC/MCSectionWasm.h" #include "llvm/MC/MCSectionXCOFF.h" +#include "llvm/Support/Casting.h" using namespace llvm; diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp --- a/llvm/lib/MC/MCObjectStreamer.cpp +++ b/llvm/lib/MC/MCObjectStreamer.cpp @@ -7,7 +7,6 @@ //===----------------------------------------------------------------------===// #include "llvm/MC/MCObjectStreamer.h" -#include "llvm/ADT/STLExtras.h" #include "llvm/MC/MCAsmBackend.h" #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCAssembler.h" diff --git a/llvm/lib/MC/MCObjectWriter.cpp b/llvm/lib/MC/MCObjectWriter.cpp --- a/llvm/lib/MC/MCObjectWriter.cpp +++ b/llvm/lib/MC/MCObjectWriter.cpp @@ -7,10 +7,12 @@ //===----------------------------------------------------------------------===// #include "llvm/MC/MCObjectWriter.h" -#include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCExpr.h" #include "llvm/MC/MCFragment.h" #include "llvm/MC/MCSymbol.h" +namespace llvm { +class MCSection; +} using namespace llvm; diff --git a/llvm/lib/MC/MCParser/COFFMasmParser.cpp b/llvm/lib/MC/MCParser/COFFMasmParser.cpp --- a/llvm/lib/MC/MCParser/COFFMasmParser.cpp +++ b/llvm/lib/MC/MCParser/COFFMasmParser.cpp @@ -22,6 +22,7 @@ #include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCSymbolCOFF.h" #include "llvm/MC/SectionKind.h" +#include "llvm/Support/Casting.h" #include "llvm/Support/SMLoc.h" #include #include diff --git a/llvm/lib/MC/MCParser/MCAsmParserExtension.cpp b/llvm/lib/MC/MCParser/MCAsmParserExtension.cpp --- a/llvm/lib/MC/MCParser/MCAsmParserExtension.cpp +++ b/llvm/lib/MC/MCParser/MCAsmParserExtension.cpp @@ -8,6 +8,7 @@ #include "llvm/MC/MCParser/MCAsmParserExtension.h" #include "llvm/MC/MCContext.h" +#include "llvm/MC/MCExpr.h" #include "llvm/MC/MCStreamer.h" using namespace llvm; diff --git a/llvm/lib/MC/MCParser/MasmParser.cpp b/llvm/lib/MC/MCParser/MasmParser.cpp --- a/llvm/lib/MC/MCParser/MasmParser.cpp +++ b/llvm/lib/MC/MCParser/MasmParser.cpp @@ -48,6 +48,7 @@ #include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCSection.h" #include "llvm/MC/MCStreamer.h" +#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCTargetOptions.h" #include "llvm/MC/MCValue.h" diff --git a/llvm/lib/MC/MCParser/WasmAsmParser.cpp b/llvm/lib/MC/MCParser/WasmAsmParser.cpp --- a/llvm/lib/MC/MCParser/WasmAsmParser.cpp +++ b/llvm/lib/MC/MCParser/WasmAsmParser.cpp @@ -25,6 +25,7 @@ #include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCSymbolWasm.h" +#include "llvm/Support/Casting.h" #include "llvm/Support/MachineValueType.h" using namespace llvm; diff --git a/llvm/lib/MC/MCPseudoProbe.cpp b/llvm/lib/MC/MCPseudoProbe.cpp --- a/llvm/lib/MC/MCPseudoProbe.cpp +++ b/llvm/lib/MC/MCPseudoProbe.cpp @@ -9,9 +9,10 @@ #include "llvm/MC/MCPseudoProbe.h" #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCContext.h" +#include "llvm/MC/MCExpr.h" +#include "llvm/MC/MCFragment.h" #include "llvm/MC/MCObjectFileInfo.h" #include "llvm/MC/MCObjectStreamer.h" -#include "llvm/MC/MCStreamer.h" #include "llvm/Support/Endian.h" #include "llvm/Support/LEB128.h" #include "llvm/Support/raw_ostream.h" diff --git a/llvm/lib/MC/MCSection.cpp b/llvm/lib/MC/MCSection.cpp --- a/llvm/lib/MC/MCSection.cpp +++ b/llvm/lib/MC/MCSection.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #include "llvm/MC/MCSection.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Config/llvm-config.h" #include "llvm/MC/MCContext.h" @@ -15,7 +16,6 @@ #include "llvm/Support/Compiler.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" -#include #include using namespace llvm; diff --git a/llvm/lib/MC/MCSectionMachO.cpp b/llvm/lib/MC/MCSectionMachO.cpp --- a/llvm/lib/MC/MCSectionMachO.cpp +++ b/llvm/lib/MC/MCSectionMachO.cpp @@ -7,9 +7,16 @@ //===----------------------------------------------------------------------===// #include "llvm/MC/MCSectionMachO.h" -#include "llvm/MC/MCContext.h" +#include "llvm/MC/SectionKind.h" #include "llvm/Support/raw_ostream.h" -#include + +namespace llvm { +class MCAsmInfo; +class MCExpr; +class MCSymbol; +class Triple; +} // namespace llvm + using namespace llvm; /// SectionTypeDescriptors - These are strings that describe the various section diff --git a/llvm/lib/MC/MCSectionWasm.cpp b/llvm/lib/MC/MCSectionWasm.cpp --- a/llvm/lib/MC/MCSectionWasm.cpp +++ b/llvm/lib/MC/MCSectionWasm.cpp @@ -9,7 +9,6 @@ #include "llvm/MC/MCSectionWasm.h" #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCExpr.h" -#include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCSymbolWasm.h" #include "llvm/Support/raw_ostream.h" diff --git a/llvm/lib/MC/MCSectionXCOFF.cpp b/llvm/lib/MC/MCSectionXCOFF.cpp --- a/llvm/lib/MC/MCSectionXCOFF.cpp +++ b/llvm/lib/MC/MCSectionXCOFF.cpp @@ -8,10 +8,13 @@ #include "llvm/MC/MCSectionXCOFF.h" #include "llvm/MC/MCAsmInfo.h" -#include "llvm/MC/MCExpr.h" #include "llvm/Support/Debug.h" #include "llvm/Support/Format.h" #include "llvm/Support/raw_ostream.h" +namespace llvm { +class MCExpr; +class Triple; +} // namespace llvm using namespace llvm; diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp --- a/llvm/lib/MC/MCStreamer.cpp +++ b/llvm/lib/MC/MCStreamer.cpp @@ -12,6 +12,7 @@ #include "llvm/ADT/StringRef.h" #include "llvm/ADT/Twine.h" #include "llvm/BinaryFormat/COFF.h" +#include "llvm/BinaryFormat/MachO.h" #include "llvm/DebugInfo/CodeView/SymbolRecord.h" #include "llvm/MC/MCAsmBackend.h" #include "llvm/MC/MCAsmInfo.h" diff --git a/llvm/lib/MC/MCSymbol.cpp b/llvm/lib/MC/MCSymbol.cpp --- a/llvm/lib/MC/MCSymbol.cpp +++ b/llvm/lib/MC/MCSymbol.cpp @@ -11,7 +11,6 @@ #include "llvm/Config/llvm-config.h" #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCContext.h" -#include "llvm/MC/MCExpr.h" #include "llvm/MC/MCFragment.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" diff --git a/llvm/lib/MC/MCSymbolELF.cpp b/llvm/lib/MC/MCSymbolELF.cpp --- a/llvm/lib/MC/MCSymbolELF.cpp +++ b/llvm/lib/MC/MCSymbolELF.cpp @@ -8,7 +8,6 @@ #include "llvm/MC/MCSymbolELF.h" #include "llvm/BinaryFormat/ELF.h" -#include "llvm/MC/MCFixupKindInfo.h" namespace llvm { diff --git a/llvm/lib/MC/MCWasmStreamer.cpp b/llvm/lib/MC/MCWasmStreamer.cpp --- a/llvm/lib/MC/MCWasmStreamer.cpp +++ b/llvm/lib/MC/MCWasmStreamer.cpp @@ -11,27 +11,31 @@ //===----------------------------------------------------------------------===// #include "llvm/MC/MCWasmStreamer.h" -#include "llvm/ADT/STLExtras.h" -#include "llvm/ADT/SmallPtrSet.h" +#include "llvm/ADT/SmallString.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/MC/MCAsmBackend.h" -#include "llvm/MC/MCAsmLayout.h" #include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCCodeEmitter.h" -#include "llvm/MC/MCContext.h" #include "llvm/MC/MCExpr.h" -#include "llvm/MC/MCInst.h" +#include "llvm/MC/MCFixup.h" +#include "llvm/MC/MCFragment.h" #include "llvm/MC/MCObjectStreamer.h" #include "llvm/MC/MCSection.h" #include "llvm/MC/MCSectionWasm.h" #include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCSymbolWasm.h" -#include "llvm/MC/MCValue.h" #include "llvm/MC/TargetRegistry.h" #include "llvm/Support/Casting.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" +namespace llvm { +class MCContext; +class MCStreamer; +class MCSubtargetInfo; +} // namespace llvm + using namespace llvm; MCWasmStreamer::~MCWasmStreamer() = default; // anchor. diff --git a/llvm/lib/MC/MCWin64EH.cpp b/llvm/lib/MC/MCWin64EH.cpp --- a/llvm/lib/MC/MCWin64EH.cpp +++ b/llvm/lib/MC/MCWin64EH.cpp @@ -10,12 +10,13 @@ #include "llvm/ADT/Twine.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCExpr.h" -#include "llvm/MC/MCObjectFileInfo.h" #include "llvm/MC/MCObjectStreamer.h" -#include "llvm/MC/MCSectionCOFF.h" #include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCSymbol.h" #include "llvm/Support/Win64EH.h" +namespace llvm { +class MCSection; +} using namespace llvm; diff --git a/llvm/lib/MC/MCWinCOFFStreamer.cpp b/llvm/lib/MC/MCWinCOFFStreamer.cpp --- a/llvm/lib/MC/MCWinCOFFStreamer.cpp +++ b/llvm/lib/MC/MCWinCOFFStreamer.cpp @@ -10,6 +10,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/MC/MCWinCOFFStreamer.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Triple.h" @@ -27,14 +28,12 @@ #include "llvm/MC/MCObjectWriter.h" #include "llvm/MC/MCSection.h" #include "llvm/MC/MCSymbolCOFF.h" -#include "llvm/MC/MCWinCOFFStreamer.h" #include "llvm/Support/Casting.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/SMLoc.h" #include "llvm/Support/raw_ostream.h" #include -#include #include using namespace llvm; diff --git a/llvm/lib/MC/MCWinEH.cpp b/llvm/lib/MC/MCWinEH.cpp --- a/llvm/lib/MC/MCWinEH.cpp +++ b/llvm/lib/MC/MCWinEH.cpp @@ -7,13 +7,6 @@ //===----------------------------------------------------------------------===// #include "llvm/MC/MCWinEH.h" -#include "llvm/ADT/StringRef.h" -#include "llvm/BinaryFormat/COFF.h" -#include "llvm/MC/MCContext.h" -#include "llvm/MC/MCObjectFileInfo.h" -#include "llvm/MC/MCSectionCOFF.h" -#include "llvm/MC/MCStreamer.h" -#include "llvm/MC/MCSymbol.h" namespace llvm { namespace WinEH { diff --git a/llvm/lib/MC/MCXCOFFStreamer.cpp b/llvm/lib/MC/MCXCOFFStreamer.cpp --- a/llvm/lib/MC/MCXCOFFStreamer.cpp +++ b/llvm/lib/MC/MCXCOFFStreamer.cpp @@ -13,12 +13,14 @@ #include "llvm/MC/MCXCOFFStreamer.h" #include "llvm/BinaryFormat/XCOFF.h" #include "llvm/MC/MCAsmBackend.h" +#include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCCodeEmitter.h" #include "llvm/MC/MCDirectives.h" #include "llvm/MC/MCObjectWriter.h" #include "llvm/MC/MCSectionXCOFF.h" #include "llvm/MC/MCSymbolXCOFF.h" #include "llvm/MC/TargetRegistry.h" +#include "llvm/Support/Casting.h" using namespace llvm; diff --git a/llvm/lib/MC/SubtargetFeature.cpp b/llvm/lib/MC/SubtargetFeature.cpp --- a/llvm/lib/MC/SubtargetFeature.cpp +++ b/llvm/lib/MC/SubtargetFeature.cpp @@ -20,10 +20,6 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #include -#include -#include -#include -#include #include #include diff --git a/llvm/lib/MC/WasmObjectWriter.cpp b/llvm/lib/MC/WasmObjectWriter.cpp --- a/llvm/lib/MC/WasmObjectWriter.cpp +++ b/llvm/lib/MC/WasmObjectWriter.cpp @@ -11,7 +11,6 @@ //===----------------------------------------------------------------------===// #include "llvm/ADT/STLExtras.h" -#include "llvm/ADT/SmallPtrSet.h" #include "llvm/BinaryFormat/Wasm.h" #include "llvm/BinaryFormat/WasmTraits.h" #include "llvm/Config/llvm-config.h" @@ -31,7 +30,6 @@ #include "llvm/Support/EndianStream.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/LEB128.h" -#include "llvm/Support/StringSaver.h" #include using namespace llvm; diff --git a/llvm/lib/MC/WinCOFFObjectWriter.cpp b/llvm/lib/MC/WinCOFFObjectWriter.cpp --- a/llvm/lib/MC/WinCOFFObjectWriter.cpp +++ b/llvm/lib/MC/WinCOFFObjectWriter.cpp @@ -41,7 +41,6 @@ #include "llvm/Support/raw_ostream.h" #include #include -#include #include #include #include diff --git a/llvm/lib/MC/XCOFFObjectWriter.cpp b/llvm/lib/MC/XCOFFObjectWriter.cpp --- a/llvm/lib/MC/XCOFFObjectWriter.cpp +++ b/llvm/lib/MC/XCOFFObjectWriter.cpp @@ -22,8 +22,9 @@ #include "llvm/MC/MCValue.h" #include "llvm/MC/MCXCOFFObjectWriter.h" #include "llvm/MC/StringTableBuilder.h" +#include "llvm/Support/Casting.h" #include "llvm/Support/EndianStream.h" -#include "llvm/Support/Error.h" +#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/MathExtras.h" #include diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp --- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp +++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp @@ -22,6 +22,7 @@ #include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCSectionELF.h" #include "llvm/MC/MCSectionMachO.h" +#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/MCTargetOptions.h" #include "llvm/MC/MCValue.h" #include "llvm/MC/TargetRegistry.h" diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCCodeEmitter.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCCodeEmitter.cpp --- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCCodeEmitter.cpp +++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCCodeEmitter.cpp @@ -16,6 +16,7 @@ #include "Utils/AArch64BaseInfo.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" +#include "llvm/BinaryFormat/ELF.h" #include "llvm/MC/MCCodeEmitter.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCFixup.h" diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.cpp --- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.cpp +++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.cpp @@ -17,6 +17,7 @@ #include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCSymbolELF.h" #include "llvm/MC/MCValue.h" +#include "llvm/Support/Casting.h" #include "llvm/Support/ErrorHandling.h" using namespace llvm; diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFObjectWriter.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFObjectWriter.cpp --- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFObjectWriter.cpp +++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFObjectWriter.cpp @@ -19,6 +19,7 @@ #include "llvm/MC/MCObjectWriter.h" #include "llvm/MC/MCValue.h" #include "llvm/MC/MCWinCOFFObjectWriter.h" +#include "llvm/Support/Casting.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" #include diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFStreamer.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFStreamer.cpp --- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFStreamer.cpp +++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFStreamer.cpp @@ -8,6 +8,7 @@ #include "AArch64WinCOFFStreamer.h" #include "llvm/MC/MCAsmBackend.h" +#include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCCodeEmitter.h" #include "llvm/MC/MCObjectWriter.h" #include "llvm/MC/MCWin64EH.h" diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp --- a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp @@ -27,6 +27,7 @@ #include "SIMachineFunctionInfo.h" #include "TargetInfo/AMDGPUTargetInfo.h" #include "Utils/AMDGPUBaseInfo.h" +#include "llvm/BinaryFormat/ELF.h" #include "llvm/IR/DiagnosticInfo.h" #include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCContext.h" @@ -34,6 +35,7 @@ #include "llvm/MC/MCStreamer.h" #include "llvm/MC/TargetRegistry.h" #include "llvm/Support/AMDHSAKernelDescriptor.h" +#include "llvm/Support/TargetParser.h" #include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetMachine.h" diff --git a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp --- a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp +++ b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp @@ -20,6 +20,7 @@ #include "llvm/ADT/SmallBitVector.h" #include "llvm/ADT/StringSet.h" #include "llvm/ADT/Twine.h" +#include "llvm/BinaryFormat/ELF.h" #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCExpr.h" diff --git a/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp b/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp --- a/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp +++ b/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp @@ -21,12 +21,15 @@ #include "TargetInfo/AMDGPUTargetInfo.h" #include "Utils/AMDGPUBaseInfo.h" #include "llvm-c/DisassemblerTypes.h" +#include "llvm/BinaryFormat/ELF.h" #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCExpr.h" #include "llvm/MC/MCFixedLenDisassembler.h" -#include "llvm/MC/TargetRegistry.h" #include "llvm/MC/MCInstrDesc.h" +#include "llvm/MC/MCRegisterInfo.h" +#include "llvm/MC/MCSubtargetInfo.h" +#include "llvm/MC/TargetRegistry.h" #include "llvm/Support/AMDHSAKernelDescriptor.h" using namespace llvm; diff --git a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUAsmBackend.cpp b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUAsmBackend.cpp --- a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUAsmBackend.cpp +++ b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUAsmBackend.cpp @@ -10,13 +10,16 @@ #include "MCTargetDesc/AMDGPUFixupKinds.h" #include "MCTargetDesc/AMDGPUMCTargetDesc.h" #include "Utils/AMDGPUBaseInfo.h" +#include "llvm/BinaryFormat/ELF.h" #include "llvm/MC/MCAsmBackend.h" #include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCFixupKindInfo.h" #include "llvm/MC/MCObjectWriter.h" +#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/TargetRegistry.h" #include "llvm/Support/EndianStream.h" +#include "llvm/Support/TargetParser.h" using namespace llvm; using namespace llvm::AMDGPU; diff --git a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.cpp b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.cpp --- a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.cpp +++ b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.cpp @@ -19,6 +19,7 @@ #include "R600InstPrinter.h" #include "R600MCTargetDesc.h" #include "TargetInfo/AMDGPUTargetInfo.h" +#include "llvm/MC/LaneBitmask.h" #include "llvm/MC/MCAsmBackend.h" #include "llvm/MC/MCCodeEmitter.h" #include "llvm/MC/MCELFStreamer.h" @@ -27,6 +28,7 @@ #include "llvm/MC/MCInstrDesc.h" #include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCObjectWriter.h" +#include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/TargetRegistry.h" diff --git a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp --- a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp +++ b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp @@ -17,12 +17,16 @@ #include "Utils/AMDKernelCodeTUtils.h" #include "llvm/BinaryFormat/AMDGPUMetadataVerifier.h" #include "llvm/BinaryFormat/ELF.h" +#include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCELFStreamer.h" #include "llvm/MC/MCSectionELF.h" +#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/Support/AMDGPUMetadata.h" #include "llvm/Support/AMDHSAKernelDescriptor.h" +#include "llvm/Support/Casting.h" #include "llvm/Support/FormattedStream.h" +#include "llvm/Support/TargetParser.h" using namespace llvm; using namespace llvm::AMDGPU; diff --git a/llvm/lib/Target/AMDGPU/MCTargetDesc/R600MCCodeEmitter.cpp b/llvm/lib/Target/AMDGPU/MCTargetDesc/R600MCCodeEmitter.cpp --- a/llvm/lib/Target/AMDGPU/MCTargetDesc/R600MCCodeEmitter.cpp +++ b/llvm/lib/Target/AMDGPU/MCTargetDesc/R600MCCodeEmitter.cpp @@ -20,6 +20,7 @@ #include "llvm/MC/MCInst.h" #include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCRegisterInfo.h" +#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/SubtargetFeature.h" #include "llvm/Support/EndianStream.h" diff --git a/llvm/lib/Target/AMDGPU/MCTargetDesc/SIMCCodeEmitter.cpp b/llvm/lib/Target/AMDGPU/MCTargetDesc/SIMCCodeEmitter.cpp --- a/llvm/lib/Target/AMDGPU/MCTargetDesc/SIMCCodeEmitter.cpp +++ b/llvm/lib/Target/AMDGPU/MCTargetDesc/SIMCCodeEmitter.cpp @@ -21,6 +21,9 @@ #include "llvm/MC/MCExpr.h" #include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCRegisterInfo.h" +#include "llvm/MC/MCSubtargetInfo.h" +#include "llvm/MC/SubtargetFeature.h" +#include "llvm/Support/Casting.h" using namespace llvm; diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMWinCOFFStreamer.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMWinCOFFStreamer.cpp --- a/llvm/lib/Target/ARM/MCTargetDesc/ARMWinCOFFStreamer.cpp +++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMWinCOFFStreamer.cpp @@ -8,6 +8,7 @@ #include "ARMMCTargetDesc.h" #include "llvm/MC/MCAsmBackend.h" +#include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCCodeEmitter.h" #include "llvm/MC/MCObjectWriter.h" #include "llvm/MC/MCWinCOFFStreamer.h" diff --git a/llvm/lib/Target/AVR/MCTargetDesc/AVRELFStreamer.cpp b/llvm/lib/Target/AVR/MCTargetDesc/AVRELFStreamer.cpp --- a/llvm/lib/Target/AVR/MCTargetDesc/AVRELFStreamer.cpp +++ b/llvm/lib/Target/AVR/MCTargetDesc/AVRELFStreamer.cpp @@ -1,6 +1,7 @@ #include "AVRELFStreamer.h" #include "llvm/BinaryFormat/ELF.h" +#include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/SubtargetFeature.h" #include "llvm/Support/FormattedStream.h" diff --git a/llvm/lib/Target/BPF/Disassembler/BPFDisassembler.cpp b/llvm/lib/Target/BPF/Disassembler/BPFDisassembler.cpp --- a/llvm/lib/Target/BPF/Disassembler/BPFDisassembler.cpp +++ b/llvm/lib/Target/BPF/Disassembler/BPFDisassembler.cpp @@ -18,6 +18,7 @@ #include "llvm/MC/MCDisassembler/MCDisassembler.h" #include "llvm/MC/MCFixedLenDisassembler.h" #include "llvm/MC/MCInst.h" +#include "llvm/MC/SubtargetFeature.h" #include "llvm/MC/TargetRegistry.h" #include "llvm/Support/MathExtras.h" #include diff --git a/llvm/lib/Target/BPF/MCTargetDesc/BPFInstPrinter.cpp b/llvm/lib/Target/BPF/MCTargetDesc/BPFInstPrinter.cpp --- a/llvm/lib/Target/BPF/MCTargetDesc/BPFInstPrinter.cpp +++ b/llvm/lib/Target/BPF/MCTargetDesc/BPFInstPrinter.cpp @@ -15,6 +15,7 @@ #include "llvm/MC/MCExpr.h" #include "llvm/MC/MCInst.h" #include "llvm/MC/MCSymbol.h" +#include "llvm/Support/Casting.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FormattedStream.h" using namespace llvm; diff --git a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonAsmBackend.cpp b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonAsmBackend.cpp --- a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonAsmBackend.cpp +++ b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonAsmBackend.cpp @@ -21,6 +21,7 @@ #include "llvm/MC/MCFixupKindInfo.h" #include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCObjectWriter.h" +#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/TargetRegistry.h" #include "llvm/Support/Debug.h" #include "llvm/Support/EndianStream.h" diff --git a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCChecker.cpp b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCChecker.cpp --- a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCChecker.cpp +++ b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCChecker.cpp @@ -22,6 +22,7 @@ #include "llvm/MC/MCInst.h" #include "llvm/MC/MCInstrDesc.h" #include "llvm/MC/MCRegisterInfo.h" +#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/SourceMgr.h" #include diff --git a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCExpr.cpp b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCExpr.cpp --- a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCExpr.cpp +++ b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCExpr.cpp @@ -13,6 +13,7 @@ #include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCSymbolELF.h" #include "llvm/MC/MCValue.h" +#include "llvm/Support/Casting.h" #include "llvm/Support/raw_ostream.h" using namespace llvm; diff --git a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp --- a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp +++ b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp @@ -22,6 +22,7 @@ #include "llvm/ADT/StringRef.h" #include "llvm/BinaryFormat/ELF.h" #include "llvm/MC/MCAsmBackend.h" +#include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCCodeEmitter.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCDwarf.h" diff --git a/llvm/lib/Target/MSP430/MCTargetDesc/MSP430ELFStreamer.cpp b/llvm/lib/Target/MSP430/MCTargetDesc/MSP430ELFStreamer.cpp --- a/llvm/lib/Target/MSP430/MCTargetDesc/MSP430ELFStreamer.cpp +++ b/llvm/lib/Target/MSP430/MCTargetDesc/MSP430ELFStreamer.cpp @@ -12,6 +12,7 @@ #include "MSP430MCTargetDesc.h" #include "llvm/BinaryFormat/ELF.h" +#include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCELFStreamer.h" #include "llvm/MC/MCSectionELF.h" diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp --- a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp +++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp @@ -11,17 +11,19 @@ //===----------------------------------------------------------------------===// #include "MipsTargetStreamer.h" -#include "MipsInstPrinter.h" #include "MCTargetDesc/MipsABIInfo.h" #include "MipsELFStreamer.h" +#include "MipsInstPrinter.h" #include "MipsMCExpr.h" #include "MipsMCTargetDesc.h" #include "MipsTargetObjectFile.h" #include "llvm/BinaryFormat/ELF.h" +#include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCSectionELF.h" #include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/MCSymbolELF.h" +#include "llvm/Support/Casting.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FormattedStream.h" diff --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCXCOFFStreamer.cpp b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCXCOFFStreamer.cpp --- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCXCOFFStreamer.cpp +++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCXCOFFStreamer.cpp @@ -21,6 +21,7 @@ #include "PPCMCCodeEmitter.h" #include "llvm/BinaryFormat/XCOFF.h" #include "llvm/MC/MCAsmBackend.h" +#include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCCodeEmitter.h" #include "llvm/MC/MCDirectives.h" #include "llvm/MC/MCObjectWriter.h" diff --git a/llvm/lib/Target/PowerPC/PPCTargetStreamer.h b/llvm/lib/Target/PowerPC/PPCTargetStreamer.h --- a/llvm/lib/Target/PowerPC/PPCTargetStreamer.h +++ b/llvm/lib/Target/PowerPC/PPCTargetStreamer.h @@ -10,6 +10,7 @@ #define LLVM_LIB_TARGET_POWERPC_PPCTARGETSTREAMER_H #include "llvm/ADT/StringRef.h" +#include "llvm/MC/MCExpr.h" #include "llvm/MC/MCStreamer.h" namespace llvm { diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp --- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp +++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp @@ -16,12 +16,14 @@ #include "RISCVMCTargetDesc.h" #include "llvm/BinaryFormat/ELF.h" #include "llvm/MC/MCAsmBackend.h" +#include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCCodeEmitter.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCObjectWriter.h" #include "llvm/MC/MCSectionELF.h" #include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/MCValue.h" +#include "llvm/Support/Casting.h" #include "llvm/Support/LEB128.h" #include "llvm/Support/RISCVAttributes.h" diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp --- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp +++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp @@ -23,6 +23,7 @@ #include "llvm/MC/MCInstBuilder.h" #include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCRegisterInfo.h" +#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/MCSymbol.h" #include "llvm/Support/Casting.h" #include "llvm/Support/EndianStream.h" diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp --- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp +++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp @@ -21,6 +21,7 @@ #include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCSymbolELF.h" #include "llvm/MC/MCValue.h" +#include "llvm/Support/Casting.h" #include "llvm/Support/ErrorHandling.h" using namespace llvm; diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCObjectFileInfo.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCObjectFileInfo.cpp --- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCObjectFileInfo.cpp +++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCObjectFileInfo.cpp @@ -13,6 +13,7 @@ #include "RISCVMCObjectFileInfo.h" #include "RISCVMCTargetDesc.h" #include "llvm/MC/MCContext.h" +#include "llvm/MC/MCSubtargetInfo.h" using namespace llvm; diff --git a/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCExpr.cpp b/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCExpr.cpp --- a/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCExpr.cpp +++ b/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCExpr.cpp @@ -17,6 +17,7 @@ #include "llvm/MC/MCContext.h" #include "llvm/MC/MCObjectStreamer.h" #include "llvm/MC/MCSymbolELF.h" +#include "llvm/Support/Casting.h" using namespace llvm; diff --git a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.cpp b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.cpp --- a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.cpp +++ b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.cpp @@ -13,6 +13,7 @@ #include "TargetInfo/SystemZTargetInfo.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCDwarf.h" +#include "llvm/MC/MCInst.h" #include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCStreamer.h" diff --git a/llvm/lib/Target/SystemZ/SystemZTargetStreamer.h b/llvm/lib/Target/SystemZ/SystemZTargetStreamer.h --- a/llvm/lib/Target/SystemZ/SystemZTargetStreamer.h +++ b/llvm/lib/Target/SystemZ/SystemZTargetStreamer.h @@ -10,6 +10,7 @@ #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZTARGETSTREAMER_H #include "llvm/ADT/StringRef.h" +#include "llvm/MC/MCInst.h" #include "llvm/MC/MCStreamer.h" namespace llvm { diff --git a/llvm/lib/Target/TargetMachine.cpp b/llvm/lib/Target/TargetMachine.cpp --- a/llvm/lib/Target/TargetMachine.cpp +++ b/llvm/lib/Target/TargetMachine.cpp @@ -21,7 +21,9 @@ #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCInstrInfo.h" +#include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCSectionMachO.h" +#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/MCTargetOptions.h" #include "llvm/MC/SectionKind.h" #include "llvm/Target/TargetLoweringObjectFile.h" diff --git a/llvm/lib/Target/VE/MCTargetDesc/VEMCExpr.cpp b/llvm/lib/Target/VE/MCTargetDesc/VEMCExpr.cpp --- a/llvm/lib/Target/VE/MCTargetDesc/VEMCExpr.cpp +++ b/llvm/lib/Target/VE/MCTargetDesc/VEMCExpr.cpp @@ -18,6 +18,7 @@ #include "llvm/MC/MCObjectStreamer.h" #include "llvm/MC/MCSymbolELF.h" #include "llvm/MC/MCValue.h" +#include "llvm/Support/Casting.h" using namespace llvm; diff --git a/llvm/lib/Target/X86/AsmParser/X86Operand.h b/llvm/lib/Target/X86/AsmParser/X86Operand.h --- a/llvm/lib/Target/X86/AsmParser/X86Operand.h +++ b/llvm/lib/Target/X86/AsmParser/X86Operand.h @@ -17,6 +17,8 @@ #include "llvm/MC/MCExpr.h" #include "llvm/MC/MCInst.h" #include "llvm/MC/MCParser/MCParsedAsmOperand.h" +#include "llvm/MC/MCRegisterInfo.h" +#include "llvm/MC/MCSymbol.h" #include "llvm/Support/Casting.h" #include "llvm/Support/SMLoc.h" #include diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp --- a/llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp +++ b/llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp @@ -24,6 +24,7 @@ #include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/MCSymbol.h" +#include "llvm/Support/Casting.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" #include diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86MCExpr.h b/llvm/lib/Target/X86/MCTargetDesc/X86MCExpr.h --- a/llvm/lib/Target/X86/MCTargetDesc/X86MCExpr.h +++ b/llvm/lib/Target/X86/MCTargetDesc/X86MCExpr.h @@ -18,6 +18,7 @@ #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCExpr.h" +#include "llvm/Support/Casting.h" #include "llvm/Support/ErrorHandling.h" namespace llvm { diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFStreamer.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFStreamer.cpp --- a/llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFStreamer.cpp +++ b/llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFStreamer.cpp @@ -9,6 +9,7 @@ #include "X86MCTargetDesc.h" #include "X86TargetStreamer.h" #include "llvm/MC/MCAsmBackend.h" +#include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCCodeEmitter.h" #include "llvm/MC/MCObjectWriter.h" #include "llvm/MC/MCWin64EH.h" diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFTargetStreamer.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFTargetStreamer.cpp --- a/llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFTargetStreamer.cpp +++ b/llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFTargetStreamer.cpp @@ -14,6 +14,7 @@ #include "llvm/MC/MCInstPrinter.h" #include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCSubtargetInfo.h" +#include "llvm/MC/MCSymbol.h" #include "llvm/Support/FormattedStream.h" using namespace llvm; diff --git a/llvm/tools/dsymutil/MachOUtils.cpp b/llvm/tools/dsymutil/MachOUtils.cpp --- a/llvm/tools/dsymutil/MachOUtils.cpp +++ b/llvm/tools/dsymutil/MachOUtils.cpp @@ -12,10 +12,12 @@ #include "LinkUtils.h" #include "llvm/CodeGen/NonRelocatableStringpool.h" #include "llvm/MC/MCAsmLayout.h" +#include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCMachObjectWriter.h" #include "llvm/MC/MCObjectStreamer.h" #include "llvm/MC/MCSectionMachO.h" #include "llvm/MC/MCStreamer.h" +#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/Object/MachO.h" #include "llvm/Support/FileUtilities.h" #include "llvm/Support/Program.h" diff --git a/llvm/tools/dsymutil/dsymutil.cpp b/llvm/tools/dsymutil/dsymutil.cpp --- a/llvm/tools/dsymutil/dsymutil.cpp +++ b/llvm/tools/dsymutil/dsymutil.cpp @@ -26,6 +26,7 @@ #include "llvm/DebugInfo/DIContext.h" #include "llvm/DebugInfo/DWARF/DWARFContext.h" #include "llvm/DebugInfo/DWARF/DWARFVerifier.h" +#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/Object/Binary.h" #include "llvm/Object/MachO.h" #include "llvm/Option/Arg.h" diff --git a/llvm/tools/llvm-dwp/llvm-dwp.cpp b/llvm/tools/llvm-dwp/llvm-dwp.cpp --- a/llvm/tools/llvm-dwp/llvm-dwp.cpp +++ b/llvm/tools/llvm-dwp/llvm-dwp.cpp @@ -19,6 +19,8 @@ #include "llvm/MC/MCContext.h" #include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCObjectWriter.h" +#include "llvm/MC/MCRegisterInfo.h" +#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/MCTargetOptionsCommandFlags.h" #include "llvm/MC/TargetRegistry.h" #include "llvm/Support/CommandLine.h" diff --git a/llvm/tools/llvm-ml/llvm-ml.cpp b/llvm/tools/llvm-ml/llvm-ml.cpp --- a/llvm/tools/llvm-ml/llvm-ml.cpp +++ b/llvm/tools/llvm-ml/llvm-ml.cpp @@ -24,6 +24,7 @@ #include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCSubtargetInfo.h" +#include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCTargetOptionsCommandFlags.h" #include "llvm/MC/TargetRegistry.h" #include "llvm/Option/Arg.h" diff --git a/llvm/unittests/CodeGen/AsmPrinterDwarfTest.cpp b/llvm/unittests/CodeGen/AsmPrinterDwarfTest.cpp --- a/llvm/unittests/CodeGen/AsmPrinterDwarfTest.cpp +++ b/llvm/unittests/CodeGen/AsmPrinterDwarfTest.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #include "TestAsmPrinter.h" +#include "llvm/BinaryFormat/ELF.h" #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/IR/LegacyPassManager.h" diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFExpressionCompactPrinterTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFExpressionCompactPrinterTest.cpp --- a/llvm/unittests/DebugInfo/DWARF/DWARFExpressionCompactPrinterTest.cpp +++ b/llvm/unittests/DebugInfo/DWARF/DWARFExpressionCompactPrinterTest.cpp @@ -12,6 +12,7 @@ #include "llvm/DebugInfo/DWARF/DWARFDie.h" #include "llvm/DebugInfo/DWARF/DWARFExpression.h" #include "llvm/MC/MCInstrInfo.h" +#include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/TargetRegistry.h" #include "llvm/Support/DataExtractor.h" #include "llvm/Support/TargetSelect.h" diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp --- a/llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp +++ b/llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp @@ -19,7 +19,9 @@ #include "llvm/MC/MCContext.h" #include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCObjectWriter.h" +#include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCStreamer.h" +#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/MCTargetOptions.h" #include "llvm/MC/TargetRegistry.h" #include "llvm/Object/Binary.h" diff --git a/llvm/unittests/MC/DwarfLineTableHeaders.cpp b/llvm/unittests/MC/DwarfLineTableHeaders.cpp --- a/llvm/unittests/MC/DwarfLineTableHeaders.cpp +++ b/llvm/unittests/MC/DwarfLineTableHeaders.cpp @@ -10,6 +10,7 @@ #include "llvm/BinaryFormat/Dwarf.h" #include "llvm/MC/MCAsmBackend.h" #include "llvm/MC/MCAsmInfo.h" +#include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCCodeEmitter.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCDwarf.h" @@ -18,6 +19,7 @@ #include "llvm/MC/MCObjectWriter.h" #include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCStreamer.h" +#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/MCTargetOptions.h" #include "llvm/MC/TargetRegistry.h" #include "llvm/Object/Binary.h" diff --git a/llvm/unittests/MC/MCInstPrinter.cpp b/llvm/unittests/MC/MCInstPrinter.cpp --- a/llvm/unittests/MC/MCInstPrinter.cpp +++ b/llvm/unittests/MC/MCInstPrinter.cpp @@ -9,6 +9,7 @@ #include "llvm/MC/MCInstPrinter.h" #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCInstrInfo.h" +#include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCTargetOptions.h" #include "llvm/MC/TargetRegistry.h" #include "llvm/Support/TargetSelect.h" diff --git a/llvm/unittests/MC/SystemZ/SystemZAsmLexerTest.cpp b/llvm/unittests/MC/SystemZ/SystemZAsmLexerTest.cpp --- a/llvm/unittests/MC/SystemZ/SystemZAsmLexerTest.cpp +++ b/llvm/unittests/MC/SystemZ/SystemZAsmLexerTest.cpp @@ -11,6 +11,8 @@ #include "llvm/MC/MCParser/MCTargetAsmParser.h" #include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCStreamer.h" +#include "llvm/MC/MCSubtargetInfo.h" +#include "llvm/MC/MCSymbol.h" #include "llvm/MC/TargetRegistry.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/SourceMgr.h" diff --git a/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp b/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp --- a/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp +++ b/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp @@ -2402,6 +2402,8 @@ void FixedLenDecoderEmitter::run(raw_ostream &o) { formatted_raw_ostream OS(o); OS << "#include \"llvm/MC/MCInst.h\"\n"; + OS << "#include \"llvm/MC/SubtargetFeature.h\"\n"; + OS << "#include \"llvm/MC/MCSubtargetInfo.h\"\n"; OS << "#include \"llvm/Support/DataTypes.h\"\n"; OS << "#include \"llvm/Support/Debug.h\"\n"; OS << "#include \"llvm/Support/LEB128.h\"\n";