Go to the documentation of this file.
32 "cost-kind",
cl::desc(
"Target cost kind"),
35 "throughput",
"Reciprocal throughput"),
37 "latency",
"Instruction latency"),
39 "code-size",
"Code size"),
41 "size-latency",
"Code size and latency")));
44 cl::desc(
"Calculate intrinsics cost based only on argument types"),
47 #define CM_NAME "cost-model"
48 #define DEBUG_TYPE CM_NAME
74 static const char cm_name[] =
"Cost Model Analysis";
79 return new CostModelAnalysis();
83 CostModelAnalysis::getAnalysisUsage(
AnalysisUsage &AU)
const {
90 auto *TTIWP = getAnalysisIfAvailable<TargetTransformInfoWrapperPass>();
91 TTI = TTIWP ? &TTIWP->getTTI(
F) :
nullptr;
103 auto *II = dyn_cast<IntrinsicInst>(&Inst);
113 if (
auto CostVal =
Cost.getValue())
114 OS <<
"Cost Model: Found an estimated cost of " << *CostVal;
116 OS <<
"Cost Model: Invalid cost";
118 OS <<
" for instruction: " << Inst <<
"\n";
126 OS <<
"Printing analysis 'Cost Model Analysis' for function '" <<
F.getName() <<
"':\n";
132 auto *II = dyn_cast<IntrinsicInst>(&Inst);
142 if (
auto CostVal =
Cost.getValue())
143 OS <<
"Cost Model: Found an estimated cost of " << *CostVal;
145 OS <<
"Cost Model: Invalid cost";
147 OS <<
" for instruction: " << Inst <<
"\n";
A set of analyses that are preserved following a run of a transformation pass.
Analysis pass providing the TargetTransformInfo.
This is an optimization pass for GlobalISel generic memory operations.
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
static cl::opt< bool > TypeBasedIntrinsicCost("type-based-intrinsic-cost", cl::desc("Calculate intrinsics cost based only on argument types"), cl::init(false))
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
LLVM Basic Block Representation.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Represent the analysis usage information of a pass.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
This class implements an extremely fast bulk output stream that can only output to a stream.
FunctionPass * createCostModelAnalysisPass()
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
ValuesClass values(OptsTy... Options)
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...
static const char cm_name[]
initializer< Ty > init(const Ty &Val)
A Module instance is used to store all the information related to an LLVM module.
Printable print(const GCNRegPressure &RP, const GCNSubtarget *ST=nullptr)
static cl::opt< TargetTransformInfo::TargetCostKind > CostKind("cost-kind", cl::desc("Target cost kind"), cl::init(TargetTransformInfo::TCK_RecipThroughput), cl::values(clEnumValN(TargetTransformInfo::TCK_RecipThroughput, "throughput", "Reciprocal throughput"), clEnumValN(TargetTransformInfo::TCK_Latency, "latency", "Instruction latency"), clEnumValN(TargetTransformInfo::TCK_CodeSize, "code-size", "Code size"), clEnumValN(TargetTransformInfo::TCK_SizeAndLatency, "size-latency", "Code size and latency")))
#define clEnumValN(ENUMVAL, FLAGNAME, DESC)
static bool runOnFunction(Function &F, bool PostInlining)
void setPreservesAll()
Set by analyses that do not transform their input at all.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
static InstructionCost getInvalid(CostType Val=0)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
A container for analyses that lazily runs them and caches their results.
FunctionPass class - This class is used to implement most global optimizations.
void initializeCostModelAnalysisPass(PassRegistry &)