aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/MC/MCContext.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/MC/MCContext.h')
-rw-r--r--include/llvm/MC/MCContext.h54
1 files changed, 33 insertions, 21 deletions
diff --git a/include/llvm/MC/MCContext.h b/include/llvm/MC/MCContext.h
index 3b8ac8b79e21..5c2124cc0d15 100644
--- a/include/llvm/MC/MCContext.h
+++ b/include/llvm/MC/MCContext.h
@@ -1,9 +1,8 @@
//===- MCContext.h - Machine Code Context -----------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -19,6 +18,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/BinaryFormat/Dwarf.h"
+#include "llvm/BinaryFormat/XCOFF.h"
#include "llvm/MC/MCAsmMacro.h"
#include "llvm/MC/MCDwarf.h"
#include "llvm/MC/MCSubtargetInfo.h"
@@ -50,6 +50,7 @@ namespace llvm {
class MCSectionELF;
class MCSectionMachO;
class MCSectionWasm;
+ class MCSectionXCOFF;
class MCStreamer;
class MCSymbol;
class MCSymbolELF;
@@ -92,6 +93,7 @@ namespace llvm {
SpecificBumpPtrAllocator<MCSectionELF> ELFAllocator;
SpecificBumpPtrAllocator<MCSectionMachO> MachOAllocator;
SpecificBumpPtrAllocator<MCSectionWasm> WasmAllocator;
+ SpecificBumpPtrAllocator<MCSectionXCOFF> XCOFFAllocator;
/// Bindings of names to symbols.
SymbolTable Symbols;
@@ -247,10 +249,25 @@ namespace llvm {
}
};
+ struct XCOFFSectionKey {
+ std::string SectionName;
+ XCOFF::StorageMappingClass MappingClass;
+
+ XCOFFSectionKey(StringRef SectionName,
+ XCOFF::StorageMappingClass MappingClass)
+ : SectionName(SectionName), MappingClass(MappingClass) {}
+
+ bool operator<(const XCOFFSectionKey &Other) const {
+ return std::tie(SectionName, MappingClass) <
+ std::tie(Other.SectionName, Other.MappingClass);
+ }
+ };
+
StringMap<MCSectionMachO *> MachOUniquingMap;
std::map<ELFSectionKey, MCSectionELF *> ELFUniquingMap;
std::map<COFFSectionKey, MCSectionCOFF *> COFFUniquingMap;
std::map<WasmSectionKey, MCSectionWasm *> WasmUniquingMap;
+ std::map<XCOFFSectionKey, MCSectionXCOFF *> XCOFFUniquingMap;
StringMap<bool> RelSecNames;
SpecificBumpPtrAllocator<MCSubtargetInfo> MCSubtargetAllocator;
@@ -441,8 +458,6 @@ namespace llvm {
SectionKind Kind,
const char *BeginSymName = nullptr);
- MCSectionCOFF *getCOFFSection(StringRef Section);
-
/// 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
@@ -473,6 +488,11 @@ namespace llvm {
const MCSymbolWasm *Group, unsigned UniqueID,
const char *BeginSymName);
+ MCSectionXCOFF *getXCOFFSection(StringRef Section,
+ XCOFF::StorageMappingClass MappingClass,
+ SectionKind K,
+ const char *BeginSymName = nullptr);
+
// Create and save a copy of STI and return a reference to the copy.
MCSubtargetInfo &getSubtargetCopy(const MCSubtargetInfo &STI);
@@ -489,12 +509,6 @@ namespace llvm {
/// Set the compilation directory for DW_AT_comp_dir
void setCompilationDir(StringRef S) { CompilationDir = S.str(); }
- /// Get the debug prefix map.
- const std::map<const std::string, const std::string> &
- getDebugPrefixMap() const {
- return DebugPrefixMap;
- }
-
/// Add an entry to the debug prefix map.
void addDebugPrefixMapEntry(const std::string &From, const std::string &To);
@@ -512,7 +526,7 @@ namespace llvm {
/// Creates an entry in the dwarf file and directory tables.
Expected<unsigned> getDwarfFile(StringRef Directory, StringRef FileName,
unsigned FileNumber,
- MD5::MD5Result *Checksum,
+ Optional<MD5::MD5Result> Checksum,
Optional<StringRef> Source, unsigned CUID);
bool isValidDwarfFileNumber(unsigned FileNumber, unsigned CUID = 0);
@@ -539,13 +553,6 @@ namespace llvm {
return getMCDwarfLineTable(CUID).getMCDwarfDirs();
}
- bool hasMCLineSections() const {
- for (const auto &Table : MCDwarfLineTablesCUMap)
- if (!Table.second.getMCDwarfFiles().empty() || Table.second.getLabel())
- return true;
- return false;
- }
-
unsigned getDwarfCompileUnitID() { return DwarfCompileUnitID; }
void setDwarfCompileUnitID(unsigned CUIndex) {
@@ -555,7 +562,8 @@ namespace llvm {
/// 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, MD5::MD5Result *Checksum,
+ StringRef Filename,
+ Optional<MD5::MD5Result> Checksum,
Optional<StringRef> Source) {
getMCDwarfLineTable(CUID).setRootFile(CompilationDir, Filename, Checksum,
Source);
@@ -595,6 +603,10 @@ namespace llvm {
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);
+
const SetVector<MCSection *> &getGenDwarfSectionSyms() {
return SectionsForRanges;
}