| 1 | //===-- SparcTargetTransformInfo.cpp - SPARC 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 | /// \file |
| 9 | /// This file a TargetTransformInfoImplBase conforming object specific to the |
| 10 | /// SPARC target machine. It uses the target's detailed information to |
| 11 | /// provide more precise answers to certain TTI queries, while letting the |
| 12 | /// target independent and default TTI implementations handle the rest. |
| 13 | /// |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
| 16 | #ifndef LLVM_LIB_TARGET_SPARC_SPARCTARGETTRANSFORMINFO_H |
| 17 | #define LLVM_LIB_TARGET_SPARC_SPARCTARGETTRANSFORMINFO_H |
| 18 | |
| 19 | #include "SparcTargetMachine.h" |
| 20 | #include "llvm/Analysis/TargetTransformInfo.h" |
| 21 | #include "llvm/CodeGen/BasicTTIImpl.h" |
| 22 | |
| 23 | namespace llvm { |
| 24 | |
| 25 | class SparcTTIImpl final : public BasicTTIImplBase<SparcTTIImpl> { |
| 26 | typedef BasicTTIImplBase<SparcTTIImpl> BaseT; |
| 27 | typedef TargetTransformInfo TTI; |
| 28 | friend BaseT; |
| 29 | |
| 30 | const SparcSubtarget *ST; |
| 31 | const SparcTargetLowering *TLI; |
| 32 | |
| 33 | const SparcSubtarget *getST() const { return ST; } |
| 34 | const SparcTargetLowering *getTLI() const { return TLI; } |
| 35 | |
| 36 | public: |
| 37 | explicit SparcTTIImpl(const SparcTargetMachine *TM, const Function &F) |
| 38 | : BaseT(TM, F.getDataLayout()), ST(TM->getSubtargetImpl(F)), |
| 39 | TLI(ST->getTargetLowering()) {} |
| 40 | |
| 41 | /// \name Scalar TTI Implementations |
| 42 | /// @{ |
| 43 | TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth) const override; |
| 44 | /// @} |
| 45 | |
| 46 | /// \name Vector TTI Implementations |
| 47 | /// @{ |
| 48 | enum SparcRegisterClass { GPRRC, FPRRC, FP128RRC, VRRC }; |
| 49 | unsigned getNumberOfRegisters(unsigned ClassID) const override; |
| 50 | unsigned getRegisterClassForType(bool Vector, |
| 51 | Type *Ty = nullptr) const override; |
| 52 | TypeSize |
| 53 | getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const override; |
| 54 | |
| 55 | InstructionCost getPartialReductionCost( |
| 56 | unsigned Opcode, Type *InputTypeA, Type *InputTypeB, Type *AccumType, |
| 57 | ElementCount VF, TTI::PartialReductionExtendKind OpAExtend, |
| 58 | TTI::PartialReductionExtendKind OpBExtend, std::optional<unsigned> BinOp, |
| 59 | TTI::TargetCostKind CostKind, |
| 60 | std::optional<FastMathFlags> FMF) const override { |
| 61 | return InstructionCost::getInvalid(); |
| 62 | } |
| 63 | /// @} |
| 64 | }; |
| 65 | |
| 66 | } // end namespace llvm |
| 67 | |
| 68 | #endif |
| 69 | |