LLVM: lib/Target/Lanai/LanaiTargetTransformInfo.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#ifndef LLVM_LIB_TARGET_LANAI_LANAITARGETTRANSFORMINFO_H
17#define LLVM_LIB_TARGET_LANAI_LANAITARGETTRANSFORMINFO_H
18
26
27namespace llvm {
31 friend BaseT;
32
35
38
39public:
41 : BaseT(TM, F.getDataLayout()), ST(TM->getSubtargetImpl(F)),
42 TLI(ST->getTargetLowering()) {}
43
45
48 if (TyWidth == 32)
51 }
52
55 assert(Ty->isIntegerTy());
56 unsigned BitSize = Ty->getPrimitiveSizeInBits();
57
58
59 if (BitSize == 0)
61
62
63 if (BitSize > 64)
65
66 if (Imm == 0)
68 if (isInt<16>(Imm.getSExtValue()))
70 if (isInt<21>(Imm.getZExtValue()))
72 if (isInt<32>(Imm.getSExtValue())) {
73 if ((Imm.getSExtValue() & 0xFFFF) == 0)
76 }
77
79 }
80
87
93
99 const Instruction *CxtI = nullptr) const override {
100 int ISD = TLI->InstructionOpcodeToISD(Opcode);
101
102 switch (ISD) {
103 default:
105 Op2Info);
110
111
112
113
114
116 Op2Info);
117 }
118 }
119};
120
121}
122
123#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
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 file describes how to lower LLVM code to machine code.
This pass exposes codegen information to IR-level passes.
Class for arbitrary precision integers.
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
BasicTTIImplBase(const TargetMachine *TM, const DataLayout &DL)
LanaiTTIImpl(const LanaiTargetMachine *TM, const Function &F)
Definition LanaiTargetTransformInfo.h:40
InstructionCost getIntImmCostInst(unsigned Opc, unsigned Idx, const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind, Instruction *Inst=nullptr) const override
Definition LanaiTargetTransformInfo.h:82
InstructionCost getIntImmCostIntrin(Intrinsic::ID IID, unsigned Idx, const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind) const override
Definition LanaiTargetTransformInfo.h:89
bool shouldBuildLookupTables() const override
Definition LanaiTargetTransformInfo.h:44
TargetTransformInfo::PopcntSupportKind getPopcntSupport(unsigned TyWidth) const override
Definition LanaiTargetTransformInfo.h:47
InstructionCost getIntImmCost(const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind) const override
Definition LanaiTargetTransformInfo.h:53
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 LanaiTargetTransformInfo.h:94
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.
PopcntSupportKind
Flags indicating the kind of support for population count.
@ 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.
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.
ArrayRef(const T &OneElt) -> ArrayRef< T >