#include "llvm/Support/Dwarf.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
using namespace llvm;
InitMCObjectFileInfo(TM.getTargetTriple(),
TM.getRelocationModel(), TM.getCodeModel(), *Ctx);
}
-
+
TargetLoweringObjectFile::~TargetLoweringObjectFile() {
}
return false;
// If the global has an explicit section specified, don't put it in BSS.
- if (!GV->getSection().empty())
+ if (GV->hasSection())
return false;
// If -nozero-initialized-in-bss is specified, don't ever use BSS.
return false;
}
-/// Return the MCSymbol for the specified global value. This
-/// symbol is the main label that is the address of the global.
-MCSymbol *TargetLoweringObjectFile::getSymbol(const GlobalValue *GV,
- Mangler &M) const {
- SmallString<60> NameStr;
- M.getNameWithPrefix(NameStr, GV);
- return Ctx->GetOrCreateSymbol(NameStr.str());
-}
-
MCSymbol *TargetLoweringObjectFile::getSymbolWithGlobalValueBase(
- const GlobalValue *GV, StringRef Suffix, Mangler &M) const {
+ const GlobalValue *GV, StringRef Suffix, Mangler &Mang,
+ const TargetMachine &TM) const {
assert(!Suffix.empty());
SmallString<60> NameStr;
NameStr += DL->getPrivateGlobalPrefix();
- M.getNameWithPrefix(NameStr, GV);
+ TM.getNameWithPrefix(NameStr, GV, Mang);
NameStr.append(Suffix.begin(), Suffix.end());
return Ctx->GetOrCreateSymbol(NameStr.str());
}
-MCSymbol *TargetLoweringObjectFile::
-getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,
- MachineModuleInfo *MMI) const {
- return getSymbol(GV, Mang);
+MCSymbol *TargetLoweringObjectFile::getCFIPersonalitySymbol(
+ const GlobalValue *GV, Mangler &Mang, const TargetMachine &TM,
+ MachineModuleInfo *MMI) const {
+ return TM.getSymbol(GV, Mang);
}
void TargetLoweringObjectFile::emitPersonalityValue(MCStreamer &Streamer,
// Early exit - functions should be always in text sections.
const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV);
- if (GVar == 0)
+ if (!GVar)
return SectionKind::getText();
// Handle thread-local data first.
return SelectSectionForGlobal(GV, Kind, Mang, TM);
}
+bool TargetLoweringObjectFile::isSectionAtomizableBySymbols(
+ const MCSection &Section) const {
+ return false;
+}
// Lame default implementation. Calculate the section name for global.
const MCSection *
if (Kind.isText())
return getTextSection();
- if (Kind.isBSS() && BSSSection != 0)
+ if (Kind.isBSS() && BSSSection != nullptr)
return BSSSection;
- if (Kind.isReadOnly() && ReadOnlySection != 0)
+ if (Kind.isReadOnly() && ReadOnlySection != nullptr)
return ReadOnlySection;
return getDataSection();
/// should be placed in.
const MCSection *
TargetLoweringObjectFile::getSectionForConstant(SectionKind Kind) const {
- if (Kind.isReadOnly() && ReadOnlySection != 0)
+ if (Kind.isReadOnly() && ReadOnlySection != nullptr)
return ReadOnlySection;
return DataSection;
/// handling information.
const MCExpr *TargetLoweringObjectFile::getTTypeGlobalReference(
const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
- MachineModuleInfo *MMI, MCStreamer &Streamer) const {
+ const TargetMachine &TM, MachineModuleInfo *MMI,
+ MCStreamer &Streamer) const {
const MCSymbolRefExpr *Ref =
- MCSymbolRefExpr::Create(getSymbol(GV, Mang), getContext());
+ MCSymbolRefExpr::Create(TM.getSymbol(GV, Mang), getContext());
return getTTypeReference(Ref, Encoding, Streamer);
}