LLVM  8.0.1
AMDGPUInstrInfo.cpp
Go to the documentation of this file.
1 //===-- AMDGPUInstrInfo.cpp - Base class for AMD GPU InstrInfo ------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 /// \file
11 /// \brief Implementation of the TargetInstrInfo class that is common to all
12 /// AMD GPUs.
13 //
14 //===----------------------------------------------------------------------===//
15 
16 #include "AMDGPUInstrInfo.h"
17 #include "AMDGPURegisterInfo.h"
18 #include "AMDGPUTargetMachine.h"
23 
24 using namespace llvm;
25 
26 // Pin the vtable to this file.
27 //void AMDGPUInstrInfo::anchor() {}
28 
30 
31 
32 // TODO: Should largely merge with AMDGPUTTIImpl::isSourceOfDivergence.
34  const Value *Ptr = MMO->getValue();
35  // UndefValue means this is a load of a kernel input. These are uniform.
36  // Sometimes LDS instructions have constant pointers.
37  // If Ptr is null, then that means this mem operand contains a
38  // PseudoSourceValue like GOT.
39  if (!Ptr || isa<UndefValue>(Ptr) ||
40  isa<Constant>(Ptr) || isa<GlobalValue>(Ptr))
41  return true;
42 
44  return true;
45 
46  if (const Argument *Arg = dyn_cast<Argument>(Ptr))
48 
49  const Instruction *I = dyn_cast<Instruction>(Ptr);
50  return I && I->getMetadata("amdgpu.uniform");
51 }
This class represents an incoming formal argument to a Function.
Definition: Argument.h:30
unsigned getAddrSpace() const
This class represents lattice values for constants.
Definition: AllocatorList.h:24
Address space for 32-bit constant memory.
Definition: AMDGPU.h:263
A description of a memory reference used in the backend.
TargetRegisterInfo interface that is implemented by all hw codegen targets.
MDNode * getMetadata(unsigned KindID) const
Get the metadata of given kind attached to this Instruction.
Definition: Instruction.h:221
const Value * getValue() const
Return the base address of the memory access.
static bool isUniformMMO(const MachineMemOperand *MMO)
The AMDGPU TargetMachine interface definition for hw codgen targets.
bool isArgPassedInSGPR(const Argument *A)
amdgpu Simplify well known AMD library false Value Value * Arg
Contains the definition of a TargetInstrInfo class that is common to all AMD GPUs.
Provides AMDGPU specific target descriptions.
#define I(x, y, z)
Definition: MD5.cpp:58
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
Definition: Casting.h:323
LLVM Value Representation.
Definition: Value.h:73
AMDGPUInstrInfo(const GCNSubtarget &st)