summaryrefslogtreecommitdiff
path: root/lib/Target/TargetLoweringObjectFile.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-02-19 12:26:01 +0000
committerDaniel Jasper <djasper@google.com>2014-02-19 12:26:01 +0000
commit9a925861144fba3497f4b6142cdaa70807e3f1e3 (patch)
treed073a52aa68e9578cb882689bffb4c58d3204eab /lib/Target/TargetLoweringObjectFile.cpp
parent1f55e40aa5f8a7ee10d994f46ac0a2bd1d08ef21 (diff)
downloadllvm-9a925861144fba3497f4b6142cdaa70807e3f1e3.tar.gz
llvm-9a925861144fba3497f4b6142cdaa70807e3f1e3.tar.bz2
llvm-9a925861144fba3497f4b6142cdaa70807e3f1e3.tar.xz
Revert r201622 and r201608.
This causes the LLVMgold plugin to segfault. More information on the replies to r201608. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201669 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/TargetLoweringObjectFile.cpp')
-rw-r--r--lib/Target/TargetLoweringObjectFile.cpp33
1 files changed, 17 insertions, 16 deletions
diff --git a/lib/Target/TargetLoweringObjectFile.cpp b/lib/Target/TargetLoweringObjectFile.cpp
index 9fff220d47..a0218a83df 100644
--- a/lib/Target/TargetLoweringObjectFile.cpp
+++ b/lib/Target/TargetLoweringObjectFile.cpp
@@ -28,7 +28,6 @@
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
-#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetOptions.h"
using namespace llvm;
@@ -100,22 +99,30 @@ static bool IsNullTerminatedString(const Constant *C) {
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 &Mang,
- const TargetMachine &TM) const {
+ const GlobalValue *GV, StringRef Suffix, Mangler &M) const {
assert(!Suffix.empty());
SmallString<60> NameStr;
NameStr += DL->getPrivateGlobalPrefix();
- TM.getTargetLowering()->getNameWithPrefix(NameStr, GV, Mang);
+ M.getNameWithPrefix(NameStr, GV);
NameStr.append(Suffix.begin(), Suffix.end());
return Ctx->GetOrCreateSymbol(NameStr.str());
}
-MCSymbol *TargetLoweringObjectFile::getCFIPersonalitySymbol(
- const GlobalValue *GV, Mangler &Mang, const TargetMachine &TM,
- MachineModuleInfo *MMI) const {
- return TM.getTargetLowering()->getSymbol(GV, Mang);
+MCSymbol *TargetLoweringObjectFile::
+getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,
+ MachineModuleInfo *MMI) const {
+ return getSymbol(GV, Mang);
}
void TargetLoweringObjectFile::emitPersonalityValue(MCStreamer &Streamer,
@@ -268,10 +275,6 @@ SectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
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 *
@@ -309,11 +312,9 @@ TargetLoweringObjectFile::getSectionForConstant(SectionKind Kind) const {
/// handling information.
const MCExpr *TargetLoweringObjectFile::getTTypeGlobalReference(
const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
- const TargetMachine &TM, MachineModuleInfo *MMI,
- MCStreamer &Streamer) const {
+ MachineModuleInfo *MMI, MCStreamer &Streamer) const {
const MCSymbolRefExpr *Ref =
- MCSymbolRefExpr::Create(TM.getTargetLowering()->getSymbol(GV, Mang),
- getContext());
+ MCSymbolRefExpr::Create(getSymbol(GV, Mang), getContext());
return getTTypeReference(Ref, Encoding, Streamer);
}