[llvm] r196472 - Remove the isImplicitlyPrivate argument of getNameWithPrefix.
Rafael Espindola
rafael.espindola at gmail.com
Wed Dec 4 21:53:13 PST 2013
Author: rafael
Date: Wed Dec 4 23:53:12 2013
New Revision: 196472
URL: http://llvm.org/viewvc/llvm-project?rev=196472&view=rev
Log:
Remove the isImplicitlyPrivate argument of getNameWithPrefix.
getSymbolWithGlobalValueBase use is to create a name of a new symbol based
on the name of an existing GV. Assert that and then remove the last call
to pass true to isImplicitlyPrivate.
This gives the mangler API a 1:1 mapping from GV to names, which is what we
need to drop the mangler dependency on the target (and use an extended
datalayout instead).
Modified:
llvm/trunk/include/llvm/Target/Mangler.h
llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp
llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
llvm/trunk/lib/LTO/LTOModule.cpp
llvm/trunk/lib/Target/Mangler.cpp
llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp
llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp
llvm/trunk/lib/Target/X86/X86MCInstLower.cpp
Modified: llvm/trunk/include/llvm/Target/Mangler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/Mangler.h?rev=196472&r1=196471&r2=196472&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/Mangler.h (original)
+++ llvm/trunk/include/llvm/Target/Mangler.h Wed Dec 4 23:53:12 2013
@@ -51,8 +51,7 @@ public:
/// getNameWithPrefix - Fill OutName with the name of the appropriate prefix
/// and the specified global variable's name. If the global variable doesn't
/// have a name, this fills in a unique name for the global.
- void getNameWithPrefix(SmallVectorImpl<char> &OutName, const GlobalValue *GV,
- bool isImplicitlyPrivate);
+ void getNameWithPrefix(SmallVectorImpl<char> &OutName, const GlobalValue *GV);
/// getNameWithPrefix - Fill OutName with the name of the appropriate prefix
/// and the specified name as the global variable name. GVName must not be
Modified: llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp?rev=196472&r1=196471&r2=196472&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp Wed Dec 4 23:53:12 2013
@@ -325,7 +325,7 @@ void *MCJIT::getPointerToFunction(Functi
// load address of the symbol, not the local address.
Mangler Mang(TM);
SmallString<128> Name;
- Mang.getNameWithPrefix(Name, F, false);
+ Mang.getNameWithPrefix(Name, F);
return (void*)Dyld.getSymbolLoadAddress(Name);
}
Modified: llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOCodeGenerator.cpp?rev=196472&r1=196471&r2=196472&view=diff
==============================================================================
--- llvm/trunk/lib/LTO/LTOCodeGenerator.cpp (original)
+++ llvm/trunk/lib/LTO/LTOCodeGenerator.cpp Wed Dec 4 23:53:12 2013
@@ -320,7 +320,7 @@ applyRestriction(GlobalValue &GV,
SmallPtrSet<GlobalValue*, 8> &AsmUsed,
Mangler &Mangler) {
SmallString<64> Buffer;
- Mangler.getNameWithPrefix(Buffer, &GV, false);
+ Mangler.getNameWithPrefix(Buffer, &GV);
if (GV.isDeclaration())
return;
Modified: llvm/trunk/lib/LTO/LTOModule.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOModule.cpp?rev=196472&r1=196471&r2=196472&view=diff
==============================================================================
--- llvm/trunk/lib/LTO/LTOModule.cpp (original)
+++ llvm/trunk/lib/LTO/LTOModule.cpp Wed Dec 4 23:53:12 2013
@@ -360,7 +360,7 @@ void LTOModule::addDefinedSymbol(const G
// string is owned by _defines
SmallString<64> Buffer;
- _mangler.getNameWithPrefix(Buffer, def, false);
+ _mangler.getNameWithPrefix(Buffer, def);
// set alignment part log2() can have rounding errors
uint32_t align = def->getAlignment();
@@ -496,7 +496,7 @@ LTOModule::addPotentialUndefinedSymbol(c
return;
SmallString<64> name;
- _mangler.getNameWithPrefix(name, decl, false);
+ _mangler.getNameWithPrefix(name, decl);
StringMap<NameAndAttributes>::value_type &entry =
_undefines.GetOrCreateValue(name);
Modified: llvm/trunk/lib/Target/Mangler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mangler.cpp?rev=196472&r1=196471&r2=196472&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mangler.cpp (original)
+++ llvm/trunk/lib/Target/Mangler.cpp Wed Dec 4 23:53:12 2013
@@ -81,10 +81,9 @@ static void AddFastCallStdCallSuffix(Sma
/// and the specified global variable's name. If the global variable doesn't
/// have a name, this fills in a unique name for the global.
void Mangler::getNameWithPrefix(SmallVectorImpl<char> &OutName,
- const GlobalValue *GV,
- bool isImplicitlyPrivate) {
+ const GlobalValue *GV) {
ManglerPrefixTy PrefixTy = Mangler::Default;
- if (GV->hasPrivateLinkage() || isImplicitlyPrivate)
+ if (GV->hasPrivateLinkage())
PrefixTy = Mangler::Private;
else if (GV->hasLinkerPrivateLinkage() || GV->hasLinkerPrivateWeakLinkage())
PrefixTy = Mangler::LinkerPrivate;
Modified: llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp?rev=196472&r1=196471&r2=196472&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp Wed Dec 4 23:53:12 2013
@@ -51,7 +51,7 @@ static MCSymbol *GetSymbolFromOperand(co
AP.Mang->getNameWithPrefix(Name, MO.getSymbolName());
} else {
const GlobalValue *GV = MO.getGlobal();
- AP.Mang->getNameWithPrefix(Name, GV, false);
+ AP.Mang->getNameWithPrefix(Name, GV);
}
unsigned OrigLen = Name.size() - PrefixLen;
Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=196472&r1=196471&r2=196472&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Wed Dec 4 23:53:12 2013
@@ -18,6 +18,7 @@
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalVariable.h"
+#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCStreamer.h"
@@ -102,14 +103,21 @@ static bool IsNullTerminatedString(const
MCSymbol *TargetLoweringObjectFile::getSymbol(Mangler &M,
const GlobalValue *GV) const {
SmallString<60> NameStr;
- M.getNameWithPrefix(NameStr, GV, false);
+ M.getNameWithPrefix(NameStr, GV);
return Ctx->GetOrCreateSymbol(NameStr.str());
}
MCSymbol *TargetLoweringObjectFile::getSymbolWithGlobalValueBase(
Mangler &M, const GlobalValue *GV, StringRef Suffix) const {
+ assert(!Suffix.empty());
+ assert(!GV->hasPrivateLinkage());
+ assert(!GV->hasLinkerPrivateLinkage());
+ assert(!GV->hasLinkerPrivateWeakLinkage());
+
+ const MCAsmInfo *MAI = Ctx->getAsmInfo();
SmallString<60> NameStr;
- M.getNameWithPrefix(NameStr, GV, true);
+ NameStr += MAI->getPrivateGlobalPrefix();
+ M.getNameWithPrefix(NameStr, GV);
NameStr.append(Suffix.begin(), Suffix.end());
return Ctx->GetOrCreateSymbol(NameStr.str());
}
Modified: llvm/trunk/lib/Target/X86/X86MCInstLower.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCInstLower.cpp?rev=196472&r1=196471&r2=196472&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86MCInstLower.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86MCInstLower.cpp Wed Dec 4 23:53:12 2013
@@ -97,7 +97,7 @@ GetSymbolFromOperand(const MachineOperan
if (MO.isGlobal()) {
const GlobalValue *GV = MO.getGlobal();
- getMang()->getNameWithPrefix(Name, GV, false);
+ getMang()->getNameWithPrefix(Name, GV);
} else if (MO.isSymbol()) {
getMang()->getNameWithPrefix(Name, MO.getSymbolName());
} else if (MO.isMBB()) {
More information about the llvm-commits
mailing list