diff options
author | Stephen Hines <srhines@google.com> | 2014-12-04 19:51:48 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-12-04 19:51:48 +0000 |
commit | a21bbdfad461e957fa42ac9d6860ddc9de2da3e9 (patch) | |
tree | 8d32ff2094b47e15a8def30d62fd7dee6e009de3 /lib/Analysis/FunctionTargetTransformInfo.cpp | |
parent | 6b8c6a5088c221af2b25065b8b6b8b0fec8a116f (diff) | |
parent | 876d6995443e99d13696f3941c3a789a4daa7c7a (diff) | |
download | external_llvm-a21bbdfad461e957fa42ac9d6860ddc9de2da3e9.zip external_llvm-a21bbdfad461e957fa42ac9d6860ddc9de2da3e9.tar.gz external_llvm-a21bbdfad461e957fa42ac9d6860ddc9de2da3e9.tar.bz2 |
am 876d6995: Merge "Update aosp/master LLVM for rebase to r222494."
* commit '876d6995443e99d13696f3941c3a789a4daa7c7a':
Update aosp/master LLVM for rebase to r222494.
Diffstat (limited to 'lib/Analysis/FunctionTargetTransformInfo.cpp')
-rw-r--r-- | lib/Analysis/FunctionTargetTransformInfo.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/lib/Analysis/FunctionTargetTransformInfo.cpp b/lib/Analysis/FunctionTargetTransformInfo.cpp new file mode 100644 index 0000000..a686bec --- /dev/null +++ b/lib/Analysis/FunctionTargetTransformInfo.cpp @@ -0,0 +1,50 @@ +//===- llvm/Analysis/FunctionTargetTransformInfo.h --------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This pass wraps a TargetTransformInfo in a FunctionPass so that it can +// forward along the current Function so that we can make target specific +// decisions based on the particular subtarget specified for each Function. +// +//===----------------------------------------------------------------------===// + +#include "llvm/InitializePasses.h" +#include "llvm/Analysis/FunctionTargetTransformInfo.h" + +using namespace llvm; + +#define DEBUG_TYPE "function-tti" +static const char ftti_name[] = "Function TargetTransformInfo"; +INITIALIZE_PASS_BEGIN(FunctionTargetTransformInfo, "function_tti", ftti_name, false, true) +INITIALIZE_AG_DEPENDENCY(TargetTransformInfo) +INITIALIZE_PASS_END(FunctionTargetTransformInfo, "function_tti", ftti_name, false, true) +char FunctionTargetTransformInfo::ID = 0; + +namespace llvm { +FunctionPass *createFunctionTargetTransformInfoPass() { + return new FunctionTargetTransformInfo(); +} +} + +FunctionTargetTransformInfo::FunctionTargetTransformInfo() + : FunctionPass(ID), Fn(nullptr), TTI(nullptr) { + initializeFunctionTargetTransformInfoPass(*PassRegistry::getPassRegistry()); +} + +void FunctionTargetTransformInfo::getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + AU.addRequired<TargetTransformInfo>(); +} + +void FunctionTargetTransformInfo::releaseMemory() {} + +bool FunctionTargetTransformInfo::runOnFunction(Function &F) { + Fn = &F; + TTI = &getAnalysis<TargetTransformInfo>(); + return false; +} |