mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-12 13:30:51 +00:00
Use the mangler consistently instead of using getGlobalPrefix directly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195911 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
680cd7b077
commit
60f6083a36
@ -25,6 +25,7 @@
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/MutexGuard.h"
|
||||
#include "llvm/Target/Mangler.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
@ -231,11 +232,10 @@ void *MCJIT::getPointerToBasicBlock(BasicBlock *BB) {
|
||||
}
|
||||
|
||||
uint64_t MCJIT::getExistingSymbolAddress(const std::string &Name) {
|
||||
// Check with the RuntimeDyld to see if we already have this symbol.
|
||||
if (Name[0] == '\1')
|
||||
return Dyld.getSymbolLoadAddress(Name.substr(1));
|
||||
return Dyld.getSymbolLoadAddress((TM->getMCAsmInfo()->getGlobalPrefix()
|
||||
+ Name));
|
||||
Mangler Mang(TM);
|
||||
SmallString<128> FullName;
|
||||
Mang.getNameWithPrefix(FullName, Name);
|
||||
return Dyld.getSymbolLoadAddress(FullName);
|
||||
}
|
||||
|
||||
Module *MCJIT::findModuleForSymbol(const std::string &Name,
|
||||
@ -320,15 +320,13 @@ void *MCJIT::getPointerToFunction(Function *F) {
|
||||
return NULL;
|
||||
|
||||
// FIXME: Should the Dyld be retaining module information? Probably not.
|
||||
// FIXME: Should we be using the mangler for this? Probably.
|
||||
//
|
||||
// This is the accessor for the target address, so make sure to check the
|
||||
// load address of the symbol, not the local address.
|
||||
StringRef BaseName = F->getName();
|
||||
if (BaseName[0] == '\1')
|
||||
return (void*)Dyld.getSymbolLoadAddress(BaseName.substr(1));
|
||||
return (void*)Dyld.getSymbolLoadAddress((TM->getMCAsmInfo()->getGlobalPrefix()
|
||||
+ BaseName).str());
|
||||
Mangler Mang(TM);
|
||||
SmallString<128> Name;
|
||||
Mang.getNameWithPrefix(Name, F, false);
|
||||
return (void*)Dyld.getSymbolLoadAddress(Name);
|
||||
}
|
||||
|
||||
void *MCJIT::recompileAndRelinkFunction(Function *F) {
|
||||
|
@ -102,7 +102,9 @@ void MSP430AsmPrinter::printOperand(const MachineInstr *MI, int OpNum,
|
||||
case MachineOperand::MO_ExternalSymbol: {
|
||||
bool isMemOp = Modifier && !strcmp(Modifier, "mem");
|
||||
O << (isMemOp ? '&' : '#');
|
||||
O << MAI->getGlobalPrefix() << MO.getSymbolName();
|
||||
SmallString<128> Name;
|
||||
Mang->getNameWithPrefix(Name, MO.getSymbolName());
|
||||
O << Name;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -176,9 +176,9 @@ void PPCAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
return;
|
||||
}
|
||||
|
||||
MCSymbol *NLPSym =
|
||||
OutContext.GetOrCreateSymbol(StringRef(MAI->getGlobalPrefix())+
|
||||
MO.getSymbolName()+"$non_lazy_ptr");
|
||||
SmallString<128> Name;
|
||||
Mang->getNameWithPrefix(Name, Twine(MO.getSymbolName()) + "$non_lazy_ptr");
|
||||
MCSymbol *NLPSym = OutContext.GetOrCreateSymbol(Name);
|
||||
MachineModuleInfoImpl::StubValueTy &StubSym =
|
||||
MMI->getObjFileInfo<MachineModuleInfoMachO>().getGVStubEntry(NLPSym);
|
||||
if (StubSym.getPointer() == 0)
|
||||
|
@ -37,8 +37,7 @@ static MCSymbol *GetSymbolFromOperand(const MachineOperand &MO, AsmPrinter &AP){
|
||||
SmallString<128> Name;
|
||||
if (!MO.isGlobal()) {
|
||||
assert(MO.isSymbol() && "Isn't a symbol reference");
|
||||
Name += AP.MAI->getGlobalPrefix();
|
||||
Name += MO.getSymbolName();
|
||||
AP.Mang->getNameWithPrefix(Name, MO.getSymbolName());
|
||||
} else {
|
||||
const GlobalValue *GV = MO.getGlobal();
|
||||
bool isImplicitlyPrivate = false;
|
||||
|
@ -85,8 +85,7 @@ GetSymbolFromOperand(const MachineOperand &MO) const {
|
||||
|
||||
getMang()->getNameWithPrefix(Name, GV, isImplicitlyPrivate);
|
||||
} else if (MO.isSymbol()) {
|
||||
Name += MAI.getGlobalPrefix();
|
||||
Name += MO.getSymbolName();
|
||||
getMang()->getNameWithPrefix(Name, MO.getSymbolName());
|
||||
} else if (MO.isMBB()) {
|
||||
Name += MO.getMBB()->getSymbol()->getName();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user