OLD | NEW |
(Empty) | |
| 1 //===-- JSTargetTransformInfo.h - JS 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 /// \file |
| 10 /// This file implements a TargetTransformInfo::Concept conforming object |
| 11 /// specific to the JS target machine. It uses the target's detailed information |
| 12 /// to provide more precise answers to certain TTI queries, while letting the |
| 13 /// target independent and default TTI implementations handle the rest. |
| 14 /// |
| 15 //===----------------------------------------------------------------------===// |
| 16 |
| 17 #ifndef LLVM_LIB_TARGET_JSBACKEND_JSTARGETTRANSFORMINFO_H |
| 18 #define LLVM_LIB_TARGET_JSBACKEND_JSTARGETTRANSFORMINFO_H |
| 19 |
| 20 #include "JS.h" |
| 21 #include "JSTargetMachine.h" |
| 22 #include "llvm/Analysis/TargetTransformInfo.h" |
| 23 #include "llvm/CodeGen/BasicTTIImpl.h" |
| 24 |
| 25 namespace llvm { |
| 26 |
| 27 class JSTTI : public BasicTTIImplBase<JSTTI> { |
| 28 typedef BasicTTIImplBase<JSTTI> BaseT; |
| 29 typedef TargetTransformInfo TTI; |
| 30 friend BaseT; |
| 31 |
| 32 const TargetSubtargetInfo *ST; |
| 33 const TargetLoweringBase *TLI; |
| 34 |
| 35 const TargetSubtargetInfo *getST() const { return ST; } |
| 36 const TargetLoweringBase *getTLI() const { return TLI; } |
| 37 |
| 38 public: |
| 39 explicit JSTTI(const JSTargetMachine *TM, Function &F) |
| 40 : BaseT(TM), ST(TM->getSubtargetImpl(F)), TLI(ST->getTargetLowering()) {} |
| 41 // Provide value semantics. MSVC requires that we spell all of these out. |
| 42 JSTTI(const JSTTI &Arg) |
| 43 : BaseT(static_cast<const BaseT &>(Arg)), ST(Arg.ST), TLI(Arg.TLI) {} |
| 44 JSTTI(JSTTI &&Arg) |
| 45 : BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)), |
| 46 TLI(std::move(Arg.TLI)) {} |
| 47 JSTTI &operator=(const JSTTI &RHS) { |
| 48 BaseT::operator=(static_cast<const BaseT &>(RHS)); |
| 49 ST = RHS.ST; |
| 50 TLI = RHS.TLI; |
| 51 return *this; |
| 52 } |
| 53 JSTTI &operator=(JSTTI &&RHS) { |
| 54 BaseT::operator=(std::move(static_cast<BaseT &>(RHS))); |
| 55 ST = std::move(RHS.ST); |
| 56 TLI = std::move(RHS.TLI); |
| 57 return *this; |
| 58 } |
| 59 |
| 60 |
| 61 TTI::PopcntSupportKind getPopcntSupport(unsigned IntTyWidthInBit); |
| 62 |
| 63 unsigned getRegisterBitWidth(bool Vector) const; |
| 64 |
| 65 unsigned getArithmeticInstrCost( |
| 66 unsigned Opcode, Type *Ty, |
| 67 TTI::OperandValueKind Opd1Info = TTI::OK_AnyValue, |
| 68 TTI::OperandValueKind Opd2Info = TTI::OK_AnyValue, |
| 69 TTI::OperandValueProperties Opd1PropInfo = TTI::OP_None, |
| 70 TTI::OperandValueProperties Opd2PropInfo = TTI::OP_None); |
| 71 |
| 72 unsigned getVectorInstrCost(unsigned Opcode, Type *Val, |
| 73 unsigned Index = -1); |
| 74 |
| 75 void getUnrollingPreferences(Loop *L, |
| 76 TTI::UnrollingPreferences &UP) const; |
| 77 }; |
| 78 |
| 79 } // end namespace llvm |
| 80 #endif |
OLD | NEW |