#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:
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
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.
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);
#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;
// "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());
}
}
}
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);
// 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;
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.