40 "cost-kind",
cl::desc(
"Target cost kind"),
43 "Reciprocal throughput"),
45 "Instruction latency"),
48 "Code size and latency"),
58 "intrinsic-cost-strategy",
59 cl::desc(
"Costing strategy for intrinsic instructions"),
63 "Use TargetTransformInfo::getInstructionCost"),
65 "Use TargetTransformInfo::getIntrinsicInstrCost"),
68 "type-based-intrinsic-cost",
69 "Calculate the intrinsic cost based only on argument types")));
71#define CM_NAME "cost-model"
72#define DEBUG_TYPE CM_NAME
77 auto *
II = dyn_cast<IntrinsicInst>(&Inst);
110 OS <<
"Printing analysis 'Cost Model Analysis' for function '" <<
F.getName() <<
"':\n";
113 OS <<
"Cost Model: ";
114 if (
CostKind == OutputCostKind::All) {
115 OS <<
"Found costs of ";
122 if (RThru ==
CodeSize && RThru == Lat && RThru == SizeLat)
125 OS <<
"RThru:" << RThru <<
" CodeSize:" <<
CodeSize <<
" Lat:" << Lat
126 <<
" SizeLat:" << SizeLat;
127 OS <<
" for: " << Inst <<
"\n";
134 OS <<
"Invalid cost";
135 OS <<
" for instruction: " << Inst <<
"\n";
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define clEnumValN(ENUMVAL, FLAGNAME, DESC)
static cl::opt< OutputCostKind > CostKind("cost-kind", cl::desc("Target cost kind"), cl::init(OutputCostKind::RecipThroughput), cl::values(clEnumValN(OutputCostKind::RecipThroughput, "throughput", "Reciprocal throughput"), clEnumValN(OutputCostKind::Latency, "latency", "Instruction latency"), clEnumValN(OutputCostKind::CodeSize, "code-size", "Code size"), clEnumValN(OutputCostKind::SizeAndLatency, "size-latency", "Code size and latency"), clEnumValN(OutputCostKind::All, "all", "Print all cost kinds")))
static cl::opt< IntrinsicCostStrategy > IntrinsicCost("intrinsic-cost-strategy", cl::desc("Costing strategy for intrinsic instructions"), cl::init(IntrinsicCostStrategy::InstructionCost), cl::values(clEnumValN(IntrinsicCostStrategy::InstructionCost, "instruction-cost", "Use TargetTransformInfo::getInstructionCost"), clEnumValN(IntrinsicCostStrategy::IntrinsicCost, "intrinsic-cost", "Use TargetTransformInfo::getIntrinsicInstrCost"), clEnumValN(IntrinsicCostStrategy::TypeBasedIntrinsicCost, "type-based-intrinsic-cost", "Calculate the intrinsic cost based only on argument types")))
static TTI::TargetCostKind OutputCostKindToTargetCostKind(OutputCostKind CostKind)
static InstructionCost getCost(Instruction &Inst, TTI::TargetCostKind CostKind, TargetTransformInfo &TTI, TargetLibraryInfo &TLI)
This header defines various interfaces for pass management in LLVM.
uint64_t IntrinsicInst * II
A container for analyses that lazily runs them and caches their results.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
LLVM Basic Block Representation.
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
static InstructionCost getInvalid(CostType Val=0)
CostType getValue() const
This function is intended to be used as sparingly as possible, since the class provides the full rang...
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Analysis pass providing the TargetTransformInfo.
Analysis pass providing the TargetLibraryInfo.
Provides information about what library functions are available for the current target.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
ValuesClass values(OptsTy... Options)
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.