From 93cf0939f95b3d580d9c05375a7c84164e1ba72e Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 29 Oct 2013 17:28:26 +0000 Subject: Move getSymbol to TargetLoweringObjectFile. This allows constructing a Mangler with just a TargetMachine. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193630 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/TargetLoweringObjectFile.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'lib/Target/TargetLoweringObjectFile.cpp') diff --git a/lib/Target/TargetLoweringObjectFile.cpp b/lib/Target/TargetLoweringObjectFile.cpp index cd810b624f..7b8d1108f1 100644 --- a/lib/Target/TargetLoweringObjectFile.cpp +++ b/lib/Target/TargetLoweringObjectFile.cpp @@ -97,10 +97,20 @@ 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(Mangler &M, + const GlobalValue *GV) const { + SmallString<60> NameStr; + M.getNameWithPrefix(NameStr, GV, false); + return Ctx->GetOrCreateSymbol(NameStr.str()); +} + + MCSymbol *TargetLoweringObjectFile:: getCFIPersonalitySymbol(const GlobalValue *GV, Mangler *Mang, MachineModuleInfo *MMI) const { - return Mang->getSymbol(GV); + return getSymbol(*Mang, GV); } void TargetLoweringObjectFile::emitPersonalityValue(MCStreamer &Streamer, @@ -293,7 +303,7 @@ getTTypeGlobalReference(const GlobalValue *GV, Mangler *Mang, MachineModuleInfo *MMI, unsigned Encoding, MCStreamer &Streamer) const { const MCSymbolRefExpr *Ref = - MCSymbolRefExpr::Create(Mang->getSymbol(GV), getContext()); + MCSymbolRefExpr::Create(getSymbol(*Mang, GV), getContext()); return getTTypeReference(Ref, Encoding, Streamer); } -- cgit v1.2.3