1//===-- MipsTargetTransformInfo.h - Mips 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#ifndef LLVM_LIB_TARGET_MIPS_MIPSTARGETTRANSFORMINFO_H
10#define LLVM_LIB_TARGET_MIPS_MIPSTARGETTRANSFORMINFO_H
11
12#include "MipsTargetMachine.h"
13#include "llvm/Analysis/TargetTransformInfo.h"
14#include "llvm/CodeGen/BasicTTIImpl.h"
15
16namespace llvm {
17
18class MipsTTIImpl final : public BasicTTIImplBase<MipsTTIImpl> {
19 using BaseT = BasicTTIImplBase<MipsTTIImpl>;
20 using TTI = TargetTransformInfo;
21
22 friend BaseT;
23
24 const MipsSubtarget *ST;
25 const MipsTargetLowering *TLI;
26
27 const MipsSubtarget *getST() const { return ST; }
28 const MipsTargetLowering *getTLI() const { return TLI; }
29
30public:
31 explicit MipsTTIImpl(const MipsTargetMachine *TM, const Function &F)
32 : BaseT(TM, F.getDataLayout()), ST(TM->getSubtargetImpl(F)),
33 TLI(ST->getTargetLowering()) {}
34
35 bool hasDivRemOp(Type *DataType, bool IsSigned) const override;
36
37 bool isLSRCostLess(const TargetTransformInfo::LSRCost &C1,
38 const TargetTransformInfo::LSRCost &C2) const override;
39
40 InstructionCost getPartialReductionCost(
41 unsigned Opcode, Type *InputTypeA, Type *InputTypeB, Type *AccumType,
42 ElementCount VF, TTI::PartialReductionExtendKind OpAExtend,
43 TTI::PartialReductionExtendKind OpBExtend, std::optional<unsigned> BinOp,
44 TTI::TargetCostKind CostKind,
45 std::optional<FastMathFlags> FMF) const override {
46 return InstructionCost::getInvalid();
47 }
48};
49
50} // end namespace llvm
51
52#endif
53