From df61976bd157a7b5483c92c032834e178fb6fd88 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 18 Feb 2011 22:20:38 +0000 Subject: [PATCH] install a TargetLibraryInfo configured with the appropriate target triple. This would be a decent place to add -fno-builtin info for example. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125971 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/BackendUtil.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/CodeGen/BackendUtil.cpp b/lib/CodeGen/BackendUtil.cpp index f12715ac27..80c3b9cd44 100644 --- a/lib/CodeGen/BackendUtil.cpp +++ b/lib/CodeGen/BackendUtil.cpp @@ -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 @@ void EmitAssemblyHelper::CreatePasses() { 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 @@ void EmitAssemblyHelper::CreatePasses() { 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, -- 2.40.0