Path: blob/main/contrib/llvm-project/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.h
35269 views
//===- LoongArchTargetTransformInfo.h - LoongArch specific TTI --*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7/// \file8/// This file a TargetTransformInfo::Concept conforming object specific to the9/// LoongArch target machine. It uses the target's detailed information to10/// provide more precise answers to certain TTI queries, while letting the11/// target independent and default TTI implementations handle the rest.12///13//===----------------------------------------------------------------------===//1415#ifndef LLVM_LIB_TARGET_LOONGARCH_LOONGARCHTARGETTRANSFORMINFO_H16#define LLVM_LIB_TARGET_LOONGARCH_LOONGARCHTARGETTRANSFORMINFO_H1718#include "LoongArchSubtarget.h"19#include "LoongArchTargetMachine.h"20#include "llvm/Analysis/TargetTransformInfo.h"21#include "llvm/CodeGen/BasicTTIImpl.h"2223namespace llvm {2425class LoongArchTTIImpl : public BasicTTIImplBase<LoongArchTTIImpl> {26typedef BasicTTIImplBase<LoongArchTTIImpl> BaseT;27typedef TargetTransformInfo TTI;28friend BaseT;2930enum LoongArchRegisterClass { GPRRC, FPRRC, VRRC };31const LoongArchSubtarget *ST;32const LoongArchTargetLowering *TLI;3334const LoongArchSubtarget *getST() const { return ST; }35const LoongArchTargetLowering *getTLI() const { return TLI; }3637public:38explicit LoongArchTTIImpl(const LoongArchTargetMachine *TM, const Function &F)39: BaseT(TM, F.getDataLayout()), ST(TM->getSubtargetImpl(F)),40TLI(ST->getTargetLowering()) {}4142TypeSize getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const;43unsigned getNumberOfRegisters(unsigned ClassID) const;44unsigned getRegisterClassForType(bool Vector, Type *Ty = nullptr) const;45unsigned getMaxInterleaveFactor(ElementCount VF);46const char *getRegisterClassName(unsigned ClassID) const;4748// TODO: Implement more hooks to provide TTI machinery for LoongArch.49};5051} // end namespace llvm5253#endif // LLVM_LIB_TARGET_LOONGARCH_LOONGARCHTARGETTRANSFORMINFO_H545556