mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-03 19:32:35 +00:00
[PM] Update Clang for the new LLVM API in r227685 for managing the
TargetTransformInfo, and unify the code in a single place. llvm-svn: 227686
This commit is contained in:
parent
93dcdc47db
commit
aab5ec078e
@ -16,6 +16,7 @@
|
||||
#include "clang/Frontend/Utils.h"
|
||||
#include "llvm/ADT/StringSwitch.h"
|
||||
#include "llvm/Analysis/TargetLibraryInfo.h"
|
||||
#include "llvm/Analysis/TargetTransformInfo.h"
|
||||
#include "llvm/Bitcode/BitcodeWriterPass.h"
|
||||
#include "llvm/CodeGen/RegAllocRegistry.h"
|
||||
#include "llvm/CodeGen/SchedulerRegistry.h"
|
||||
@ -60,12 +61,18 @@ class EmitAssemblyHelper {
|
||||
mutable FunctionPassManager *PerFunctionPasses;
|
||||
|
||||
private:
|
||||
TargetTransformInfo getTTI() const {
|
||||
if (TM)
|
||||
return TM->getTTI();
|
||||
|
||||
return TargetTransformInfo(TheModule->getDataLayout());
|
||||
}
|
||||
|
||||
PassManager *getCodeGenPasses() const {
|
||||
if (!CodeGenPasses) {
|
||||
CodeGenPasses = new PassManager();
|
||||
CodeGenPasses->add(new DataLayoutPass());
|
||||
if (TM)
|
||||
TM->addAnalysisPasses(*CodeGenPasses);
|
||||
CodeGenPasses->add(createTargetTransformInfoWrapperPass(getTTI()));
|
||||
}
|
||||
return CodeGenPasses;
|
||||
}
|
||||
@ -74,8 +81,7 @@ private:
|
||||
if (!PerModulePasses) {
|
||||
PerModulePasses = new PassManager();
|
||||
PerModulePasses->add(new DataLayoutPass());
|
||||
if (TM)
|
||||
TM->addAnalysisPasses(*PerModulePasses);
|
||||
PerModulePasses->add(createTargetTransformInfoWrapperPass(getTTI()));
|
||||
}
|
||||
return PerModulePasses;
|
||||
}
|
||||
@ -84,8 +90,7 @@ private:
|
||||
if (!PerFunctionPasses) {
|
||||
PerFunctionPasses = new FunctionPassManager(TheModule);
|
||||
PerFunctionPasses->add(new DataLayoutPass());
|
||||
if (TM)
|
||||
TM->addAnalysisPasses(*PerFunctionPasses);
|
||||
PerFunctionPasses->add(createTargetTransformInfoWrapperPass(getTTI()));
|
||||
}
|
||||
return PerFunctionPasses;
|
||||
}
|
||||
@ -547,9 +552,6 @@ bool EmitAssemblyHelper::AddEmitPasses(BackendAction Action,
|
||||
createTLII(TargetTriple, CodeGenOpts));
|
||||
PM->add(new TargetLibraryInfoWrapperPass(*TLII));
|
||||
|
||||
// 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.
|
||||
TargetMachine::CodeGenFileType CGFT = TargetMachine::CGFT_AssemblyFile;
|
||||
|
Loading…
Reference in New Issue
Block a user