1 //===- llvm/Analysis/FunctionTargetTransformInfo.h --------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This pass wraps a TargetTransformInfo in a FunctionPass so that it can
11 // forward along the current Function so that we can make target specific
12 // decisions based on the particular subtarget specified for each Function.
14 //===----------------------------------------------------------------------===//
16 #include "llvm/InitializePasses.h"
17 #include "llvm/Analysis/FunctionTargetTransformInfo.h"
21 #define DEBUG_TYPE "function-tti"
22 static const char ftti_name[] = "Function TargetTransformInfo";
23 INITIALIZE_PASS_BEGIN(FunctionTargetTransformInfo, "function_tti", ftti_name, false, true)
24 INITIALIZE_AG_DEPENDENCY(TargetTransformInfo)
25 INITIALIZE_PASS_END(FunctionTargetTransformInfo, "function_tti", ftti_name, false, true)
26 char FunctionTargetTransformInfo::ID = 0;
29 FunctionPass *createFunctionTargetTransformInfoPass() {
30 return new FunctionTargetTransformInfo();
34 FunctionTargetTransformInfo::FunctionTargetTransformInfo()
35 : FunctionPass(ID), Fn(nullptr), TTI(nullptr) {
36 initializeFunctionTargetTransformInfoPass(*PassRegistry::getPassRegistry());
39 void FunctionTargetTransformInfo::getAnalysisUsage(AnalysisUsage &AU) const {
41 AU.addRequired<TargetTransformInfo>();
44 void FunctionTargetTransformInfo::releaseMemory() {}
46 bool FunctionTargetTransformInfo::runOnFunction(Function &F) {
48 TTI = &getAnalysis<TargetTransformInfo>();