xref: /minix3/external/bsd/llvm/dist/llvm/lib/Analysis/FunctionTargetTransformInfo.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc //===- llvm/Analysis/FunctionTargetTransformInfo.h --------------*- C++ -*-===//
2*0a6a1f1dSLionel Sambuc //
3*0a6a1f1dSLionel Sambuc //                     The LLVM Compiler Infrastructure
4*0a6a1f1dSLionel Sambuc //
5*0a6a1f1dSLionel Sambuc // This file is distributed under the University of Illinois Open Source
6*0a6a1f1dSLionel Sambuc // License. See LICENSE.TXT for details.
7*0a6a1f1dSLionel Sambuc //
8*0a6a1f1dSLionel Sambuc //===----------------------------------------------------------------------===//
9*0a6a1f1dSLionel Sambuc //
10*0a6a1f1dSLionel Sambuc // This pass wraps a TargetTransformInfo in a FunctionPass so that it can
11*0a6a1f1dSLionel Sambuc // forward along the current Function so that we can make target specific
12*0a6a1f1dSLionel Sambuc // decisions based on the particular subtarget specified for each Function.
13*0a6a1f1dSLionel Sambuc //
14*0a6a1f1dSLionel Sambuc //===----------------------------------------------------------------------===//
15*0a6a1f1dSLionel Sambuc 
16*0a6a1f1dSLionel Sambuc #include "llvm/InitializePasses.h"
17*0a6a1f1dSLionel Sambuc #include "llvm/Analysis/FunctionTargetTransformInfo.h"
18*0a6a1f1dSLionel Sambuc 
19*0a6a1f1dSLionel Sambuc using namespace llvm;
20*0a6a1f1dSLionel Sambuc 
21*0a6a1f1dSLionel Sambuc #define DEBUG_TYPE "function-tti"
22*0a6a1f1dSLionel Sambuc static const char ftti_name[] = "Function TargetTransformInfo";
23*0a6a1f1dSLionel Sambuc INITIALIZE_PASS_BEGIN(FunctionTargetTransformInfo, "function_tti", ftti_name, false, true)
24*0a6a1f1dSLionel Sambuc INITIALIZE_AG_DEPENDENCY(TargetTransformInfo)
25*0a6a1f1dSLionel Sambuc INITIALIZE_PASS_END(FunctionTargetTransformInfo, "function_tti", ftti_name, false, true)
26*0a6a1f1dSLionel Sambuc char FunctionTargetTransformInfo::ID = 0;
27*0a6a1f1dSLionel Sambuc 
28*0a6a1f1dSLionel Sambuc namespace llvm {
createFunctionTargetTransformInfoPass()29*0a6a1f1dSLionel Sambuc FunctionPass *createFunctionTargetTransformInfoPass() {
30*0a6a1f1dSLionel Sambuc   return new FunctionTargetTransformInfo();
31*0a6a1f1dSLionel Sambuc }
32*0a6a1f1dSLionel Sambuc }
33*0a6a1f1dSLionel Sambuc 
FunctionTargetTransformInfo()34*0a6a1f1dSLionel Sambuc FunctionTargetTransformInfo::FunctionTargetTransformInfo()
35*0a6a1f1dSLionel Sambuc   : FunctionPass(ID), Fn(nullptr), TTI(nullptr) {
36*0a6a1f1dSLionel Sambuc   initializeFunctionTargetTransformInfoPass(*PassRegistry::getPassRegistry());
37*0a6a1f1dSLionel Sambuc }
38*0a6a1f1dSLionel Sambuc 
getAnalysisUsage(AnalysisUsage & AU) const39*0a6a1f1dSLionel Sambuc void FunctionTargetTransformInfo::getAnalysisUsage(AnalysisUsage &AU) const {
40*0a6a1f1dSLionel Sambuc   AU.setPreservesAll();
41*0a6a1f1dSLionel Sambuc   AU.addRequired<TargetTransformInfo>();
42*0a6a1f1dSLionel Sambuc }
43*0a6a1f1dSLionel Sambuc 
releaseMemory()44*0a6a1f1dSLionel Sambuc void FunctionTargetTransformInfo::releaseMemory() {}
45*0a6a1f1dSLionel Sambuc 
runOnFunction(Function & F)46*0a6a1f1dSLionel Sambuc bool FunctionTargetTransformInfo::runOnFunction(Function &F) {
47*0a6a1f1dSLionel Sambuc   Fn = &F;
48*0a6a1f1dSLionel Sambuc   TTI = &getAnalysis<TargetTransformInfo>();
49*0a6a1f1dSLionel Sambuc   return false;
50*0a6a1f1dSLionel Sambuc }
51