aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
diff options
context:
space:
mode:
authorPhilipp Krones <philipp.krones@embecosm.com>2021-05-05 10:03:02 -0700
committerFangrui Song <i@maskray.me>2021-05-05 10:03:02 -0700
commit632ebc4ab4374e53fce1ec870465c587e0a33668 (patch)
treef3bbf72dacf56163a62c0f6e18c52f2fd102d8ff /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
parent80e8025083982f4eca8ca8200eafecf4a5c3ae6e (diff)
downloadllvm-632ebc4ab4374e53fce1ec870465c587e0a33668.zip
llvm-632ebc4ab4374e53fce1ec870465c587e0a33668.tar.gz
llvm-632ebc4ab4374e53fce1ec870465c587e0a33668.tar.bz2
[MC] Untangle MCContext and MCObjectFileInfo
This untangles the MCContext and the MCObjectFileInfo. There is a circular dependency between MCContext and MCObjectFileInfo. Currently this dependency also exists during construction: You can't contruct a MOFI without a MCContext without constructing the MCContext with a dummy version of that MOFI first. This removes this dependency during construction. In a perfect world, MCObjectFileInfo wouldn't depend on MCContext at all, but only be stored in the MCContext, like other MC information. This is future work. This also shifts/adds more information to the MCContext making it more available to the different targets. Namely: - TargetTriple - ObjectFileType - SubtargetInfo Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D101462
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r--llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index 7388ffb..5315ec9 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -1645,7 +1645,7 @@ MCSection *TargetLoweringObjectFileCOFF::SelectSectionForGlobal(
// Append "$symbol" to the section name *before* IR-level mangling is
// applied when targetting mingw. This is what GCC does, and the ld.bfd
// COFF linker will not properly handle comdats otherwise.
- if (getTargetTriple().isWindowsGNUEnvironment())
+ if (getContext().getTargetTriple().isWindowsGNUEnvironment())
raw_svector_ostream(Name) << '$' << ComdatGV->getName();
return getContext().getCOFFSection(Name, Characteristics, Kind,
@@ -1762,7 +1762,8 @@ void TargetLoweringObjectFileCOFF::emitLinkerDirectives(
std::string Flags;
for (const GlobalValue &GV : M.global_values()) {
raw_string_ostream OS(Flags);
- emitLinkerFlagsForGlobalCOFF(OS, &GV, getTargetTriple(), getMangler());
+ emitLinkerFlagsForGlobalCOFF(OS, &GV, getContext().getTargetTriple(),
+ getMangler());
OS.flush();
if (!Flags.empty()) {
Streamer.SwitchSection(getDrectveSection());
@@ -1786,7 +1787,8 @@ void TargetLoweringObjectFileCOFF::emitLinkerDirectives(
continue;
raw_string_ostream OS(Flags);
- emitLinkerFlagsForUsedCOFF(OS, GV, getTargetTriple(), getMangler());
+ emitLinkerFlagsForUsedCOFF(OS, GV, getContext().getTargetTriple(),
+ getMangler());
OS.flush();
if (!Flags.empty()) {
@@ -1865,16 +1867,16 @@ static MCSectionCOFF *getCOFFStaticStructorSection(MCContext &Ctx,
MCSection *TargetLoweringObjectFileCOFF::getStaticCtorSection(
unsigned Priority, const MCSymbol *KeySym) const {
- return getCOFFStaticStructorSection(getContext(), getTargetTriple(), true,
- Priority, KeySym,
- cast<MCSectionCOFF>(StaticCtorSection));
+ return getCOFFStaticStructorSection(
+ getContext(), getContext().getTargetTriple(), true, Priority, KeySym,
+ cast<MCSectionCOFF>(StaticCtorSection));
}
MCSection *TargetLoweringObjectFileCOFF::getStaticDtorSection(
unsigned Priority, const MCSymbol *KeySym) const {
- return getCOFFStaticStructorSection(getContext(), getTargetTriple(), false,
- Priority, KeySym,
- cast<MCSectionCOFF>(StaticDtorSection));
+ return getCOFFStaticStructorSection(
+ getContext(), getContext().getTargetTriple(), false, Priority, KeySym,
+ cast<MCSectionCOFF>(StaticDtorSection));
}
const MCExpr *TargetLoweringObjectFileCOFF::lowerRelativeReference(