give Mangler access to TargetData.
authorChris Lattner <sabre@nondot.org>
Fri, 12 Mar 2010 20:47:28 +0000 (20:47 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 12 Mar 2010 20:47:28 +0000 (20:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98378 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/Mangler.h
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/CodeGen/ELFWriter.cpp
lib/Target/CBackend/CBackend.cpp
tools/lto/LTOCodeGenerator.cpp
tools/lto/LTOModule.cpp

index 2b7d192e1e2fa27eda803cc8f0e8a7d6491ea229..a9f3576559d49b570753c42960a7316eab6d04a4 100644 (file)
@@ -25,6 +25,7 @@ class GlobalValue;
 template <typename T> class SmallVectorImpl; 
 class MCContext;
 class MCSymbol;
+class TargetData;
 
 class Mangler {
 public:
@@ -36,6 +37,7 @@ public:
 
 private:
   MCContext &Context;
+  const TargetData &TD;
 
   /// 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
@@ -48,7 +50,8 @@ private:
   unsigned NextAnonGlobalID;
 
 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
   /// symbol is the main label that is the address of the global.
index 0a283931edaf35e5981e59a8b12b06ae5f3f3f12..68da74581b924ed765531ab72ad4eae1ae2b6150 100644 (file)
@@ -104,7 +104,7 @@ bool AsmPrinter::doInitialization(Module &M) {
   const_cast<TargetLoweringObjectFile&>(getObjFileLowering())
     .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.
   EmitStartOfAsmFile(M);
index d73581a337752ae7ae3cecb3cca9db8b858f5e7e..eda167cb54a57706d43bde6d9d60706f8c852aea 100644 (file)
@@ -109,7 +109,7 @@ bool ELFWriter::doInitialization(Module &M) {
   // Initialize TargetLoweringObjectFile.
   const_cast<TargetLoweringObjectFile&>(TLOF).Initialize(OutContext, TM);
   
-  Mang = new Mangler(OutContext);
+  Mang = new Mangler(OutContext, *TM.getTargetData());
 
   // ELF Header
   // ----------
index 6b9ae4fc0d11cf0b9b2ccbadf4934d2ccfd0d039..b1ba0d2b9fd41e97882d757e1b9c0356586e619b 100644 (file)
@@ -1734,7 +1734,7 @@ bool CWriter::doInitialization(Module &M) {
 #endif    
   TAsm = new CBEMCAsmInfo();
   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
   // an attribute added to their prototypes.
index acce071ba5d1d008b934945613e66a02775793fd..15753d350ff8d3aa7aeb553d0b3379ddec76d3fd 100644 (file)
@@ -322,7 +322,7 @@ void LTOCodeGenerator::applyScopeRestrictions() {
   // mark which symbols can not be internalized 
   if (!_mustPreserveSymbols.empty()) {
     MCContext Context(*_target->getMCAsmInfo());
-    Mangler mangler(Context);
+    Mangler mangler(Context, *_target->getTargetData());
     std::vector<const char*> mustPreserveList;
     for (Module::iterator f = mergedModule->begin(),
          e = mergedModule->end(); f != e; ++f) {
index 4617d93200f7c3e435eaf1d914fe2300cb6fe09c..08576abac456218d11dd1269db68644b0d6d2968 100644 (file)
@@ -439,7 +439,7 @@ void LTOModule::lazyParseSymbols()
         
         // Use mangler to add GlobalPrefix to names to match linker names.
         MCContext Context(*_target->getMCAsmInfo());
-        Mangler mangler(Context);
+        Mangler mangler(Context, *_target->getTargetData());
 
         // add functions
         for (Module::iterator f = _module->begin(); f != _module->end(); ++f) {