LLVM  14.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"
18 #include "llvm/IR/Constants.h"
19 #include "llvm/IR/Instruction.h"
20 #include "llvm/IR/Value.h"
21 
22 using namespace llvm;
23 
24 // Pin the vtable to this file.
25 //void AMDGPUInstrInfo::anchor() {}
26 
28 
29 
30 // TODO: Should largely merge with AMDGPUTTIImpl::isSourceOfDivergence.
32  const Value *Ptr = MMO->getValue();
33  // UndefValue means this is a load of a kernel input. These are uniform.
34  // Sometimes LDS instructions have constant pointers.
35  // If Ptr is null, then that means this mem operand contains a
36  // PseudoSourceValue like GOT.
37  if (!Ptr || isa<UndefValue>(Ptr) ||
38  isa<Constant>(Ptr) || isa<GlobalValue>(Ptr))
39  return true;
40 
42  return true;
43 
44  if (const Argument *Arg = dyn_cast<Argument>(Ptr))
46 
47  const Instruction *I = dyn_cast<Instruction>(Ptr);
48  return I && I->getMetadata("amdgpu.uniform");
49 }
llvm::Argument
This class represents an incoming formal argument to a Function.
Definition: Argument.h:29
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::AMDGPUInstrInfo::AMDGPUInstrInfo
AMDGPUInstrInfo(const GCNSubtarget &st)
Definition: AMDGPUInstrInfo.cpp:27
llvm::AMDGPUInstrInfo::isUniformMMO
static bool isUniformMMO(const MachineMemOperand *MMO)
Definition: AMDGPUInstrInfo.cpp:31
llvm::MachineMemOperand
A description of a memory reference used in the backend.
Definition: MachineMemOperand.h:128
llvm::GCNSubtarget
Definition: GCNSubtarget.h:31
Arg
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
Definition: AMDGPULibCalls.cpp:206
Instruction.h
Constants.h
llvm::MachineMemOperand::getAddrSpace
unsigned getAddrSpace() const
Definition: MachineMemOperand.h:229
llvm::MachineMemOperand::getValue
const Value * getValue() const
Return the base address of the memory access.
Definition: MachineMemOperand.h:211
llvm::Instruction
Definition: Instruction.h:45
llvm::ARM_MB::ST
@ ST
Definition: ARMBaseInfo.h:73
I
#define I(x, y, z)
Definition: MD5.cpp:59
AMDGPU.h
AMDGPUInstrInfo.h
llvm::AMDGPU::isArgPassedInSGPR
bool isArgPassedInSGPR(const Argument *A)
Definition: AMDGPUBaseInfo.cpp:1813
MachineMemOperand.h
llvm::AMDGPUAS::CONSTANT_ADDRESS_32BIT
@ CONSTANT_ADDRESS_32BIT
Address space for 32-bit constant memory.
Definition: AMDGPU.h:366
Value.h
llvm::Value
LLVM Value Representation.
Definition: Value.h:74