mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-16 08:29:43 +00:00
Don't reach into the middle of TargetMachine and cache one of its ivars.
Not only does this break encapsulation, it's gross. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182876 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
aae0fa998a
commit
cc5a882c96
@ -17,12 +17,13 @@
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
|
||||
namespace llvm {
|
||||
class Twine;
|
||||
|
||||
class GlobalValue;
|
||||
template <typename T> class SmallVectorImpl;
|
||||
class MCContext;
|
||||
class MCSymbol;
|
||||
class DataLayout;
|
||||
template <typename T> class SmallVectorImpl;
|
||||
class TargetMachine;
|
||||
class Twine;
|
||||
|
||||
class Mangler {
|
||||
public:
|
||||
@ -34,7 +35,7 @@ public:
|
||||
|
||||
private:
|
||||
MCContext &Context;
|
||||
const DataLayout &TD;
|
||||
const TargetMachine *TM;
|
||||
|
||||
/// 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
|
||||
@ -47,8 +48,8 @@ private:
|
||||
unsigned NextAnonGlobalID;
|
||||
|
||||
public:
|
||||
Mangler(MCContext &context, const DataLayout &td)
|
||||
: Context(context), TD(td), NextAnonGlobalID(1) {}
|
||||
Mangler(MCContext &Context, const TargetMachine *TM)
|
||||
: Context(Context), TM(TM), NextAnonGlobalID(1) {}
|
||||
|
||||
/// getSymbol - Return the MCSymbol for the specified global value. This
|
||||
/// symbol is the main label that is the address of the global.
|
||||
|
@ -163,7 +163,7 @@ bool AsmPrinter::doInitialization(Module &M) {
|
||||
const_cast<TargetLoweringObjectFile&>(getObjFileLowering())
|
||||
.Initialize(OutContext, TM);
|
||||
|
||||
Mang = new Mangler(OutContext, *TM.getDataLayout());
|
||||
Mang = new Mangler(OutContext, &TM);
|
||||
|
||||
// Allow the target to emit any magic that it wants at the start of the file.
|
||||
EmitStartOfAsmFile(M);
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
using namespace llvm;
|
||||
|
||||
@ -226,7 +227,7 @@ void Mangler::getNameWithPrefix(SmallVectorImpl<char> &OutName,
|
||||
// "Pure" variadic functions do not receive @0 suffix.
|
||||
(!FT->isVarArg() || FT->getNumParams() == 0 ||
|
||||
(FT->getNumParams() == 1 && F->hasStructRetAttr())))
|
||||
AddFastCallStdCallSuffix(OutName, F, TD);
|
||||
AddFastCallStdCallSuffix(OutName, F, *TM->getDataLayout());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -912,7 +912,7 @@ bool NVPTXAsmPrinter::doInitialization(Module &M) {
|
||||
const_cast<TargetLoweringObjectFile &>(getObjFileLowering())
|
||||
.Initialize(OutContext, TM);
|
||||
|
||||
Mang = new Mangler(OutContext, *TM.getDataLayout());
|
||||
Mang = new Mangler(OutContext, &TM);
|
||||
|
||||
// Emit header before any dwarf directives are emitted below.
|
||||
emitHeader(M, OS1);
|
||||
|
@ -310,7 +310,7 @@ void LTOCodeGenerator::applyScopeRestrictions() {
|
||||
|
||||
// mark which symbols can not be internalized
|
||||
MCContext Context(*_target->getMCAsmInfo(), *_target->getRegisterInfo(),NULL);
|
||||
Mangler mangler(Context, *_target->getDataLayout());
|
||||
Mangler mangler(Context, _target);
|
||||
std::vector<const char*> mustPreserveList;
|
||||
SmallPtrSet<GlobalValue*, 8> asmUsed;
|
||||
|
||||
|
@ -158,7 +158,7 @@ SSPBufferSize("stack-protector-buffer-size", cl::init(8),
|
||||
LTOModule::LTOModule(llvm::Module *m, llvm::TargetMachine *t)
|
||||
: _module(m), _target(t),
|
||||
_context(*_target->getMCAsmInfo(), *_target->getRegisterInfo(), NULL),
|
||||
_mangler(_context, *_target->getDataLayout()) {}
|
||||
_mangler(_context, t) {}
|
||||
|
||||
/// isBitcodeFile - Returns 'true' if the file (or memory contents) is LLVM
|
||||
/// bitcode.
|
||||
|
Loading…
Reference in New Issue
Block a user