From d294bdb5ad1681e08169dc3c836ed5d81602eb88 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Sun, 1 Feb 2015 12:26:23 +0000 Subject: [PATCH] [multiversion] Update Clang for the API change in LLVM r227731. This moves all of the PassManager <-> Target communication to use the new pass manager's TargetIRAnalysis even with the old pass manager. See the LLVM commit for some of why things are moving in this direction, but the short version is that this will enable us to create per-function TargetTransformInfo objects that have correct subtarget information for that function. llvm-svn: 227732 --- clang/lib/CodeGen/BackendUtil.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index 6df34af86e76..c4cea02252c6 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -61,18 +61,19 @@ class EmitAssemblyHelper { mutable FunctionPassManager *PerFunctionPasses; private: - TargetTransformInfo getTTI() const { + TargetIRAnalysis getTargetIRAnalysis() const { if (TM) - return TM->getTTI(); + return TM->getTargetIRAnalysis(); - return TargetTransformInfo(TheModule->getDataLayout()); + return TargetIRAnalysis(); } PassManager *getCodeGenPasses() const { if (!CodeGenPasses) { CodeGenPasses = new PassManager(); CodeGenPasses->add(new DataLayoutPass()); - CodeGenPasses->add(createTargetTransformInfoWrapperPass(getTTI())); + CodeGenPasses->add( + createTargetTransformInfoWrapperPass(getTargetIRAnalysis())); } return CodeGenPasses; } @@ -81,7 +82,8 @@ private: if (!PerModulePasses) { PerModulePasses = new PassManager(); PerModulePasses->add(new DataLayoutPass()); - PerModulePasses->add(createTargetTransformInfoWrapperPass(getTTI())); + PerModulePasses->add( + createTargetTransformInfoWrapperPass(getTargetIRAnalysis())); } return PerModulePasses; } @@ -90,7 +92,8 @@ private: if (!PerFunctionPasses) { PerFunctionPasses = new FunctionPassManager(TheModule); PerFunctionPasses->add(new DataLayoutPass()); - PerFunctionPasses->add(createTargetTransformInfoWrapperPass(getTTI())); + PerFunctionPasses->add( + createTargetTransformInfoWrapperPass(getTargetIRAnalysis())); } return PerFunctionPasses; }