From: Chandler Carruth Date: Mon, 7 Jan 2013 01:38:01 +0000 (+0000) Subject: Switch to asking the target machine to add any relevant analysis passses X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d938e87458f18ffe4314936c5ab985b6b232c31f;p=clang Switch to asking the target machine to add any relevant analysis passses 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 --- diff --git a/lib/CodeGen/BackendUtil.cpp b/lib/CodeGen/BackendUtil.cpp index 967f3291e1..d343207545 100644 --- a/lib/CodeGen/BackendUtil.cpp +++ b/lib/CodeGen/BackendUtil.cpp @@ -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.