[cfe-commits] r125971 - /cfe/trunk/lib/CodeGen/BackendUtil.cpp

Chris Lattner sabre at nondot.org
Fri Feb 18 14:20:38 PST 2011


Author: lattner
Date: Fri Feb 18 16:20:38 2011
New Revision: 125971

URL: http://llvm.org/viewvc/llvm-project?rev=125971&view=rev
Log:
install a TargetLibraryInfo configured with the appropriate 
target triple.  This would be a decent place to add -fno-builtin
info for example.

Modified:
    cfe/trunk/lib/CodeGen/BackendUtil.cpp

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=125971&r1=125970&r2=125971&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Fri Feb 18 16:20:38 2011
@@ -26,6 +26,7 @@
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/SubtargetFeature.h"
 #include "llvm/Target/TargetData.h"
+#include "llvm/Target/TargetLibraryInfo.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetOptions.h"
 #include "llvm/Target/TargetRegistry.h"
@@ -107,14 +108,18 @@
     OptLevel = 0;
     Inlining = CodeGenOpts.NoInlining;
   }
+  
+  FunctionPassManager *FPM = getPerFunctionPasses();
+  
+  FPM->add(new TargetLibraryInfo(Triple(TheModule->getTargetTriple())));
 
   // In -O0 if checking is disabled, we don't even have per-function passes.
   if (CodeGenOpts.VerifyModule)
-    getPerFunctionPasses()->add(createVerifierPass());
+    FPM->add(createVerifierPass());
 
   // Assume that standard function passes aren't run for -O0.
   if (OptLevel > 0)
-    llvm::createStandardFunctionPasses(getPerFunctionPasses(), OptLevel);
+    llvm::createStandardFunctionPasses(FPM, OptLevel);
 
   llvm::Pass *InliningPass = 0;
   switch (Inlining) {
@@ -136,8 +141,12 @@
     break;
   }
 
+  PassManager *MPM = getPerModulePasses();
+  
+  MPM->add(new TargetLibraryInfo(Triple(TheModule->getTargetTriple())));
+
   // For now we always create per module passes.
-  llvm::createStandardModulePasses(getPerModulePasses(), OptLevel,
+  llvm::createStandardModulePasses(MPM, OptLevel,
                                    CodeGenOpts.OptimizeSize,
                                    CodeGenOpts.UnitAtATime,
                                    CodeGenOpts.UnrollLoops,





More information about the cfe-commits mailing list