brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · 9b479f9 Raw
65 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8/// \file9/// This file a TargetTransformInfoImplBase conforming object specific to the10/// LoongArch target machine. It uses the target's detailed information to11/// provide more precise answers to certain TTI queries, while letting the12/// target independent and default TTI implementations handle the rest.13///14//===----------------------------------------------------------------------===//15 16#ifndef LLVM_LIB_TARGET_LOONGARCH_LOONGARCHTARGETTRANSFORMINFO_H17#define LLVM_LIB_TARGET_LOONGARCH_LOONGARCHTARGETTRANSFORMINFO_H18 19#include "LoongArchSubtarget.h"20#include "LoongArchTargetMachine.h"21#include "llvm/Analysis/TargetTransformInfo.h"22#include "llvm/CodeGen/BasicTTIImpl.h"23 24namespace llvm {25 26class LoongArchTTIImpl : public BasicTTIImplBase<LoongArchTTIImpl> {27  typedef BasicTTIImplBase<LoongArchTTIImpl> BaseT;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:39  explicit LoongArchTTIImpl(const LoongArchTargetMachine *TM, const Function &F)40      : BaseT(TM, F.getDataLayout()), ST(TM->getSubtargetImpl(F)),41        TLI(ST->getTargetLowering()) {}42 43  TypeSize44  getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const override;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  TTI::MemCmpExpansionOptions59  enableMemCmpExpansion(bool OptSize, bool IsZeroCmp) const override;60};61 62} // end namespace llvm63 64#endif // LLVM_LIB_TARGET_LOONGARCH_LOONGARCHTARGETTRANSFORMINFO_H65