Revert " [LoongArch][ISel] Check the number of sign bits in `PatGprGpr_32` (#107432)"
[llvm-project.git] / llvm / lib / Target / LoongArch / LoongArchTargetTransformInfo.h
blobb2eef80dd9d3d2050d017e8212ede3db9c97b417
1 //===- LoongArchTargetTransformInfo.h - LoongArch 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 TargetTransformInfo::Concept conforming object specific to the
10 /// LoongArch 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 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_LIB_TARGET_LOONGARCH_LOONGARCHTARGETTRANSFORMINFO_H
17 #define LLVM_LIB_TARGET_LOONGARCH_LOONGARCHTARGETTRANSFORMINFO_H
19 #include "LoongArchSubtarget.h"
20 #include "LoongArchTargetMachine.h"
21 #include "llvm/Analysis/TargetTransformInfo.h"
22 #include "llvm/CodeGen/BasicTTIImpl.h"
24 namespace llvm {
26 class LoongArchTTIImpl : public BasicTTIImplBase<LoongArchTTIImpl> {
27 typedef BasicTTIImplBase<LoongArchTTIImpl> BaseT;
28 typedef TargetTransformInfo TTI;
29 friend BaseT;
31 enum LoongArchRegisterClass { GPRRC, FPRRC, VRRC };
32 const LoongArchSubtarget *ST;
33 const LoongArchTargetLowering *TLI;
35 const LoongArchSubtarget *getST() const { return ST; }
36 const LoongArchTargetLowering *getTLI() const { return TLI; }
38 public:
39 explicit LoongArchTTIImpl(const LoongArchTargetMachine *TM, const Function &F)
40 : BaseT(TM, F.getDataLayout()), ST(TM->getSubtargetImpl(F)),
41 TLI(ST->getTargetLowering()) {}
43 TypeSize getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const;
44 unsigned getNumberOfRegisters(unsigned ClassID) const;
45 unsigned getRegisterClassForType(bool Vector, Type *Ty = nullptr) const;
46 unsigned getMaxInterleaveFactor(ElementCount VF);
47 const char *getRegisterClassName(unsigned ClassID) const;
49 // TODO: Implement more hooks to provide TTI machinery for LoongArch.
52 } // end namespace llvm
54 #endif // LLVM_LIB_TARGET_LOONGARCH_LOONGARCHTARGETTRANSFORMINFO_H