LLVM  8.0.1
WebAssemblyTargetTransformInfo.h
Go to the documentation of this file.
1 //==- WebAssemblyTargetTransformInfo.h - WebAssembly-specific TTI -*- C++ -*-=//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 ///
10 /// \file
11 /// This file a TargetTransformInfo::Concept conforming object specific
12 /// to the WebAssembly target machine.
13 ///
14 /// It uses the target's detailed information to provide more precise answers to
15 /// certain TTI queries, while letting the target independent and default TTI
16 /// implementations handle the rest.
17 ///
18 //===----------------------------------------------------------------------===//
19 
20 #ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYTARGETTRANSFORMINFO_H
21 #define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYTARGETTRANSFORMINFO_H
22 
25 #include <algorithm>
26 
27 namespace llvm {
28 
29 class WebAssemblyTTIImpl final : public BasicTTIImplBase<WebAssemblyTTIImpl> {
31  typedef TargetTransformInfo TTI;
32  friend BaseT;
33 
34  const WebAssemblySubtarget *ST;
35  const WebAssemblyTargetLowering *TLI;
36 
37  const WebAssemblySubtarget *getST() const { return ST; }
38  const WebAssemblyTargetLowering *getTLI() const { return TLI; }
39 
40 public:
42  : BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl(F)),
43  TLI(ST->getTargetLowering()) {}
44 
45  /// \name Scalar TTI Implementations
46  /// @{
47 
48  // TODO: Implement more Scalar TTI for WebAssembly
49 
50  TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth) const;
51 
52  /// @}
53 
54  /// \name Vector TTI Implementations
55  /// @{
56 
57  unsigned getNumberOfRegisters(bool Vector);
58  unsigned getRegisterBitWidth(bool Vector) const;
59  unsigned getArithmeticInstrCost(
60  unsigned Opcode, Type *Ty,
66  unsigned getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index);
67 
68  /// @}
69 };
70 
71 } // end namespace llvm
72 
73 #endif
This class represents lattice values for constants.
Definition: AllocatorList.h:24
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:78
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:33
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:46
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.