LLVM: lib/Target/BPF/BPFTargetTransformInfo.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#ifndef LLVM_LIB_TARGET_BPF_BPFTARGETTRANSFORMINFO_H
16#define LLVM_LIB_TARGET_BPF_BPFTARGETTRANSFORMINFO_H
17
22
23namespace llvm {
27 friend BaseT;
28
31
32 const BPFSubtarget *getST() const { return ST; }
34
35public:
37 : BaseT(TM, F.getDataLayout()), ST(TM->getSubtargetImpl(F)),
38 TLI(ST->getTargetLowering()) {}
39
42 if (Imm.getBitWidth() <= 64 && isInt<32>(Imm.getSExtValue()))
44
46 }
47
54 if (Opcode == Instruction::Select)
56
58 Op1Info, Op2Info, I);
59 }
60
66 const Instruction *CxtI = nullptr) const override {
67 int ISD = TLI->InstructionOpcodeToISD(Opcode);
70
72 Op2Info);
73 }
74
78 Options.LoadSizes = {8, 4, 2, 1};
79 Options.MaxNumLoads = TLI->getMaxExpandSizeMemcmp(OptSize);
81 }
82
84};
85
86}
87
88#endif
This file provides a helper that implements much of the TTI interface in terms of the target-independ...
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")))
This pass exposes codegen information to IR-level passes.
Class for arbitrary precision integers.
InstructionCost getIntImmCost(const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind) const override
Definition BPFTargetTransformInfo.h:40
InstructionCost getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy, CmpInst::Predicate VecPred, TTI::TargetCostKind CostKind, TTI::OperandValueInfo Op1Info={TTI::OK_AnyValue, TTI::OP_None}, TTI::OperandValueInfo Op2Info={TTI::OK_AnyValue, TTI::OP_None}, const llvm::Instruction *I=nullptr) const override
Definition BPFTargetTransformInfo.h:48
TTI::MemCmpExpansionOptions enableMemCmpExpansion(bool OptSize, bool IsZeroCmp) const override
Definition BPFTargetTransformInfo.h:76
InstructionCost getArithmeticInstrCost(unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind, TTI::OperandValueInfo Op1Info={TTI::OK_AnyValue, TTI::OP_None}, TTI::OperandValueInfo Op2Info={TTI::OK_AnyValue, TTI::OP_None}, ArrayRef< const Value * > Args={}, const Instruction *CxtI=nullptr) const override
Definition BPFTargetTransformInfo.h:61
BPFTTIImpl(const BPFTargetMachine *TM, const Function &F)
Definition BPFTargetTransformInfo.h:36
unsigned getMaxNumArgs() const override
Definition BPFTargetTransformInfo.h:83
InstructionCost getArithmeticInstrCost(unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind, TTI::OperandValueInfo Opd1Info={TTI::OK_AnyValue, TTI::OP_None}, TTI::OperandValueInfo Opd2Info={TTI::OK_AnyValue, TTI::OP_None}, ArrayRef< const Value * > Args={}, const Instruction *CxtI=nullptr) const override
InstructionCost getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy, CmpInst::Predicate VecPred, TTI::TargetCostKind CostKind, TTI::OperandValueInfo Op1Info={TTI::OK_AnyValue, TTI::OP_None}, TTI::OperandValueInfo Op2Info={TTI::OK_AnyValue, TTI::OP_None}, const Instruction *I=nullptr) const override
BasicTTIImplBase(const TargetMachine *TM, const DataLayout &DL)
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
virtual const DataLayout & getDataLayout() const
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
TargetCostKind
The kind of cost model.
@ TCK_RecipThroughput
Reciprocal throughput.
@ TCC_Free
Expected to fold away in lowering.
@ TCC_Basic
The cost of a typical 'add' instruction.
The instances of the Type class are immutable: once they are created, they are never changed.
@ ADD
Simple integer binary arithmetic operators.
friend class Instruction
Iterator for Instructions in a `BasicBlock.
This is an optimization pass for GlobalISel generic memory operations.
constexpr bool isInt(int64_t x)
Checks if an integer fits into the given bit width.
LLVM_ABI cl::opt< unsigned > SCEVCheapExpansionBudget
ArrayRef(const T &OneElt) -> ArrayRef< T >
Returns options for expansion of memcmp. IsZeroCmp is.