1 //===-- AMDGPUInstrInfo.h - AMDGPU Instruction Information ------*- 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 //
9 /// \file
10 /// Contains the definition of a TargetInstrInfo class that is common
11 /// to all AMD GPUs.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUINSTRINFO_H
16 #define LLVM_LIB_TARGET_AMDGPU_AMDGPUINSTRINFO_H
17 
18 #include "Utils/AMDGPUBaseInfo.h"
19 
20 namespace llvm {
21 
22 class GCNSubtarget;
23 class MachineMemOperand;
24 
25 class AMDGPUInstrInfo {
26 public:
27   explicit AMDGPUInstrInfo(const GCNSubtarget &st);
28 
29   static bool isUniformMMO(const MachineMemOperand *MMO);
30 };
31 
32 namespace AMDGPU {
33 
34 struct RsrcIntrinsic {
35   unsigned Intr;
36   uint8_t RsrcArg;
37   bool IsImage;
38 };
39 const RsrcIntrinsic *lookupRsrcIntrinsic(unsigned Intr);
40 
41 struct D16ImageDimIntrinsic {
42   unsigned Intr;
43   unsigned D16HelperIntr;
44 };
45 const D16ImageDimIntrinsic *lookupD16ImageDimIntrinsic(unsigned Intr);
46 
47 struct ImageDimIntrinsicInfo {
48   unsigned Intr;
49   unsigned BaseOpcode;
50   MIMGDim Dim;
51 
52   uint8_t NumOffsetArgs;
53   uint8_t NumBiasArgs;
54   uint8_t NumZCompareArgs;
55   uint8_t NumGradients;
56   uint8_t NumDmask;
57   uint8_t NumData;
58   uint8_t NumVAddrs;
59   uint8_t NumArgs;
60 
61   uint8_t DMaskIndex;
62   uint8_t VAddrStart;
63   uint8_t OffsetIndex;
64   uint8_t BiasIndex;
65   uint8_t ZCompareIndex;
66   uint8_t GradientStart;
67   uint8_t CoordStart;
68   uint8_t LodIndex;
69   uint8_t MipIndex;
70   uint8_t VAddrEnd;
71   uint8_t RsrcIndex;
72   uint8_t SampIndex;
73   uint8_t UnormIndex;
74   uint8_t TexFailCtrlIndex;
75   uint8_t CachePolicyIndex;
76 
77   uint8_t BiasTyArg;
78   uint8_t GradientTyArg;
79   uint8_t CoordTyArg;
80 };
81 const ImageDimIntrinsicInfo *getImageDimIntrinsicInfo(unsigned Intr);
82 
83 const ImageDimIntrinsicInfo *
84 getImageDimIntrinsicByBaseOpcode(unsigned BaseOpcode, unsigned Dim);
85 
86 } // end AMDGPU namespace
87 } // End llvm namespace
88 
89 #endif
90