LLVM 22.0.0git
LoongArchTargetTransformInfo.h
Go to the documentation of this file.
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 TargetTransformInfoImplBase 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//===----------------------------------------------------------------------===//
15
16#ifndef LLVM_LIB_TARGET_LOONGARCH_LOONGARCHTARGETTRANSFORMINFO_H
17#define LLVM_LIB_TARGET_LOONGARCH_LOONGARCHTARGETTRANSFORMINFO_H
18
19#include "LoongArchSubtarget.h"
23
24namespace llvm {
25
26class LoongArchTTIImpl : public BasicTTIImplBase<LoongArchTTIImpl> {
28 typedef TargetTransformInfo TTI;
29 friend BaseT;
30
31 enum LoongArchRegisterClass { GPRRC, FPRRC, VRRC };
32 const LoongArchSubtarget *ST;
33 const LoongArchTargetLowering *TLI;
34
35 const LoongArchSubtarget *getST() const { return ST; }
36 const LoongArchTargetLowering *getTLI() const { return TLI; }
37
38public:
40 : BaseT(TM, F.getDataLayout()), ST(TM->getSubtargetImpl(F)),
41 TLI(ST->getTargetLowering()) {}
42
45 unsigned getNumberOfRegisters(unsigned ClassID) const override;
46 unsigned getRegisterClassForType(bool Vector,
47 Type *Ty = nullptr) const override;
48 unsigned getMaxInterleaveFactor(ElementCount VF) const override;
49 const char *getRegisterClassName(unsigned ClassID) const override;
50 TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth) const override;
51
52 unsigned getCacheLineSize() const override;
53 unsigned getPrefetchDistance() const override;
54 bool enableWritePrefetching() const override;
55
56 bool shouldExpandReduction(const IntrinsicInst *II) const override;
57
58 // TODO: Implement more hooks to provide TTI machinery for LoongArch.
59};
60
61} // end namespace llvm
62
63#endif // LLVM_LIB_TARGET_LOONGARCH_LOONGARCHTARGETTRANSFORMINFO_H
This file provides a helper that implements much of the TTI interface in terms of the target-independ...
#define F(x, y, z)
Definition MD5.cpp:55
uint64_t IntrinsicInst * II
This pass exposes codegen information to IR-level passes.
BasicTTIImplBase(const TargetMachine *TM, const DataLayout &DL)
A wrapper class for inspecting calls to intrinsic functions.
TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth) const override
unsigned getCacheLineSize() const override
bool shouldExpandReduction(const IntrinsicInst *II) const override
LoongArchTTIImpl(const LoongArchTargetMachine *TM, const Function &F)
unsigned getRegisterClassForType(bool Vector, Type *Ty=nullptr) const override
unsigned getMaxInterleaveFactor(ElementCount VF) const override
const char * getRegisterClassName(unsigned ClassID) const override
unsigned getNumberOfRegisters(unsigned ClassID) const override
unsigned getPrefetchDistance() const override
bool enableWritePrefetching() const override
TypeSize getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const override
virtual const DataLayout & getDataLayout() const
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
PopcntSupportKind
Flags indicating the kind of support for population count.
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:45
This is an optimization pass for GlobalISel generic memory operations.