[ARM] VQADD instructions
[llvm-complete.git] / lib / Target / AMDGPU / AMDGPUInstrInfo.cpp
blob9951cbf2326e35ee94d8eabc19d5dc7a45013161
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 "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"
23 using namespace llvm;
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))
40 return true;
42 if (MMO->getAddrSpace() == AMDGPUAS::CONSTANT_ADDRESS_32BIT)
43 return true;
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");