X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FTarget%2FTargetLoweringObjectFile.cpp;h=e63bc2b69ccf6ae299ed4c7726a2f3efc8113e23;hb=dea837d3c5179309642875dae6d2b20b5b4bd197;hp=9fff220d47dfa34805966908222ea39d7215245e;hpb=6880f0e19f24f7e7f0877e876b74c5cab10abc22;p=oota-llvm.git diff --git a/lib/Target/TargetLoweringObjectFile.cpp b/lib/Target/TargetLoweringObjectFile.cpp index 9fff220d47d..e63bc2b69cc 100644 --- a/lib/Target/TargetLoweringObjectFile.cpp +++ b/lib/Target/TargetLoweringObjectFile.cpp @@ -27,9 +27,10 @@ #include "llvm/Support/Dwarf.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" -#include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetLowering.h" +#include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetOptions.h" +#include "llvm/Target/TargetSubtargetInfo.h" using namespace llvm; //===----------------------------------------------------------------------===// @@ -42,11 +43,11 @@ using namespace llvm; void TargetLoweringObjectFile::Initialize(MCContext &ctx, const TargetMachine &TM) { Ctx = &ctx; - DL = TM.getDataLayout(); + DL = TM.getSubtargetImpl()->getDataLayout(); InitMCObjectFileInfo(TM.getTargetTriple(), TM.getRelocationModel(), TM.getCodeModel(), *Ctx); } - + TargetLoweringObjectFile::~TargetLoweringObjectFile() { } @@ -62,7 +63,7 @@ static bool isSuitableForBSS(const GlobalVariable *GV, bool NoZerosInBSS) { 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. @@ -107,7 +108,7 @@ MCSymbol *TargetLoweringObjectFile::getSymbolWithGlobalValueBase( SmallString<60> NameStr; NameStr += DL->getPrivateGlobalPrefix(); - TM.getTargetLowering()->getNameWithPrefix(NameStr, GV, Mang); + TM.getNameWithPrefix(NameStr, GV, Mang); NameStr.append(Suffix.begin(), Suffix.end()); return Ctx->GetOrCreateSymbol(NameStr.str()); } @@ -115,7 +116,7 @@ MCSymbol *TargetLoweringObjectFile::getSymbolWithGlobalValueBase( MCSymbol *TargetLoweringObjectFile::getCFIPersonalitySymbol( const GlobalValue *GV, Mangler &Mang, const TargetMachine &TM, MachineModuleInfo *MMI) const { - return TM.getTargetLowering()->getSymbol(GV, Mang); + return TM.getSymbol(GV, Mang); } void TargetLoweringObjectFile::emitPersonalityValue(MCStreamer &Streamer, @@ -138,7 +139,7 @@ SectionKind TargetLoweringObjectFile::getKindForGlobal(const GlobalValue *GV, // Early exit - functions should be always in text sections. const GlobalVariable *GVar = dyn_cast(GV); - if (GVar == 0) + if (!GVar) return SectionKind::getText(); // Handle thread-local data first. @@ -199,7 +200,8 @@ SectionKind TargetLoweringObjectFile::getKindForGlobal(const GlobalValue *GV, // Otherwise, just drop it into a mergable constant section. If we have // a section for this size, use it, otherwise use the arbitrary sized // mergable section. - switch (TM.getDataLayout()->getTypeAllocSize(C->getType())) { + switch (TM.getSubtargetImpl()->getDataLayout()->getTypeAllocSize( + C->getType())) { case 4: return SectionKind::getMergeableConst4(); case 8: return SectionKind::getMergeableConst8(); case 16: return SectionKind::getMergeableConst16(); @@ -284,10 +286,10 @@ TargetLoweringObjectFile::SelectSectionForGlobal(const GlobalValue *GV, 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(); @@ -297,8 +299,9 @@ TargetLoweringObjectFile::SelectSectionForGlobal(const GlobalValue *GV, /// specified size and relocation information, return a section that it /// should be placed in. const MCSection * -TargetLoweringObjectFile::getSectionForConstant(SectionKind Kind) const { - if (Kind.isReadOnly() && ReadOnlySection != 0) +TargetLoweringObjectFile::getSectionForConstant(SectionKind Kind, + const Constant *C) const { + if (Kind.isReadOnly() && ReadOnlySection != nullptr) return ReadOnlySection; return DataSection; @@ -312,8 +315,7 @@ const MCExpr *TargetLoweringObjectFile::getTTypeGlobalReference( const TargetMachine &TM, MachineModuleInfo *MMI, MCStreamer &Streamer) const { const MCSymbolRefExpr *Ref = - MCSymbolRefExpr::Create(TM.getTargetLowering()->getSymbol(GV, Mang), - getContext()); + MCSymbolRefExpr::Create(TM.getSymbol(GV, Mang), getContext()); return getTTypeReference(Ref, Encoding, Streamer); }