xref: /freebsd/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUInstrInfo.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
10b57cec5SDimitry Andric //===-- AMDGPUInstrInfo.h - AMDGPU Instruction Information ------*- C++ -*-===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric //
90b57cec5SDimitry Andric /// \file
100b57cec5SDimitry Andric /// Contains the definition of a TargetInstrInfo class that is common
110b57cec5SDimitry Andric /// to all AMD GPUs.
120b57cec5SDimitry Andric //
130b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
140b57cec5SDimitry Andric 
150b57cec5SDimitry Andric #ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUINSTRINFO_H
160b57cec5SDimitry Andric #define LLVM_LIB_TARGET_AMDGPU_AMDGPUINSTRINFO_H
170b57cec5SDimitry Andric 
180b57cec5SDimitry Andric #include "Utils/AMDGPUBaseInfo.h"
190b57cec5SDimitry Andric 
200b57cec5SDimitry Andric namespace llvm {
210b57cec5SDimitry Andric 
220b57cec5SDimitry Andric class GCNSubtarget;
23e8d8bef9SDimitry Andric class MachineMemOperand;
245f757f3fSDimitry Andric class MachineInstr;
250b57cec5SDimitry Andric 
260b57cec5SDimitry Andric class AMDGPUInstrInfo {
270b57cec5SDimitry Andric public:
280b57cec5SDimitry Andric   explicit AMDGPUInstrInfo(const GCNSubtarget &st);
290b57cec5SDimitry Andric 
300b57cec5SDimitry Andric   static bool isUniformMMO(const MachineMemOperand *MMO);
310b57cec5SDimitry Andric };
320b57cec5SDimitry Andric 
330b57cec5SDimitry Andric namespace AMDGPU {
340b57cec5SDimitry Andric 
355f757f3fSDimitry Andric /// Return the intrinsic ID for opcodes with the G_AMDGPU_INTRIN_ prefix.
365f757f3fSDimitry Andric ///
375f757f3fSDimitry Andric /// These opcodes have an Intrinsic::ID operand similar to a GIntrinsic. But
385f757f3fSDimitry Andric /// they are not actual instances of GIntrinsics, so we cannot use
395f757f3fSDimitry Andric /// GIntrinsic::getIntrinsicID() on them.
40*0fca6ea1SDimitry Andric Intrinsic::ID getIntrinsicID(const MachineInstr &I);
415f757f3fSDimitry Andric 
420b57cec5SDimitry Andric struct RsrcIntrinsic {
430b57cec5SDimitry Andric   unsigned Intr;
440b57cec5SDimitry Andric   uint8_t RsrcArg;
450b57cec5SDimitry Andric   bool IsImage;
460b57cec5SDimitry Andric };
470b57cec5SDimitry Andric const RsrcIntrinsic *lookupRsrcIntrinsic(unsigned Intr);
480b57cec5SDimitry Andric 
490b57cec5SDimitry Andric struct D16ImageDimIntrinsic {
500b57cec5SDimitry Andric   unsigned Intr;
510b57cec5SDimitry Andric   unsigned D16HelperIntr;
520b57cec5SDimitry Andric };
530b57cec5SDimitry Andric const D16ImageDimIntrinsic *lookupD16ImageDimIntrinsic(unsigned Intr);
540b57cec5SDimitry Andric 
550b57cec5SDimitry Andric struct ImageDimIntrinsicInfo {
560b57cec5SDimitry Andric   unsigned Intr;
570b57cec5SDimitry Andric   unsigned BaseOpcode;
580b57cec5SDimitry Andric   MIMGDim Dim;
59e8d8bef9SDimitry Andric 
6004eeddc0SDimitry Andric   uint8_t NumOffsetArgs;
6104eeddc0SDimitry Andric   uint8_t NumBiasArgs;
6204eeddc0SDimitry Andric   uint8_t NumZCompareArgs;
63e8d8bef9SDimitry Andric   uint8_t NumGradients;
64e8d8bef9SDimitry Andric   uint8_t NumDmask;
65e8d8bef9SDimitry Andric   uint8_t NumData;
66e8d8bef9SDimitry Andric   uint8_t NumVAddrs;
67e8d8bef9SDimitry Andric   uint8_t NumArgs;
68e8d8bef9SDimitry Andric 
69e8d8bef9SDimitry Andric   uint8_t DMaskIndex;
70e8d8bef9SDimitry Andric   uint8_t VAddrStart;
7104eeddc0SDimitry Andric   uint8_t OffsetIndex;
7204eeddc0SDimitry Andric   uint8_t BiasIndex;
7304eeddc0SDimitry Andric   uint8_t ZCompareIndex;
74e8d8bef9SDimitry Andric   uint8_t GradientStart;
75e8d8bef9SDimitry Andric   uint8_t CoordStart;
76e8d8bef9SDimitry Andric   uint8_t LodIndex;
77e8d8bef9SDimitry Andric   uint8_t MipIndex;
78e8d8bef9SDimitry Andric   uint8_t VAddrEnd;
79e8d8bef9SDimitry Andric   uint8_t RsrcIndex;
80e8d8bef9SDimitry Andric   uint8_t SampIndex;
81e8d8bef9SDimitry Andric   uint8_t UnormIndex;
82e8d8bef9SDimitry Andric   uint8_t TexFailCtrlIndex;
83e8d8bef9SDimitry Andric   uint8_t CachePolicyIndex;
84e8d8bef9SDimitry Andric 
8504eeddc0SDimitry Andric   uint8_t BiasTyArg;
86e8d8bef9SDimitry Andric   uint8_t GradientTyArg;
87e8d8bef9SDimitry Andric   uint8_t CoordTyArg;
880b57cec5SDimitry Andric };
890b57cec5SDimitry Andric const ImageDimIntrinsicInfo *getImageDimIntrinsicInfo(unsigned Intr);
900b57cec5SDimitry Andric 
91349cc55cSDimitry Andric const ImageDimIntrinsicInfo *
92349cc55cSDimitry Andric getImageDimIntrinsicByBaseOpcode(unsigned BaseOpcode, unsigned Dim);
935ffd83dbSDimitry Andric 
940b57cec5SDimitry Andric } // end AMDGPU namespace
950b57cec5SDimitry Andric } // End llvm namespace
960b57cec5SDimitry Andric 
970b57cec5SDimitry Andric #endif
98