[ORC] Add std::tuple support to SimplePackedSerialization.
[llvm-project.git] / llvm / lib / Target / AMDGPU / AMDGPUInstrInfo.cpp
blobf2d62956e25b09f28c0c8e1955ad32f72fd424a1
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.
13 //===----------------------------------------------------------------------===//
15 #include "AMDGPUInstrInfo.h"
16 #include "AMDGPU.h"
17 #include "llvm/CodeGen/MachineMemOperand.h"
18 #include "llvm/IR/Constants.h"
19 #include "llvm/IR/Instruction.h"
20 #include "llvm/IR/Value.h"
22 using namespace llvm;
24 // Pin the vtable to this file.
25 //void AMDGPUInstrInfo::anchor() {}
27 AMDGPUInstrInfo::AMDGPUInstrInfo(const GCNSubtarget &ST) { }
30 // TODO: Should largely merge with AMDGPUTTIImpl::isSourceOfDivergence.
31 bool AMDGPUInstrInfo::isUniformMMO(const MachineMemOperand *MMO) {
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;
41 if (MMO->getAddrSpace() == AMDGPUAS::CONSTANT_ADDRESS_32BIT)
42 return true;
44 if (const Argument *Arg = dyn_cast<Argument>(Ptr))
45 return AMDGPU::isArgPassedInSGPR(Arg);
47 const Instruction *I = dyn_cast<Instruction>(Ptr);
48 return I && I->getMetadata("amdgpu.uniform");