[llvm-commits] [llvm] r77973 - /llvm/trunk/tools/llc/llc.cpp

Daniel Dunbar daniel at zuster.org
Mon Aug 3 10:34:37 PDT 2009


Author: ddunbar
Date: Mon Aug  3 12:34:19 2009
New Revision: 77973

URL: http://llvm.org/viewvc/llvm-project?rev=77973&view=rev
Log:
Provide target data from the module if the target machine doesn't have any.

Modified:
    llvm/trunk/tools/llc/llc.cpp

Modified: llvm/trunk/tools/llc/llc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llc/llc.cpp?rev=77973&r1=77972&r2=77973&view=diff

==============================================================================
--- llvm/trunk/tools/llc/llc.cpp (original)
+++ llvm/trunk/tools/llc/llc.cpp Mon Aug  3 12:34:19 2009
@@ -310,7 +310,13 @@
   // used by strange things like the C backend.
   if (Target.WantsWholeFile()) {
     PassManager PM;
-    PM.add(new TargetData(*Target.getTargetData()));
+
+    // Add the target data from the target machine, if it exists, or the module.
+    if (const TargetData *TD = Target.getTargetData())
+      PM.add(new TargetData(*TD));
+    else
+      PM.add(new TargetData(&mod));
+
     if (!NoVerify)
       PM.add(createVerifierPass());
 
@@ -328,7 +334,12 @@
     // Build up all of the passes that we want to do to the module.
     ExistingModuleProvider Provider(M.release());
     FunctionPassManager Passes(&Provider);
-    Passes.add(new TargetData(*Target.getTargetData()));
+
+    // Add the target data from the target machine, if it exists, or the module.
+    if (const TargetData *TD = Target.getTargetData())
+      Passes.add(new TargetData(*TD));
+    else
+      Passes.add(new TargetData(&mod));
 
 #ifndef NDEBUG
     if (!NoVerify)





More information about the llvm-commits mailing list