]> granicus.if.org Git - clang/commitdiff
Switch to asking the target machine to add any relevant analysis passses
authorChandler Carruth <chandlerc@gmail.com>
Mon, 7 Jan 2013 01:38:01 +0000 (01:38 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Mon, 7 Jan 2013 01:38:01 +0000 (01:38 +0000)
rather than doing it ourselves. This reflects the API changes in r171681.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171683 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/BackendUtil.cpp

index 967f3291e11ec3b43fc66e77e84971fae6288790..d343207545b6cd657ac41817513d83353e14cb00 100644 (file)
@@ -31,7 +31,6 @@
 #include "llvm/Target/TargetLibraryInfo.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetOptions.h"
-#include "llvm/TargetTransformInfo.h"
 #include "llvm/Transforms/IPO.h"
 #include "llvm/Transforms/IPO/PassManagerBuilder.h"
 #include "llvm/Transforms/Instrumentation.h"
@@ -59,11 +58,8 @@ private:
     if (!CodeGenPasses) {
       CodeGenPasses = new PassManager();
       CodeGenPasses->add(new DataLayout(TheModule));
-      // Add TargetTransformInfo.
-      if (TM) {
-        CodeGenPasses->add(createNoTTIPass(TM->getScalarTargetTransformInfo(),
-                                           TM->getVectorTargetTransformInfo()));
-      }
+      if (TM)
+        TM->addAnalysisPasses(*CodeGenPasses);
     }
     return CodeGenPasses;
   }
@@ -72,11 +68,8 @@ private:
     if (!PerModulePasses) {
       PerModulePasses = new PassManager();
       PerModulePasses->add(new DataLayout(TheModule));
-      if (TM) {
-        PerModulePasses->add(
-            createNoTTIPass(TM->getScalarTargetTransformInfo(),
-                            TM->getVectorTargetTransformInfo()));
-      }
+      if (TM)
+        TM->addAnalysisPasses(*PerModulePasses);
     }
     return PerModulePasses;
   }
@@ -85,11 +78,8 @@ private:
     if (!PerFunctionPasses) {
       PerFunctionPasses = new FunctionPassManager(TheModule);
       PerFunctionPasses->add(new DataLayout(TheModule));
-      if (TM) {
-        PerFunctionPasses->add(
-            createNoTTIPass(TM->getScalarTargetTransformInfo(),
-                            TM->getVectorTargetTransformInfo()));
-      }
+      if (TM)
+        TM->addAnalysisPasses(*PerFunctionPasses);
     }
     return PerFunctionPasses;
   }
@@ -477,9 +467,8 @@ bool EmitAssemblyHelper::AddEmitPasses(BackendAction Action,
     TLI->disableAllFunctions();
   PM->add(TLI);
 
-  // Add TargetTransformInfo.
-  PM->add(createNoTTIPass(TM->getScalarTargetTransformInfo(),
-                          TM->getVectorTargetTransformInfo()));
+  // Add Target specific analysis passes.
+  TM->addAnalysisPasses(*PM);
 
   // Normal mode, emit a .s or .o file by running the code generator. Note,
   // this also adds codegenerator level optimization passes.