1 //==- WebAssemblyTargetTransformInfo.h - WebAssembly-specific TTI -*- C++ -*-=//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// \brief This file a TargetTransformInfo::Concept conforming object specific
12 /// to the WebAssembly target machine.
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.
18 //===----------------------------------------------------------------------===//
20 #ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYTARGETTRANSFORMINFO_H
21 #define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYTARGETTRANSFORMINFO_H
23 #include "WebAssemblyTargetMachine.h"
24 #include "llvm/CodeGen/BasicTTIImpl.h"
29 class WebAssemblyTTIImpl final : public BasicTTIImplBase<WebAssemblyTTIImpl> {
30 typedef BasicTTIImplBase<WebAssemblyTTIImpl> BaseT;
31 typedef TargetTransformInfo TTI;
34 const WebAssemblySubtarget *ST;
35 const WebAssemblyTargetLowering *TLI;
37 const WebAssemblySubtarget *getST() const { return ST; }
38 const WebAssemblyTargetLowering *getTLI() const { return TLI; }
41 WebAssemblyTTIImpl(const WebAssemblyTargetMachine *TM, const Function &F)
42 : BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl(F)),
43 TLI(ST->getTargetLowering()) {}
45 // Provide value semantics. MSVC requires that we spell all of these out.
46 WebAssemblyTTIImpl(const WebAssemblyTTIImpl &Arg)
47 : BaseT(static_cast<const BaseT &>(Arg)), ST(Arg.ST), TLI(Arg.TLI) {}
48 WebAssemblyTTIImpl(WebAssemblyTTIImpl &&Arg)
49 : BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)),
50 TLI(std::move(Arg.TLI)) {}
52 /// \name Scalar TTI Implementations
55 // TODO: Implement more Scalar TTI for WebAssembly
57 TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth) const;
58 bool haveFastSqrt(Type *Ty) const;
62 /// \name Vector TTI Implementations
65 // TODO: Implement Vector TTI for WebAssembly
70 } // end namespace llvm