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
20namespace llvm {
21
22class MachineMemOperand;
23class MachineInstr;
24
25namespace AMDGPU {
26
27bool isUniformMMO(const MachineMemOperand *MMO);
28
29/// Return the intrinsic ID for opcodes with the G_AMDGPU_INTRIN_ prefix.
30///
31/// These opcodes have an Intrinsic::ID operand similar to a GIntrinsic. But
32/// they are not actual instances of GIntrinsics, so we cannot use
33/// GIntrinsic::getIntrinsicID() on them.
34Intrinsic::ID getIntrinsicID(const MachineInstr &I);
35
36struct RsrcIntrinsic {
37 unsigned Intr;
38 uint8_t RsrcArg;
39 bool IsImage;
40};
41const RsrcIntrinsic *lookupRsrcIntrinsic(unsigned Intr);
42
43struct ImageDimIntrinsicInfo {
44 unsigned Intr;
45 unsigned BaseOpcode;
46 unsigned AtomicNoRetBaseOpcode;
47 MIMGDim Dim;
48
49 uint8_t NumOffsetArgs;
50 uint8_t NumBiasArgs;
51 uint8_t NumZCompareArgs;
52 uint8_t NumGradients;
53 uint8_t NumDmask;
54 uint8_t NumData;
55 uint8_t NumVAddrs;
56 uint8_t NumArgs;
57
58 uint8_t DMaskIndex;
59 uint8_t VAddrStart;
60 uint8_t OffsetIndex;
61 uint8_t BiasIndex;
62 uint8_t ZCompareIndex;
63 uint8_t GradientStart;
64 uint8_t CoordStart;
65 uint8_t LodIndex;
66 uint8_t MipIndex;
67 uint8_t VAddrEnd;
68 uint8_t RsrcIndex;
69 uint8_t SampIndex;
70 uint8_t UnormIndex;
71 uint8_t TexFailCtrlIndex;
72 uint8_t CachePolicyIndex;
73
74 uint8_t BiasTyArg;
75 uint8_t GradientTyArg;
76 uint8_t CoordTyArg;
77};
78const ImageDimIntrinsicInfo *getImageDimIntrinsicInfo(unsigned Intr);
79
80const ImageDimIntrinsicInfo *
81getImageDimIntrinsicByBaseOpcode(unsigned BaseOpcode, unsigned Dim);
82
83} // end AMDGPU namespace
84} // End llvm namespace
85
86#endif
87