LLVM 24.0.0git
AMDGPUMachineInstrs.h
Go to the documentation of this file.
1//===-- AMDGPUMachineInstrs.h -*- 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/// Convenience wrappers and helpers for AMDGPU-specific machine instructions.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEINSTRS_H
14#define LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEINSTRS_H
15
16#include "SIInstrInfo.h"
19
20namespace llvm {
21namespace AMDGPUMI {
22
23// Wrapper for the whole-dword VGPR "as memory" (address space 13) load/store
24// pseudos. The movrel form reads its index from M0, the GPR_IDX form from $idx:
25// movrel: load (outs data), (ins offset) store (ins data, offset)
26// gpr_idx: load (outs data), (ins idx, offset) store (ins data, idx, offset)
27class VLoadStoreIdxInst : public MachineInstr {
28 const AMDGPU::VLdStIdxOpcodeInfo &getInfo() const {
30 }
31
32public:
33 bool isGPRIdx() const { return getInfo().IsGPRIdx; }
34
37 assert(isGPRIdx() && "movrel form reads its index from M0");
38 return getOperand(1);
39 }
41 const MachineOperand &getDataOp() const { return getOperand(0); }
42 const MachineOperand &getIdxOp() const {
43 assert(isGPRIdx() && "movrel form reads its index from M0");
44 return getOperand(1);
45 }
46 const MachineOperand &getOffsetOp() const {
47 return getOperand(isGPRIdx() ? 2 : 1);
48 }
49
50 unsigned getBitWidth() const { return getInfo().BitWidth; }
51
52 // The VGPRs an index can reach, which excludes the AGPRs that gfx90a+ counts
53 // as addressable.
54 static unsigned getNumIndexableVGPRs(const MachineFunction &MF);
55
56 // Whether an access of this many bits is supported. Each supported width has
57 // a load and a store pseudo of both forms.
58 static bool isSupportedBitWidth(unsigned Bits);
59
60 static bool classof(const MachineInstr *MI) {
62 }
63};
64
65} // end namespace AMDGPUMI
66} // end namespace llvm
67
68#endif // LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEINSTRS_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
IRTranslator LLVM IR MI
Interface definition for SIInstrInfo.
const MachineOperand & getOffsetOp() const
static bool isSupportedBitWidth(unsigned Bits)
static unsigned getNumIndexableVGPRs(const MachineFunction &MF)
const MachineOperand & getIdxOp() const
static bool classof(const MachineInstr *MI)
const MachineOperand & getDataOp() const
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
const MachineOperand & getOperand(unsigned i) const
MachineOperand class - Representation of each machine instruction operand.
LLVM_READONLY const VLdStIdxOpcodeInfo * getVLdStIdxOpcodeInfoByOpcode(unsigned Opc)
constexpr bool isVGPRAsMem(const T &...O)
Definition SIDefines.h:328
This is an optimization pass for GlobalISel generic memory operations.