LLVM  10.0.0svn
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 
51  /// @}
52 
53  /// \name Vector TTI Implementations
54  /// @{
55 
56  unsigned getNumberOfRegisters(bool Vector);
57  unsigned getRegisterBitWidth(bool Vector) const;
58  unsigned getArithmeticInstrCost(
59  unsigned Opcode, Type *Ty,
65  unsigned getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index);
66 
67  /// @}
68 };
69 
70 } // end namespace llvm
71 
72 #endif
This class represents lattice values for constants.
Definition: AllocatorList.h:23
unsigned getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index)
WebAssemblyTTIImpl(const WebAssemblyTargetMachine *TM, const Function &F)
F(f)
Base class which can be used to help build a TTI implementation.
Definition: BasicTTIImpl.h:77
TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth) const
This file declares the WebAssembly-specific subclass of TargetMachine.
PopcntSupportKind
Flags indicating the kind of support for population count.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:32
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:45
This file provides a helper that implements much of the TTI interface in terms of the target-independ...
OperandValueProperties
Additional properties of an operand&#39;s values.
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
unsigned getRegisterBitWidth(bool Vector) const
unsigned getArithmeticInstrCost(unsigned Opcode, Type *Ty, 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 *>())
static const Function * getParent(const Value *V)
const DataLayout & getDataLayout() const
OperandValueKind
Additional information about an operand&#39;s possible values.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.