llvm-6502/lib/Analysis/FunctionTargetTransformInfo.cpp
Chandler Carruth baceda736e [multiversion] Thread a function argument through all the callers of the
getTTI method used to get an actual TTI object.

No functionality changed. This just threads the argument and ensures
code like the inliner can correctly look up the callee's TTI rather than
using a fixed one.

The next change will use this to implement per-function subtarget usage
by TTI. The changes after that should eliminate the need for FTTI as that
will have become the default.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227730 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-01 12:01:35 +00:00

51 lines
1.8 KiB
C++

//===- 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_PASS_DEPENDENCY(TargetTransformInfoWrapperPass)
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<TargetTransformInfoWrapperPass>();
}
void FunctionTargetTransformInfo::releaseMemory() {}
bool FunctionTargetTransformInfo::runOnFunction(Function &F) {
Fn = &F;
TTI = &getAnalysis<TargetTransformInfoWrapperPass>().getTTI(F);
return false;
}