10 #define DEBUG_TYPE "tti"
115 int64_t Scale)
const {
123 int64_t Scale)
const {
181 int Index,
Type *SubTp)
const {
195 Type *CondTy)
const {
200 unsigned Index)
const {
223 bool IsComplex)
const {
228 bool IsPairwise)
const {
241 virtual void initializePass() {
246 DL = getAnalysisIfAvailable<DataLayout>();
258 virtual void *getAdjustedAnalysisPointer(
const void *
ID) {
264 unsigned getOperationCost(
unsigned Opcode,
Type *Ty,
Type *OpTy)
const {
270 case Instruction::GetElementPtr:
273 case Instruction::BitCast:
274 assert(OpTy &&
"Cast instructions must provide the operand type");
282 case Instruction::IntToPtr: {
289 if (DL->isLegalInteger(OpSize) &&
290 OpSize <= DL->getPointerTypeSizeInBits(Ty))
296 case Instruction::PtrToInt: {
303 if (DL->isLegalInteger(DestSize) &&
304 DestSize >= DL->getPointerTypeSizeInBits(OpTy))
310 case Instruction::Trunc:
313 if (DL && DL->isLegalInteger(DL->getTypeSizeInBits(Ty)))
320 unsigned getGEPCost(
const Value *Ptr,
324 for (
unsigned Idx = 0, Size = Operands.
size(); Idx != Size; ++Idx)
325 if (!isa<Constant>(Operands[Idx]))
331 unsigned getCallCost(
FunctionType *FTy,
int NumArgs = -1)
const {
332 assert(FTy &&
"FunctionType must be provided to this routine.");
343 return TCC_Basic * (NumArgs + 1);
346 unsigned getCallCost(
const Function *
F,
int NumArgs = -1)
const {
347 assert(F &&
"A concrete function must be provided to this routine.");
357 return TopTTI->getIntrinsicCost(IID, FTy->
getReturnType(), ParamTys);
360 if (!TopTTI->isLoweredToCall(F))
366 unsigned getCallCost(
const Function *F,
371 return TopTTI->getCallCost(F, Arguments.
size());
404 for (
unsigned Idx = 0, Size = Arguments.
size(); Idx != Size; ++Idx)
405 ParamTys.
push_back(Arguments[Idx]->getType());
406 return TopTTI->getIntrinsicCost(IID, RetTy, ParamTys);
409 unsigned getUserCost(
const User *U)
const {
413 if (
const GEPOperator *GEP = dyn_cast<GEPOperator>(U))
416 return GEP->hasAllConstantIndices() ? TCC_Free : TCC_Basic;
419 const Function *F = CS.getCalledFunction();
423 return TopTTI->getCallCost(cast<FunctionType>(FTy), CS.arg_size());
432 return TopTTI->getCallCost(F, Arguments);
435 if (
const CastInst *CI = dyn_cast<CastInst>(U)) {
439 if (isa<CmpInst>(CI->getOperand(0)))
449 bool hasBranchDivergence()
const {
return false; }
451 bool isLoweredToCall(
const Function *F)
const {
466 if (Name ==
"copysign" || Name ==
"copysignf" || Name ==
"copysignl" ||
467 Name ==
"fabs" || Name ==
"fabsf" || Name ==
"fabsl" || Name ==
"sin" ||
468 Name ==
"sinf" || Name ==
"sinl" || Name ==
"cos" || Name ==
"cosf" ||
469 Name ==
"cosl" || Name ==
"sqrt" || Name ==
"sqrtf" || Name ==
"sqrtl")
473 if (Name ==
"pow" || Name ==
"powf" || Name ==
"powl" || Name ==
"exp2" ||
474 Name ==
"exp2l" || Name ==
"exp2f" || Name ==
"floor" || Name ==
475 "floorf" || Name ==
"ceil" || Name ==
"round" || Name ==
"ffs" ||
476 Name ==
"ffsl" || Name ==
"abs" || Name ==
"labs" || Name ==
"llabs")
482 void getUnrollingPreferences(
Loop *, UnrollingPreferences &)
const { }
484 bool isLegalAddImmediate(int64_t Imm)
const {
488 bool isLegalICmpImmediate(int64_t Imm)
const {
492 bool isLegalAddressingMode(
Type *Ty,
GlobalValue *BaseGV, int64_t BaseOffset,
493 bool HasBaseReg, int64_t Scale)
const {
496 return !BaseGV && BaseOffset == 0 && Scale <= 1;
500 bool HasBaseReg, int64_t Scale)
const {
502 if(isLegalAddressingMode(Ty, BaseGV, BaseOffset, HasBaseReg, Scale))
508 bool isTruncateFree(
Type *Ty1,
Type *Ty2)
const {
512 bool isTypeLegal(
Type *Ty)
const {
516 unsigned getJumpBufAlignment()
const {
520 unsigned getJumpBufSize()
const {
524 bool shouldBuildLookupTables()
const {
528 PopcntSupportKind getPopcntSupport(
unsigned IntTyWidthInBit)
const {
532 bool haveFastSqrt(
Type *Ty)
const {
536 unsigned getIntImmCost(
const APInt &Imm,
Type *Ty)
const {
540 unsigned getNumberOfRegisters(
bool Vector)
const {
544 unsigned getRegisterBitWidth(
bool Vector)
const {
548 unsigned getMaximumUnrollFactor()
const {
552 unsigned getArithmeticInstrCost(
unsigned Opcode,
Type *Ty, OperandValueKind,
553 OperandValueKind)
const {
557 unsigned getShuffleCost(ShuffleKind
Kind,
Type *Tp,
558 int Index = 0,
Type *SubTp = 0)
const {
562 unsigned getCastInstrCost(
unsigned Opcode,
Type *Dst,
567 unsigned getCFInstrCost(
unsigned Opcode)
const {
571 unsigned getCmpSelInstrCost(
unsigned Opcode,
Type *ValTy,
572 Type *CondTy = 0)
const {
576 unsigned getVectorInstrCost(
unsigned Opcode,
Type *Val,
577 unsigned Index = -1)
const {
581 unsigned getMemoryOpCost(
unsigned Opcode,
Type *Src,
593 unsigned getNumberOfParts(
Type *Tp)
const {
597 unsigned getAddressComputationCost(
Type *Tp,
bool)
const {
601 unsigned getReductionCost(
unsigned,
Type *,
bool)
const {
609 "No target information",
true,
true,
true)
void push_back(const T &Elt)
static PassRegistry * getPassRegistry()
unsigned getScalarSizeInBits()
unsigned getNumParams() const
unsigned getNumOperands() const
Type * getPointerElementType() const
StringRef getName() const
AnalysisUsage & addRequired()
Base class of casting instructions.
#define llvm_unreachable(msg)
param_iterator param_end() const
static unsigned getScalingFactorCost(const TargetTransformInfo &TTI, const LSRUse &LU, const Formula &F)
ID
LLVM Calling Convention Representation.
#define INITIALIZE_ANALYSIS_GROUP(agName, name, defaultPass)
size_t size() const
size - Get the array size.
User::const_op_iterator arg_iterator
unsigned getIntrinsicID() const LLVM_READONLY
param_iterator param_begin() const
Value * getOperand(unsigned i) const
#define INITIALIZE_AG_PASS(passName, agName, arg, name, cfg, analysis, def)
AnalysisType & getAnalysis() const
Class for arbitrary precision integers.
unsigned getOpcode() const
void initializeNoTTIPass(PassRegistry &)
ImmutableCallSite - establish a view to a call site for examination.
FunctionType * getFunctionType() const
bool hasLocalLinkage() const
Type * getReturnType() const
LLVM Value Representation.
ImmutablePass * createNoTargetTransformInfoPass()
Create the base case instance of a pass in the TTI analysis group.