LLVM  9.0.0svn
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 "AMDGPURegisterInfo.h"
17 #include "AMDGPUTargetMachine.h"
22 
23 using namespace llvm;
24 
25 // Pin the vtable to this file.
26 //void AMDGPUInstrInfo::anchor() {}
27 
29 
30 
31 // TODO: Should largely merge with AMDGPUTTIImpl::isSourceOfDivergence.
33  const Value *Ptr = MMO->getValue();
34  // UndefValue means this is a load of a kernel input. These are uniform.
35  // Sometimes LDS instructions have constant pointers.
36  // If Ptr is null, then that means this mem operand contains a
37  // PseudoSourceValue like GOT.
38  if (!Ptr || isa<UndefValue>(Ptr) ||
39  isa<Constant>(Ptr) || isa<GlobalValue>(Ptr))
40  return true;
41 
43  return true;
44 
45  if (const Argument *Arg = dyn_cast<Argument>(Ptr))
47 
48  const Instruction *I = dyn_cast<Instruction>(Ptr);
49  return I && I->getMetadata("amdgpu.uniform");
50 }
This class represents an incoming formal argument to a Function.
Definition: Argument.h:29
unsigned getAddrSpace() const
This class represents lattice values for constants.
Definition: AllocatorList.h:23
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:234
const Value * getValue() const
Return the base address of the memory access.
Address space for 32-bit constant memory.
Definition: AMDGPU.h:258
static bool isUniformMMO(const MachineMemOperand *MMO)
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
The AMDGPU TargetMachine interface definition for hw codgen targets.
bool isArgPassedInSGPR(const Argument *A)
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:322
LLVM Value Representation.
Definition: Value.h:72
AMDGPUInstrInfo(const GCNSubtarget &st)