1 //===-- AMDGPUInstrInfo.cpp - Base class for AMD GPU InstrInfo ------------===//
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
7 //===----------------------------------------------------------------------===//
10 /// \brief Implementation of the TargetInstrInfo class that is common to all
13 //===----------------------------------------------------------------------===//
15 #include "AMDGPUInstrInfo.h"
16 #include "AMDGPURegisterInfo.h"
17 #include "AMDGPUTargetMachine.h"
18 #include "MCTargetDesc/AMDGPUMCTargetDesc.h"
19 #include "llvm/CodeGen/MachineFrameInfo.h"
20 #include "llvm/CodeGen/MachineInstrBuilder.h"
21 #include "llvm/CodeGen/MachineRegisterInfo.h"
25 // Pin the vtable to this file.
26 //void AMDGPUInstrInfo::anchor() {}
28 AMDGPUInstrInfo::AMDGPUInstrInfo(const GCNSubtarget
&ST
) { }
31 // TODO: Should largely merge with AMDGPUTTIImpl::isSourceOfDivergence.
32 bool AMDGPUInstrInfo::isUniformMMO(const MachineMemOperand
*MMO
) {
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
))
42 if (MMO
->getAddrSpace() == AMDGPUAS::CONSTANT_ADDRESS_32BIT
)
45 if (const Argument
*Arg
= dyn_cast
<Argument
>(Ptr
))
46 return AMDGPU::isArgPassedInSGPR(Arg
);
48 const Instruction
*I
= dyn_cast
<Instruction
>(Ptr
);
49 return I
&& I
->getMetadata("amdgpu.uniform");