LLVM API Documentation
00001 //===- llvm/Analysis/FunctionTargetTransformInfo.h --------------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This pass wraps a TargetTransformInfo in a FunctionPass so that it can 00011 // forward along the current Function so that we can make target specific 00012 // decisions based on the particular subtarget specified for each Function. 00013 // 00014 //===----------------------------------------------------------------------===// 00015 00016 #include "llvm/InitializePasses.h" 00017 #include "llvm/Analysis/FunctionTargetTransformInfo.h" 00018 00019 using namespace llvm; 00020 00021 #define DEBUG_TYPE "function-tti" 00022 static const char ftti_name[] = "Function TargetTransformInfo"; 00023 INITIALIZE_PASS_BEGIN(FunctionTargetTransformInfo, "function_tti", ftti_name, false, true) 00024 INITIALIZE_AG_DEPENDENCY(TargetTransformInfo) 00025 INITIALIZE_PASS_END(FunctionTargetTransformInfo, "function_tti", ftti_name, false, true) 00026 char FunctionTargetTransformInfo::ID = 0; 00027 00028 namespace llvm { 00029 FunctionPass *createFunctionTargetTransformInfoPass() { 00030 return new FunctionTargetTransformInfo(); 00031 } 00032 } 00033 00034 FunctionTargetTransformInfo::FunctionTargetTransformInfo() 00035 : FunctionPass(ID), Fn(nullptr), TTI(nullptr) { 00036 initializeFunctionTargetTransformInfoPass(*PassRegistry::getPassRegistry()); 00037 } 00038 00039 void FunctionTargetTransformInfo::getAnalysisUsage(AnalysisUsage &AU) const { 00040 AU.setPreservesAll(); 00041 AU.addRequired<TargetTransformInfo>(); 00042 } 00043 00044 void FunctionTargetTransformInfo::releaseMemory() {} 00045 00046 bool FunctionTargetTransformInfo::runOnFunction(Function &F) { 00047 Fn = &F; 00048 TTI = &getAnalysis<TargetTransformInfo>(); 00049 return false; 00050 }