LLVM 19.0.0git
AMDGPUInstrInfo.cpp
Go to the documentation of this file.
1//===-- AMDGPUInstrInfo.cpp - Base class for AMD GPU InstrInfo ------------===//
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/// \brief Implementation of the TargetInstrInfo class that is common to all
11/// AMD GPUs.
12//
13//===----------------------------------------------------------------------===//
14
15#include "AMDGPUInstrInfo.h"
16#include "AMDGPU.h"
19#include "llvm/IR/Constants.h"
20#include "llvm/IR/Instruction.h"
21#include "llvm/IR/Value.h"
22
23using namespace llvm;
24
25// Pin the vtable to this file.
26//void AMDGPUInstrInfo::anchor() {}
27
29
31 return I.getOperand(I.getNumExplicitDefs()).getIntrinsicID();
32}
33
34// TODO: Should largely merge with AMDGPUTTIImpl::isSourceOfDivergence.
36 const Value *Ptr = MMO->getValue();
37 // UndefValue means this is a load of a kernel input. These are uniform.
38 // Sometimes LDS instructions have constant pointers.
39 // If Ptr is null, then that means this mem operand contains a
40 // PseudoSourceValue like GOT.
41 if (!Ptr || isa<UndefValue>(Ptr) ||
42 isa<Constant>(Ptr) || isa<GlobalValue>(Ptr))
43 return true;
44
46 return true;
47
48 if (const Argument *Arg = dyn_cast<Argument>(Ptr))
49 return AMDGPU::isArgPassedInSGPR(Arg);
50
51 const Instruction *I = dyn_cast<Instruction>(Ptr);
52 return I && I->getMetadata("amdgpu.uniform");
53}
Contains the definition of a TargetInstrInfo class that is common to all AMD GPUs.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
#define I(x, y, z)
Definition: MD5.cpp:58
AMDGPUInstrInfo(const GCNSubtarget &st)
static bool isUniformMMO(const MachineMemOperand *MMO)
This class represents an incoming formal argument to a Function.
Definition: Argument.h:28
Representation of each machine instruction.
Definition: MachineInstr.h:69
A description of a memory reference used in the backend.
unsigned getAddrSpace() const
const Value * getValue() const
Return the base address of the memory access.
LLVM Value Representation.
Definition: Value.h:74
@ CONSTANT_ADDRESS_32BIT
Address space for 32-bit constant memory.
bool isArgPassedInSGPR(const Argument *A)
unsigned getIntrinsicID(const MachineInstr &I)
Return the intrinsic ID for opcodes with the G_AMDGPU_INTRIN_ prefix.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18