mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-15 06:29:05 +00:00
give Mangler access to TargetData.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98378 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -25,6 +25,7 @@ class GlobalValue;
|
|||||||
template <typename T> class SmallVectorImpl;
|
template <typename T> class SmallVectorImpl;
|
||||||
class MCContext;
|
class MCContext;
|
||||||
class MCSymbol;
|
class MCSymbol;
|
||||||
|
class TargetData;
|
||||||
|
|
||||||
class Mangler {
|
class Mangler {
|
||||||
public:
|
public:
|
||||||
@@ -36,6 +37,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
MCContext &Context;
|
MCContext &Context;
|
||||||
|
const TargetData &TD;
|
||||||
|
|
||||||
/// AnonGlobalIDs - We need to give global values the same name every time
|
/// AnonGlobalIDs - We need to give global values the same name every time
|
||||||
/// they are mangled. This keeps track of the number we give to anonymous
|
/// they are mangled. This keeps track of the number we give to anonymous
|
||||||
@@ -48,7 +50,8 @@ private:
|
|||||||
unsigned NextAnonGlobalID;
|
unsigned NextAnonGlobalID;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Mangler(MCContext &context) : Context(context), NextAnonGlobalID(1) {}
|
Mangler(MCContext &context, const TargetData &td)
|
||||||
|
: Context(context), TD(td), NextAnonGlobalID(1) {}
|
||||||
|
|
||||||
/// getSymbol - Return the MCSymbol for the specified global value. This
|
/// getSymbol - Return the MCSymbol for the specified global value. This
|
||||||
/// symbol is the main label that is the address of the global.
|
/// symbol is the main label that is the address of the global.
|
||||||
|
@@ -104,7 +104,7 @@ bool AsmPrinter::doInitialization(Module &M) {
|
|||||||
const_cast<TargetLoweringObjectFile&>(getObjFileLowering())
|
const_cast<TargetLoweringObjectFile&>(getObjFileLowering())
|
||||||
.Initialize(OutContext, TM);
|
.Initialize(OutContext, TM);
|
||||||
|
|
||||||
Mang = new Mangler(OutContext);
|
Mang = new Mangler(OutContext, *TM.getTargetData());
|
||||||
|
|
||||||
// Allow the target to emit any magic that it wants at the start of the file.
|
// Allow the target to emit any magic that it wants at the start of the file.
|
||||||
EmitStartOfAsmFile(M);
|
EmitStartOfAsmFile(M);
|
||||||
|
@@ -109,7 +109,7 @@ bool ELFWriter::doInitialization(Module &M) {
|
|||||||
// Initialize TargetLoweringObjectFile.
|
// Initialize TargetLoweringObjectFile.
|
||||||
const_cast<TargetLoweringObjectFile&>(TLOF).Initialize(OutContext, TM);
|
const_cast<TargetLoweringObjectFile&>(TLOF).Initialize(OutContext, TM);
|
||||||
|
|
||||||
Mang = new Mangler(OutContext);
|
Mang = new Mangler(OutContext, *TM.getTargetData());
|
||||||
|
|
||||||
// ELF Header
|
// ELF Header
|
||||||
// ----------
|
// ----------
|
||||||
|
@@ -1734,7 +1734,7 @@ bool CWriter::doInitialization(Module &M) {
|
|||||||
#endif
|
#endif
|
||||||
TAsm = new CBEMCAsmInfo();
|
TAsm = new CBEMCAsmInfo();
|
||||||
TCtx = new MCContext(*TAsm);
|
TCtx = new MCContext(*TAsm);
|
||||||
Mang = new Mangler(*TCtx);
|
Mang = new Mangler(*TCtx, *TD);
|
||||||
|
|
||||||
// Keep track of which functions are static ctors/dtors so they can have
|
// Keep track of which functions are static ctors/dtors so they can have
|
||||||
// an attribute added to their prototypes.
|
// an attribute added to their prototypes.
|
||||||
|
@@ -322,7 +322,7 @@ void LTOCodeGenerator::applyScopeRestrictions() {
|
|||||||
// mark which symbols can not be internalized
|
// mark which symbols can not be internalized
|
||||||
if (!_mustPreserveSymbols.empty()) {
|
if (!_mustPreserveSymbols.empty()) {
|
||||||
MCContext Context(*_target->getMCAsmInfo());
|
MCContext Context(*_target->getMCAsmInfo());
|
||||||
Mangler mangler(Context);
|
Mangler mangler(Context, *_target->getTargetData());
|
||||||
std::vector<const char*> mustPreserveList;
|
std::vector<const char*> mustPreserveList;
|
||||||
for (Module::iterator f = mergedModule->begin(),
|
for (Module::iterator f = mergedModule->begin(),
|
||||||
e = mergedModule->end(); f != e; ++f) {
|
e = mergedModule->end(); f != e; ++f) {
|
||||||
|
@@ -439,7 +439,7 @@ void LTOModule::lazyParseSymbols()
|
|||||||
|
|
||||||
// Use mangler to add GlobalPrefix to names to match linker names.
|
// Use mangler to add GlobalPrefix to names to match linker names.
|
||||||
MCContext Context(*_target->getMCAsmInfo());
|
MCContext Context(*_target->getMCAsmInfo());
|
||||||
Mangler mangler(Context);
|
Mangler mangler(Context, *_target->getTargetData());
|
||||||
|
|
||||||
// add functions
|
// add functions
|
||||||
for (Module::iterator f = _module->begin(); f != _module->end(); ++f) {
|
for (Module::iterator f = _module->begin(); f != _module->end(); ++f) {
|
||||||
|
Reference in New Issue
Block a user