Add AddresSpace to PseudoSourceValue.
Differential Revision: https://reviews.llvm.org/D35089
llvm-svn: 313297
diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
index 73eb3a3..e60124e 100644
--- a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
@@ -1873,6 +1873,25 @@
}
}
+unsigned SIInstrInfo::getAddressSpaceForPseudoSourceKind(
+ PseudoSourceValue::PSVKind Kind) const {
+ switch(Kind) {
+ case PseudoSourceValue::Stack:
+ case PseudoSourceValue::FixedStack:
+ return AMDGPUASI.PRIVATE_ADDRESS;
+ case PseudoSourceValue::ConstantPool:
+ case PseudoSourceValue::GOT:
+ case PseudoSourceValue::JumpTable:
+ case PseudoSourceValue::GlobalValueCallEntry:
+ case PseudoSourceValue::ExternalSymbolCallEntry:
+ case PseudoSourceValue::TargetCustom:
+ return AMDGPUASI.CONSTANT_ADDRESS;
+ default:
+ return AMDGPUASI.FLAT_ADDRESS;
+ }
+}
+
+
static void removeModOperands(MachineInstr &MI) {
unsigned Opc = MI.getOpcode();
int Src0ModIdx = AMDGPU::getNamedOperandIdx(Opc,
diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.h b/llvm/lib/Target/AMDGPU/SIInstrInfo.h
index 954cf13..082bb35 100644
--- a/llvm/lib/Target/AMDGPU/SIInstrInfo.h
+++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.h
@@ -259,6 +259,9 @@
unsigned DstReg, ArrayRef<MachineOperand> Cond,
unsigned TrueReg, unsigned FalseReg) const;
+ unsigned
+ getAddressSpaceForPseudoSourceKind(PseudoSourceValue::PSVKind Kind) const;
+
bool
areMemAccessesTriviallyDisjoint(MachineInstr &MIa, MachineInstr &MIb,
AliasAnalysis *AA = nullptr) const override;
diff --git a/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp b/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
index 0299435..ebb83fe 100644
--- a/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
@@ -28,6 +28,8 @@
SIMachineFunctionInfo::SIMachineFunctionInfo(const MachineFunction &MF)
: AMDGPUMachineFunction(MF),
+ BufferPSV(*(MF.getSubtarget().getInstrInfo())),
+ ImagePSV(*(MF.getSubtarget().getInstrInfo())),
PrivateSegmentBuffer(false),
DispatchPtr(false),
QueuePtr(false),
diff --git a/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h b/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h
index 25139b2..242b41a 100644
--- a/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h
+++ b/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h
@@ -22,6 +22,7 @@
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/CodeGen/PseudoSourceValue.h"
+#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/Support/ErrorHandling.h"
#include <array>
@@ -37,8 +38,8 @@
class AMDGPUImagePseudoSourceValue : public PseudoSourceValue {
public:
- explicit AMDGPUImagePseudoSourceValue() :
- PseudoSourceValue(PseudoSourceValue::TargetCustom) {}
+ explicit AMDGPUImagePseudoSourceValue(const TargetInstrInfo &TII) :
+ PseudoSourceValue(PseudoSourceValue::TargetCustom, TII) { }
bool isConstant(const MachineFrameInfo *) const override {
// This should probably be true for most images, but we will start by being
@@ -61,8 +62,8 @@
class AMDGPUBufferPseudoSourceValue : public PseudoSourceValue {
public:
- explicit AMDGPUBufferPseudoSourceValue() :
- PseudoSourceValue(PseudoSourceValue::TargetCustom) {}
+ explicit AMDGPUBufferPseudoSourceValue(const TargetInstrInfo &TII) :
+ PseudoSourceValue(PseudoSourceValue::TargetCustom, TII) { }
bool isConstant(const MachineFrameInfo *) const override {
// This should probably be true for most images, but we will start by being