#include "llvm/Analysis/CostModel.h"
#include "llvm/Analysis/Passes.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/PassManager.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/IR/IntrinsicInst.h"
usingnamespacellvm;
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")));
static cl::opt<bool> TypeBasedIntrinsicCost("type-based-intrinsic-cost",
cl::desc("Calculate intrinsics cost based only on argument types"),
cl::init(false));
#define CM_NAME …
#define DEBUG_TYPE …
PreservedAnalyses CostModelPrinterPass::run(Function &F,
FunctionAnalysisManager &AM) { … }