From 8b04c0d26a21c724a82aa1c2ac7ab9c0b90b5f7c Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Sun, 1 Feb 2015 13:20:00 +0000 Subject: [multiversion] Switch all of the targets over to use the TargetIRAnalysis access path directly rather than implementing getTTI. This even removes getTTI from the interface. It's more efficient for each target to just register a precise callback that creates their specific TTI. As part of this, all of the targets which are building their subtargets individually per-function now build their TTI instance with the function and thus look up the correct subtarget and cache it. NVPTX, R600, and XCore currently don't leverage this functionality, but its trivial for them to add it now. llvm-svn: 227735 --- llvm/lib/Target/AArch64/AArch64TargetMachine.cpp | 6 ++++-- llvm/lib/Target/AArch64/AArch64TargetMachine.h | 4 ++-- llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'llvm/lib/Target/AArch64') diff --git a/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp b/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp index bbd85ea723c..c67359761bf 100644 --- a/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp +++ b/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp @@ -196,8 +196,10 @@ public: }; } // namespace -TargetTransformInfo AArch64TargetMachine::getTTI() { - return TargetTransformInfo(AArch64TTIImpl(this)); +TargetIRAnalysis AArch64TargetMachine::getTargetIRAnalysis() { + return TargetIRAnalysis([this](Function &F) { + return TargetTransformInfo(AArch64TTIImpl(this, F)); + }); } TargetPassConfig *AArch64TargetMachine::createPassConfig(PassManagerBase &PM) { diff --git a/llvm/lib/Target/AArch64/AArch64TargetMachine.h b/llvm/lib/Target/AArch64/AArch64TargetMachine.h index 6ed3bb4a35d..7143adf6c09 100644 --- a/llvm/lib/Target/AArch64/AArch64TargetMachine.h +++ b/llvm/lib/Target/AArch64/AArch64TargetMachine.h @@ -45,8 +45,8 @@ public: // Pass Pipeline Configuration TargetPassConfig *createPassConfig(PassManagerBase &PM) override; - /// \brief Register AArch64 analysis passes with a pass manager. - TargetTransformInfo getTTI() override; + /// \brief Get the TargetIRAnalysis for this target. + TargetIRAnalysis getTargetIRAnalysis() override; TargetLoweringObjectFile* getObjFileLowering() const override { return TLOF.get(); diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h index 5d4b9a39f67..8a98779d95b 100644 --- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h +++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h @@ -44,8 +44,8 @@ class AArch64TTIImpl : public BasicTTIImplBase { }; public: - explicit AArch64TTIImpl(const AArch64TargetMachine *TM) - : BaseT(TM), ST(TM->getSubtargetImpl()), TLI(ST->getTargetLowering()) {} + explicit AArch64TTIImpl(const AArch64TargetMachine *TM, Function &F) + : BaseT(TM), ST(TM->getSubtargetImpl(F)), TLI(ST->getTargetLowering()) {} // Provide value semantics. MSVC requires that we spell all of these out. AArch64TTIImpl(const AArch64TTIImpl &Arg) -- cgit v1.2.3