mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
Verifier: Check byref address space for AMDGPU calling conventions
This commit is contained in:
parent
413b267e1e
commit
b7a779e13a
@ -2314,13 +2314,24 @@ void Verifier::visitFunction(const Function &F) {
|
|||||||
Assert(!F.hasStructRetAttr(),
|
Assert(!F.hasStructRetAttr(),
|
||||||
"Calling convention does not allow sret", &F);
|
"Calling convention does not allow sret", &F);
|
||||||
if (F.getCallingConv() != CallingConv::SPIR_KERNEL) {
|
if (F.getCallingConv() != CallingConv::SPIR_KERNEL) {
|
||||||
for (unsigned i = 0, e = F.arg_size(); i != e; ++i) {
|
const unsigned StackAS = DL.getAllocaAddrSpace();
|
||||||
|
unsigned i = 0;
|
||||||
|
for (const Argument &Arg : F.args()) {
|
||||||
Assert(!Attrs.hasParamAttribute(i, Attribute::ByVal),
|
Assert(!Attrs.hasParamAttribute(i, Attribute::ByVal),
|
||||||
"Calling convention disallows byval", &F);
|
"Calling convention disallows byval", &F);
|
||||||
Assert(!Attrs.hasParamAttribute(i, Attribute::Preallocated),
|
Assert(!Attrs.hasParamAttribute(i, Attribute::Preallocated),
|
||||||
"Calling convention disallows preallocated", &F);
|
"Calling convention disallows preallocated", &F);
|
||||||
Assert(!Attrs.hasParamAttribute(i, Attribute::InAlloca),
|
Assert(!Attrs.hasParamAttribute(i, Attribute::InAlloca),
|
||||||
"Calling convention disallows inalloca", &F);
|
"Calling convention disallows inalloca", &F);
|
||||||
|
|
||||||
|
if (Attrs.hasParamAttribute(i, Attribute::ByRef)) {
|
||||||
|
// FIXME: Should also disallow LDS and GDS, but we don't have the enum
|
||||||
|
// value here.
|
||||||
|
Assert(Arg.getType()->getPointerAddressSpace() != StackAS,
|
||||||
|
"Calling convention disallows stack byref", &F);
|
||||||
|
}
|
||||||
|
|
||||||
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,3 +121,9 @@ define amdgpu_kernel void @preallocated_as0_cc_amdgpu_kernel(i32* preallocated(i
|
|||||||
define amdgpu_kernel void @inalloca_as0_cc_amdgpu_kernel(i32* inalloca %ptr) {
|
define amdgpu_kernel void @inalloca_as0_cc_amdgpu_kernel(i32* inalloca %ptr) {
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
; CHECK: Calling convention disallows stack byref
|
||||||
|
; CHECK-NEXT: void (i32 addrspace(5)*)* @byref_as5_cc_amdgpu_kernel
|
||||||
|
define amdgpu_kernel void @byref_as5_cc_amdgpu_kernel(i32 addrspace(5)* byref(i32) %ptr) {
|
||||||
|
ret void
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user