LLVM API Documentation

FunctionTargetTransformInfo.h
Go to the documentation of this file.
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 #ifndef LLVM_ANALYSIS_FUNCTIONTARGETTRANSFORMINFO_H
00017 #define LLVM_ANALYSIS_FUNCTIONTARGETTRANSFORMINFO_H
00018 
00019 #include "llvm/Pass.h"
00020 #include "TargetTransformInfo.h"
00021 
00022 namespace llvm {
00023 class FunctionTargetTransformInfo final : public FunctionPass {
00024 private:
00025   const Function *Fn;
00026   const TargetTransformInfo *TTI;
00027 
00028   FunctionTargetTransformInfo(const FunctionTargetTransformInfo &)
00029       LLVM_DELETED_FUNCTION;
00030   void operator=(const FunctionTargetTransformInfo &) LLVM_DELETED_FUNCTION;
00031 
00032 public:
00033   static char ID;
00034   FunctionTargetTransformInfo();
00035 
00036   // Implementation boilerplate.
00037   void getAnalysisUsage(AnalysisUsage &AU) const override;
00038   void releaseMemory() override;
00039   bool runOnFunction(Function &F) override;
00040 
00041   // Shimmed functions from TargetTransformInfo.
00042   void
00043   getUnrollingPreferences(Loop *L,
00044                           TargetTransformInfo::UnrollingPreferences &UP) const {
00045     TTI->getUnrollingPreferences(Fn, L, UP);
00046   }
00047 };
00048 }
00049 #endif