install a TargetLibraryInfo configured with the appropriate

target triple.  This would be a decent place to add -fno-builtin
info for example.

llvm-svn: 125971
This commit is contained in:
Chris Lattner 2011-02-18 22:20:38 +00:00
parent 15c8b5ef8b
commit d98cec5ca2
1 changed files with 12 additions and 3 deletions

View File

@ -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,