LLVM  15.0.0git
WebAssemblyTargetTransformInfo.h
Go to the documentation of this file.
1 //==- WebAssemblyTargetTransformInfo.h - WebAssembly-specific TTI -*- C++ -*-=//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 ///
9 /// \file
10 /// This file a TargetTransformInfo::Concept conforming object specific
11 /// to the WebAssembly target machine.
12 ///
13 /// It uses the target's detailed information to provide more precise answers to
14 /// certain TTI queries, while letting the target independent and default TTI
15 /// implementations handle the rest.
16 ///
17 //===----------------------------------------------------------------------===//
18 
19 #ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYTARGETTRANSFORMINFO_H
20 #define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYTARGETTRANSFORMINFO_H
21 
24 #include <algorithm>
25 
26 namespace llvm {
27 
28 class WebAssemblyTTIImpl final : public BasicTTIImplBase<WebAssemblyTTIImpl> {
30  typedef TargetTransformInfo TTI;
31  friend BaseT;
32 
33  const WebAssemblySubtarget *ST;
34  const WebAssemblyTargetLowering *TLI;
35 
36  const WebAssemblySubtarget *getST() const { return ST; }
37  const WebAssemblyTargetLowering *getTLI() const { return TLI; }
38 
39 public:
41  : BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl(F)),
42  TLI(ST->getTargetLowering()) {}
43 
44  /// \name Scalar TTI Implementations
45  /// @{
46 
47  // TODO: Implement more Scalar TTI for WebAssembly
48 
49  TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth) const;
50 
53  OptimizationRemarkEmitter *ORE) const;
54 
55  /// @}
56 
57  /// \name Vector TTI Implementations
58  /// @{
59 
60  unsigned getNumberOfRegisters(unsigned ClassID) const;
63  unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
69  const Instruction *CxtI = nullptr);
70  InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val,
71  unsigned Index);
72 
73  /// @}
74 
75  bool areInlineCompatible(const Function *Caller,
76  const Function *Callee) const;
77 };
78 
79 } // end namespace llvm
80 
81 #endif
llvm::InstructionCost
Definition: InstructionCost.h:29
llvm::TargetTransformInfo::TargetCostKind
TargetCostKind
The kind of cost model.
Definition: TargetTransformInfo.h:210
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::Function
Definition: Function.h:60
llvm::Loop
Represents a single loop in the control flow graph.
Definition: LoopInfo.h:530
llvm::TargetTransformInfo::PopcntSupportKind
PopcntSupportKind
Flags indicating the kind of support for population count.
Definition: TargetTransformInfo.h:594
llvm::TargetTransformInfo
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
Definition: TargetTransformInfo.h:167
llvm::ScalarEvolution
The main scalar evolution driver.
Definition: ScalarEvolution.h:449
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
WebAssemblyTargetMachine.h
F
#define F(x, y, z)
Definition: MD5.cpp:55
llvm::WebAssemblyTargetLowering
Definition: WebAssemblyISelLowering.h:43
llvm::TargetTransformInfoImplBase::getDataLayout
const DataLayout & getDataLayout() const
Definition: TargetTransformInfoImpl.h:46
llvm::TargetTransformInfo::OP_None
@ OP_None
Definition: TargetTransformInfo.h:898
llvm::WebAssemblyTargetMachine
Definition: WebAssemblyTargetMachine.h:23
llvm::Instruction
Definition: Instruction.h:42
llvm::WebAssemblyTTIImpl::getVectorInstrCost
InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index)
Definition: WebAssemblyTargetTransformInfo.cpp:85
llvm::TargetTransformInfo::UnrollingPreferences
Parameters that control the generic loop unrolling transformation.
Definition: TargetTransformInfo.h:430
llvm::TargetTransformInfo::OperandValueProperties
OperandValueProperties
Additional properties of an operand's values.
Definition: TargetTransformInfo.h:898
llvm::BasicTTIImplBase
Base class which can be used to help build a TTI implementation.
Definition: BasicTTIImpl.h:77
llvm::WebAssemblyTTIImpl::getUnrollingPreferences
void getUnrollingPreferences(Loop *L, ScalarEvolution &SE, TTI::UnrollingPreferences &UP, OptimizationRemarkEmitter *ORE) const
Definition: WebAssemblyTargetTransformInfo.cpp:116
llvm::TargetTransformInfo::OperandValueKind
OperandValueKind
Additional information about an operand's possible values.
Definition: TargetTransformInfo.h:890
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::OptimizationRemarkEmitter
The optimization diagnostic interface.
Definition: OptimizationRemarkEmitter.h:33
CostKind
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")))
getParent
static const Function * getParent(const Value *V)
Definition: BasicAliasAnalysis.cpp:868
llvm::WebAssemblySubtarget
Definition: WebAssemblySubtarget.h:35
llvm::TargetTransformInfo::OK_AnyValue
@ OK_AnyValue
Definition: TargetTransformInfo.h:891
llvm::TypeSize
Definition: TypeSize.h:421
llvm::WebAssemblyTTIImpl::getPopcntSupport
TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth) const
Definition: WebAssemblyTargetTransformInfo.cpp:23
llvm::WebAssemblyTTIImpl::WebAssemblyTTIImpl
WebAssemblyTTIImpl(const WebAssemblyTargetMachine *TM, const Function &F)
Definition: WebAssemblyTargetTransformInfo.h:40
llvm::WebAssemblyTTIImpl::getRegisterBitWidth
TypeSize getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const
Definition: WebAssemblyTargetTransformInfo.cpp:39
llvm::TargetTransformInfo::RegisterKind
RegisterKind
Definition: TargetTransformInfo.h:919
llvm::WebAssemblyTTIImpl::getArithmeticInstrCost
InstructionCost getArithmeticInstrCost(unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind, TTI::OperandValueKind Opd1Info=TTI::OK_AnyValue, TTI::OperandValueKind Opd2Info=TTI::OK_AnyValue, TTI::OperandValueProperties Opd1PropInfo=TTI::OP_None, TTI::OperandValueProperties Opd2PropInfo=TTI::OP_None, ArrayRef< const Value * > Args=ArrayRef< const Value * >(), const Instruction *CxtI=nullptr)
Definition: WebAssemblyTargetTransformInfo.cpp:53
TM
const char LLVMTargetMachineRef TM
Definition: PassBuilderBindings.cpp:47
llvm::WebAssemblyTTIImpl::getNumberOfRegisters
unsigned getNumberOfRegisters(unsigned ClassID) const
Definition: WebAssemblyTargetTransformInfo.cpp:28
llvm::AMDGPU::HSAMD::Kernel::Key::Args
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Definition: AMDGPUMetadata.h:394
BasicTTIImpl.h
llvm::WebAssemblyTTIImpl::areInlineCompatible
bool areInlineCompatible(const Function *Caller, const Function *Callee) const
Definition: WebAssemblyTargetTransformInfo.cpp:98
llvm::WebAssemblyTTIImpl
Definition: WebAssemblyTargetTransformInfo.h:28