diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2015-02-01 10:11:22 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2015-02-01 10:11:22 +0000 |
commit | e038552c8ae99abe129837255273a992f72c6d9c (patch) | |
tree | 391c11977c8ac0b7230a1a747c4dc8d74d0f210a /llvm/lib/Target/TargetMachine.cpp | |
parent | 2844ca7319bab9dacceb499227c15391ce97fb87 (diff) | |
download | bcm5719-llvm-e038552c8ae99abe129837255273a992f72c6d9c.tar.gz bcm5719-llvm-e038552c8ae99abe129837255273a992f72c6d9c.zip |
[PM] Port TTI to the new pass manager, introducing a TargetIRAnalysis to
produce it.
This adds a function to the TargetMachine that produces this analysis
via a callback for each function. This in turn faves the way to produce
a *different* TTI per-function with the correct subtarget cached.
I've also done the necessary wiring in the opt tool to thread the target
machine down and make it available to the pass registry so that we can
construct this analysis from a target machine when available.
llvm-svn: 227721
Diffstat (limited to 'llvm/lib/Target/TargetMachine.cpp')
-rw-r--r-- | llvm/lib/Target/TargetMachine.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Target/TargetMachine.cpp b/llvm/lib/Target/TargetMachine.cpp index a8c877f848a..1e5bfb24729 100644 --- a/llvm/lib/Target/TargetMachine.cpp +++ b/llvm/lib/Target/TargetMachine.cpp @@ -172,6 +172,13 @@ void TargetMachine::setDataSections(bool V) { Options.DataSections = V; } +TargetIRAnalysis TargetMachine::getTargetIRAnalysis() { + // While targets are free to just override getTTI and rely on this analysis, + // it would be more efficient to override and provide an analysis that could + // directly construct that target's TTI without the virtual call. + return TargetIRAnalysis([this](Function &) { return getTTI(); }); +} + TargetTransformInfo TargetMachine::getTTI() { return TargetTransformInfo(getDataLayout()); } |