mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
AMDGPU: Fix layering issue
Move utility function that depends on codegen. Fixes build with r324487 reapplied. llvm-svn: 324746
This commit is contained in:
parent
3e3dc1fc3a
commit
d3379ccb46
@ -115,3 +115,21 @@ int AMDGPUInstrInfo::pseudoToMCOpcode(int Opcode) const {
|
||||
|
||||
return MCOp;
|
||||
}
|
||||
|
||||
// TODO: Should largely merge with AMDGPUTTIImpl::isSourceOfDivergence.
|
||||
bool AMDGPUInstrInfo::isUniformMMO(const MachineMemOperand *MMO) {
|
||||
const Value *Ptr = MMO->getValue();
|
||||
// UndefValue means this is a load of a kernel input. These are uniform.
|
||||
// Sometimes LDS instructions have constant pointers.
|
||||
// If Ptr is null, then that means this mem operand contains a
|
||||
// PseudoSourceValue like GOT.
|
||||
if (!Ptr || isa<UndefValue>(Ptr) ||
|
||||
isa<Constant>(Ptr) || isa<GlobalValue>(Ptr))
|
||||
return true;
|
||||
|
||||
if (const Argument *Arg = dyn_cast<Argument>(Ptr))
|
||||
return AMDGPU::isArgPassedInSGPR(Arg);
|
||||
|
||||
const Instruction *I = dyn_cast<Instruction>(Ptr);
|
||||
return I && I->getMetadata("amdgpu.uniform");
|
||||
}
|
||||
|
@ -50,6 +50,8 @@ public:
|
||||
/// Return -1 if the target-specific opcode for the pseudo instruction does
|
||||
/// not exist. If Opcode is not a pseudo instruction, this is identity.
|
||||
int pseudoToMCOpcode(int Opcode) const;
|
||||
|
||||
static bool isUniformMMO(const MachineMemOperand *MMO);
|
||||
};
|
||||
} // End llvm namespace
|
||||
|
||||
|
@ -120,7 +120,7 @@ static bool isInstrUniform(const MachineInstr &MI) {
|
||||
return false;
|
||||
|
||||
const MachineMemOperand *MMO = *MI.memoperands_begin();
|
||||
return AMDGPU::isUniformMMO(MMO);
|
||||
return AMDGPUInstrInfo::isUniformMMO(MMO);
|
||||
}
|
||||
|
||||
const RegisterBankInfo::InstructionMapping &
|
||||
|
@ -1095,7 +1095,7 @@ bool SITargetLowering::isCheapAddrSpaceCast(unsigned SrcAS,
|
||||
bool SITargetLowering::isMemOpUniform(const SDNode *N) const {
|
||||
const MemSDNode *MemNode = cast<MemSDNode>(N);
|
||||
|
||||
return AMDGPU::isUniformMMO(MemNode->getMemOperand());
|
||||
return AMDGPUInstrInfo::isUniformMMO(MemNode->getMemOperand());
|
||||
}
|
||||
|
||||
TargetLoweringBase::LegalizeTypeAction
|
||||
|
@ -905,24 +905,6 @@ bool isArgPassedInSGPR(const Argument *A) {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Should largely merge with AMDGPUTTIImpl::isSourceOfDivergence.
|
||||
bool isUniformMMO(const MachineMemOperand *MMO) {
|
||||
const Value *Ptr = MMO->getValue();
|
||||
// UndefValue means this is a load of a kernel input. These are uniform.
|
||||
// Sometimes LDS instructions have constant pointers.
|
||||
// If Ptr is null, then that means this mem operand contains a
|
||||
// PseudoSourceValue like GOT.
|
||||
if (!Ptr || isa<UndefValue>(Ptr) ||
|
||||
isa<Constant>(Ptr) || isa<GlobalValue>(Ptr))
|
||||
return true;
|
||||
|
||||
if (const Argument *Arg = dyn_cast<Argument>(Ptr))
|
||||
return isArgPassedInSGPR(Arg);
|
||||
|
||||
const Instruction *I = dyn_cast<Instruction>(Ptr);
|
||||
return I && I->getMetadata("amdgpu.uniform");
|
||||
}
|
||||
|
||||
int64_t getSMRDEncodedOffset(const MCSubtargetInfo &ST, int64_t ByteOffset) {
|
||||
if (isGCN3Encoding(ST))
|
||||
return ByteOffset;
|
||||
|
@ -372,7 +372,6 @@ LLVM_READNONE
|
||||
bool isInlinableLiteralV216(int32_t Literal, bool HasInv2Pi);
|
||||
|
||||
bool isArgPassedInSGPR(const Argument *Arg);
|
||||
bool isUniformMMO(const MachineMemOperand *MMO);
|
||||
|
||||
/// \returns The encoding that will be used for \p ByteOffset in the SMRD
|
||||
/// offset field.
|
||||
|
Loading…
Reference in New Issue
Block a user