[HLSL] Add resource name argument to resource class constructors (#139985)
Adds resource name argument to resource class constructors and to builtin functions that initialize resource handles `__builtin_hlsl_resource_handlefrombinding` and `__builtin_hlsl_resource_handlefromimplicitbinding`. Part 1/4 of https://github.com/llvm/llvm-project/issues/105059
This commit is contained in:
@@ -120,7 +120,7 @@ private:
|
||||
// LastStmt - refers to the last statement in the method body; referencing
|
||||
// LastStmt will remove the statement from the method body since
|
||||
// it will be linked from the new expression being constructed.
|
||||
enum class PlaceHolder { _0, _1, _2, _3, Handle = 128, LastStmt };
|
||||
enum class PlaceHolder { _0, _1, _2, _3, _4, Handle = 128, LastStmt };
|
||||
|
||||
Expr *convertPlaceholder(PlaceHolder PH);
|
||||
Expr *convertPlaceholder(Expr *E) { return E; }
|
||||
@@ -662,8 +662,9 @@ BuiltinTypeDeclBuilder::addHandleConstructorFromBinding() {
|
||||
.addParam("spaceNo", AST.UnsignedIntTy)
|
||||
.addParam("range", AST.IntTy)
|
||||
.addParam("index", AST.UnsignedIntTy)
|
||||
.addParam("name", AST.getPointerType(AST.CharTy.withConst()))
|
||||
.callBuiltin("__builtin_hlsl_resource_handlefrombinding", HandleType,
|
||||
PH::Handle, PH::_0, PH::_1, PH::_2, PH::_3)
|
||||
PH::Handle, PH::_0, PH::_1, PH::_2, PH::_3, PH::_4)
|
||||
.assign(PH::Handle, PH::LastStmt)
|
||||
.finalize();
|
||||
}
|
||||
@@ -682,8 +683,10 @@ BuiltinTypeDeclBuilder::addHandleConstructorFromImplicitBinding() {
|
||||
.addParam("range", AST.IntTy)
|
||||
.addParam("index", AST.UnsignedIntTy)
|
||||
.addParam("orderId", AST.UnsignedIntTy)
|
||||
.addParam("name", AST.getPointerType(AST.CharTy.withConst()))
|
||||
.callBuiltin("__builtin_hlsl_resource_handlefromimplicitbinding",
|
||||
HandleType, PH::Handle, PH::_0, PH::_1, PH::_2, PH::_3)
|
||||
HandleType, PH::Handle, PH::_0, PH::_1, PH::_2, PH::_3,
|
||||
PH::_4)
|
||||
.assign(PH::Handle, PH::LastStmt)
|
||||
.finalize();
|
||||
}
|
||||
|
||||
@@ -2385,12 +2385,14 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
|
||||
}
|
||||
case Builtin::BI__builtin_hlsl_resource_handlefrombinding: {
|
||||
ASTContext &AST = SemaRef.getASTContext();
|
||||
if (SemaRef.checkArgCount(TheCall, 5) ||
|
||||
if (SemaRef.checkArgCount(TheCall, 6) ||
|
||||
CheckResourceHandle(&SemaRef, TheCall, 0) ||
|
||||
CheckArgTypeMatches(&SemaRef, TheCall->getArg(1), AST.UnsignedIntTy) ||
|
||||
CheckArgTypeMatches(&SemaRef, TheCall->getArg(2), AST.UnsignedIntTy) ||
|
||||
CheckArgTypeMatches(&SemaRef, TheCall->getArg(3), AST.IntTy) ||
|
||||
CheckArgTypeMatches(&SemaRef, TheCall->getArg(4), AST.UnsignedIntTy))
|
||||
CheckArgTypeMatches(&SemaRef, TheCall->getArg(4), AST.UnsignedIntTy) ||
|
||||
CheckArgTypeMatches(&SemaRef, TheCall->getArg(5),
|
||||
AST.getPointerType(AST.CharTy.withConst())))
|
||||
return true;
|
||||
// use the type of the handle (arg0) as a return type
|
||||
QualType ResourceTy = TheCall->getArg(0)->getType();
|
||||
@@ -2399,12 +2401,14 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
|
||||
}
|
||||
case Builtin::BI__builtin_hlsl_resource_handlefromimplicitbinding: {
|
||||
ASTContext &AST = SemaRef.getASTContext();
|
||||
if (SemaRef.checkArgCount(TheCall, 5) ||
|
||||
if (SemaRef.checkArgCount(TheCall, 6) ||
|
||||
CheckResourceHandle(&SemaRef, TheCall, 0) ||
|
||||
CheckArgTypeMatches(&SemaRef, TheCall->getArg(1), AST.UnsignedIntTy) ||
|
||||
CheckArgTypeMatches(&SemaRef, TheCall->getArg(2), AST.IntTy) ||
|
||||
CheckArgTypeMatches(&SemaRef, TheCall->getArg(3), AST.UnsignedIntTy) ||
|
||||
CheckArgTypeMatches(&SemaRef, TheCall->getArg(4), AST.UnsignedIntTy))
|
||||
CheckArgTypeMatches(&SemaRef, TheCall->getArg(4), AST.UnsignedIntTy) ||
|
||||
CheckArgTypeMatches(&SemaRef, TheCall->getArg(5),
|
||||
AST.getPointerType(AST.CharTy.withConst())))
|
||||
return true;
|
||||
// use the type of the handle (arg0) as a return type
|
||||
QualType ResourceTy = TheCall->getArg(0)->getType();
|
||||
@@ -3255,13 +3259,18 @@ bool SemaHLSL::initGlobalResourceDecl(VarDecl *VD) {
|
||||
IntegerLiteral *Space =
|
||||
IntegerLiteral::Create(AST, llvm::APInt(UIntTySize, SpaceNo),
|
||||
AST.UnsignedIntTy, SourceLocation());
|
||||
StringRef VarName = VD->getName();
|
||||
StringLiteral *Name = StringLiteral::Create(
|
||||
AST, VarName, StringLiteralKind::Ordinary, false,
|
||||
AST.getStringLiteralArrayType(AST.CharTy.withConst(), VarName.size()),
|
||||
SourceLocation());
|
||||
|
||||
// resource with explicit binding
|
||||
if (RegisterSlot.has_value()) {
|
||||
IntegerLiteral *RegSlot = IntegerLiteral::Create(
|
||||
AST, llvm::APInt(UIntTySize, RegisterSlot.value()), AST.UnsignedIntTy,
|
||||
SourceLocation());
|
||||
Expr *Args[] = {RegSlot, Space, RangeSize, Index};
|
||||
Expr *Args[] = {RegSlot, Space, RangeSize, Index, Name};
|
||||
return initVarDeclWithCtor(SemaRef, VD, Args);
|
||||
}
|
||||
|
||||
@@ -3269,7 +3278,7 @@ bool SemaHLSL::initGlobalResourceDecl(VarDecl *VD) {
|
||||
IntegerLiteral *OrderId = IntegerLiteral::Create(
|
||||
AST, llvm::APInt(UIntTySize, getNextImplicitBindingOrderID()),
|
||||
AST.UnsignedIntTy, SourceLocation());
|
||||
Expr *Args[] = {Space, RangeSize, Index, OrderId};
|
||||
Expr *Args[] = {Space, RangeSize, Index, OrderId, Name};
|
||||
return initVarDeclWithCtor(SemaRef, VD, Args);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,11 +58,12 @@ RESOURCE Buffer;
|
||||
|
||||
// Constructor from binding
|
||||
|
||||
// CHECK: CXXConstructorDecl {{.*}} [[RESOURCE]] 'void (unsigned int, unsigned int, int, unsigned int)' inline
|
||||
// CHECK: CXXConstructorDecl {{.*}} [[RESOURCE]] 'void (unsigned int, unsigned int, int, unsigned int, const char *)' inline
|
||||
// CHECK-NEXT: ParmVarDecl {{.*}} registerNo 'unsigned int'
|
||||
// CHECK-NEXT: ParmVarDecl {{.*}} spaceNo 'unsigned int'
|
||||
// CHECK-NEXT: ParmVarDecl {{.*}} range 'int'
|
||||
// CHECK-NEXT: ParmVarDecl {{.*}} index 'unsigned int'
|
||||
// CHECK-NEXT: ParmVarDecl {{.*}} name 'const char *'
|
||||
// CHECK-NEXT: CompoundStmt {{.*}}
|
||||
// CHECK-NEXT: BinaryOperator {{.*}} '='
|
||||
// CHECK-NEXT: MemberExpr {{.*}} lvalue .__handle
|
||||
@@ -76,15 +77,17 @@ RESOURCE Buffer;
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'spaceNo' 'unsigned int'
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' ParmVar {{.*}} 'range' 'int'
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'index' 'unsigned int'
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'const char *' ParmVar {{.*}} 'name' 'const char *'
|
||||
// CHECK-NEXT: AlwaysInlineAttr
|
||||
|
||||
// Constructor from implicit binding
|
||||
|
||||
// CHECK: CXXConstructorDecl {{.*}} [[RESOURCE]] 'void (unsigned int, int, unsigned int, unsigned int)' inline
|
||||
// CHECK: CXXConstructorDecl {{.*}} [[RESOURCE]] 'void (unsigned int, int, unsigned int, unsigned int, const char *)' inline
|
||||
// CHECK-NEXT: ParmVarDecl {{.*}} spaceNo 'unsigned int'
|
||||
// CHECK-NEXT: ParmVarDecl {{.*}} range 'int'
|
||||
// CHECK-NEXT: ParmVarDecl {{.*}} index 'unsigned int'
|
||||
// CHECK-NEXT: ParmVarDecl {{.*}} orderId 'unsigned int'
|
||||
// CHECK-NEXT: ParmVarDecl {{.*}} name 'const char *'
|
||||
// CHECK-NEXT: CompoundStmt {{.*}}
|
||||
// CHECK-NEXT: BinaryOperator {{.*}} '='
|
||||
// CHECK-NEXT: MemberExpr {{.*}} lvalue .__handle
|
||||
@@ -98,6 +101,7 @@ RESOURCE Buffer;
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' ParmVar {{.*}} 'range' 'int'
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'index' 'unsigned int'
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'orderId' 'unsigned int'
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'const char *' ParmVar {{.*}} 'name' 'const char *'
|
||||
// CHECK-NEXT: AlwaysInlineAttr
|
||||
|
||||
// CHECK-NOSUBSCRIPT-NOT: CXXMethodDecl {{.*}} operator[] 'const element_type &(unsigned int) const'
|
||||
|
||||
@@ -105,11 +105,12 @@ RESOURCE<float> Buffer;
|
||||
|
||||
// Constructor from binding
|
||||
|
||||
// CHECK: CXXConstructorDecl {{.*}} [[RESOURCE]]<element_type> 'void (unsigned int, unsigned int, int, unsigned int)' inline
|
||||
// CHECK: CXXConstructorDecl {{.*}} [[RESOURCE]]<element_type> 'void (unsigned int, unsigned int, int, unsigned int, const char *)' inline
|
||||
// CHECK-NEXT: ParmVarDecl {{.*}} registerNo 'unsigned int'
|
||||
// CHECK-NEXT: ParmVarDecl {{.*}} spaceNo 'unsigned int'
|
||||
// CHECK-NEXT: ParmVarDecl {{.*}} range 'int'
|
||||
// CHECK-NEXT: ParmVarDecl {{.*}} index 'unsigned int'
|
||||
// CHECK-NEXT: ParmVarDecl {{.*}} name 'const char *'
|
||||
// CHECK-NEXT: CompoundStmt {{.*}}
|
||||
// CHECK-NEXT: BinaryOperator {{.*}} '='
|
||||
// CHECK-NEXT: MemberExpr {{.*}} lvalue .__handle
|
||||
@@ -123,15 +124,17 @@ RESOURCE<float> Buffer;
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'spaceNo' 'unsigned int'
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' ParmVar {{.*}} 'range' 'int'
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'index' 'unsigned int'
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'const char *' ParmVar {{.*}} 'name' 'const char *'
|
||||
// CHECK-NEXT: AlwaysInlineAttr
|
||||
|
||||
// Constructor from implicit binding
|
||||
|
||||
// CHECK: CXXConstructorDecl {{.*}} [[RESOURCE]]<element_type> 'void (unsigned int, int, unsigned int, unsigned int)' inline
|
||||
// CHECK: CXXConstructorDecl {{.*}} [[RESOURCE]]<element_type> 'void (unsigned int, int, unsigned int, unsigned int, const char *)' inline
|
||||
// CHECK-NEXT: ParmVarDecl {{.*}} spaceNo 'unsigned int'
|
||||
// CHECK-NEXT: ParmVarDecl {{.*}} range 'int'
|
||||
// CHECK-NEXT: ParmVarDecl {{.*}} index 'unsigned int'
|
||||
// CHECK-NEXT: ParmVarDecl {{.*}} orderId 'unsigned int'
|
||||
// CHECK-NEXT: ParmVarDecl {{.*}} name 'const char *'
|
||||
// CHECK-NEXT: CompoundStmt {{.*}}
|
||||
// CHECK-NEXT: BinaryOperator {{.*}} '='
|
||||
// CHECK-NEXT: MemberExpr {{.*}} lvalue .__handle
|
||||
@@ -145,6 +148,7 @@ RESOURCE<float> Buffer;
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' ParmVar {{.*}} 'range' 'int'
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'index' 'unsigned int'
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'orderId' 'unsigned int'
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'const char *' ParmVar {{.*}} 'name' 'const char *'
|
||||
// CHECK-NEXT: AlwaysInlineAttr
|
||||
|
||||
// Subscript operators
|
||||
|
||||
@@ -72,11 +72,12 @@ RESOURCE<float> Buffer;
|
||||
|
||||
// Constructor from binding
|
||||
|
||||
// CHECK: CXXConstructorDecl {{.*}} [[RESOURCE]]<element_type> 'void (unsigned int, unsigned int, int, unsigned int)' inline
|
||||
// CHECK: CXXConstructorDecl {{.*}} [[RESOURCE]]<element_type> 'void (unsigned int, unsigned int, int, unsigned int, const char *)' inline
|
||||
// CHECK-NEXT: ParmVarDecl {{.*}} registerNo 'unsigned int'
|
||||
// CHECK-NEXT: ParmVarDecl {{.*}} spaceNo 'unsigned int'
|
||||
// CHECK-NEXT: ParmVarDecl {{.*}} range 'int'
|
||||
// CHECK-NEXT: ParmVarDecl {{.*}} index 'unsigned int'
|
||||
// CHECK-NEXT: ParmVarDecl {{.*}} name 'const char *'
|
||||
// CHECK-NEXT: CompoundStmt {{.*}}
|
||||
// CHECK-NEXT: BinaryOperator {{.*}} '='
|
||||
// CHECK-NEXT: MemberExpr {{.*}} lvalue .__handle
|
||||
@@ -90,15 +91,17 @@ RESOURCE<float> Buffer;
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'spaceNo' 'unsigned int'
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' ParmVar {{.*}} 'range' 'int'
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'index' 'unsigned int'
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'const char *' ParmVar {{.*}} 'name' 'const char *'
|
||||
// CHECK-NEXT: AlwaysInlineAttr
|
||||
|
||||
// Constructor from implicit binding
|
||||
|
||||
// CHECK: CXXConstructorDecl {{.*}} [[RESOURCE]]<element_type> 'void (unsigned int, int, unsigned int, unsigned int)' inline
|
||||
// CHECK: CXXConstructorDecl {{.*}} [[RESOURCE]]<element_type> 'void (unsigned int, int, unsigned int, unsigned int, const char *)' inline
|
||||
// CHECK-NEXT: ParmVarDecl {{.*}} spaceNo 'unsigned int'
|
||||
// CHECK-NEXT: ParmVarDecl {{.*}} range 'int'
|
||||
// CHECK-NEXT: ParmVarDecl {{.*}} index 'unsigned int'
|
||||
// CHECK-NEXT: ParmVarDecl {{.*}} orderId 'unsigned int'
|
||||
// CHECK-NEXT: ParmVarDecl {{.*}} name 'const char *'
|
||||
// CHECK-NEXT: CompoundStmt {{.*}}
|
||||
// CHECK-NEXT: BinaryOperator {{.*}} '='
|
||||
// CHECK-NEXT: MemberExpr {{.*}} lvalue .__handle
|
||||
@@ -112,6 +115,7 @@ RESOURCE<float> Buffer;
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' ParmVar {{.*}} 'range' 'int'
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'index' 'unsigned int'
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'orderId' 'unsigned int'
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'const char *' ParmVar {{.*}} 'name' 'const char *'
|
||||
// CHECK-NEXT: AlwaysInlineAttr
|
||||
|
||||
// Subsctript operators
|
||||
|
||||
@@ -33,7 +33,7 @@ void SecondEntry() {}
|
||||
|
||||
// Verify the constructor is alwaysinline
|
||||
// NOINLINE: ; Function Attrs: {{.*}}alwaysinline
|
||||
// NOINLINE-NEXT: define linkonce_odr void @_ZN4hlsl8RWBufferIfEC2Ejijj({{.*}} [[CtorAttr:\#[0-9]+]]
|
||||
// NOINLINE-NEXT: define linkonce_odr void @_ZN4hlsl8RWBufferIfEC2EjijjPKc({{.*}} [[CtorAttr:\#[0-9]+]]
|
||||
|
||||
// NOINLINE: ; Function Attrs: {{.*}}alwaysinline
|
||||
// NOINLINE-NEXT: define internal void @_GLOBAL__sub_I_GlobalConstructorLib.hlsl() [[InitAttr:\#[0-9]+]]
|
||||
|
||||
@@ -24,30 +24,33 @@ export void foo() {
|
||||
// CHECK: %"class.hlsl::RasterizerOrderedByteAddressBuffer" = type { target("dx.RawBuffer", i8, 1, 1) }
|
||||
|
||||
// CHECK: @_ZL4Buf1 = internal global %"class.hlsl::ByteAddressBuffer" poison, align 4
|
||||
// CHECK: @[[Buf1Str:.*]] = private unnamed_addr constant [5 x i8] c"Buf1\00", align 1
|
||||
// CHECK: @_ZL4Buf2 = internal global %"class.hlsl::RWByteAddressBuffer" poison, align 4
|
||||
// CHECK: @[[Buf2Str:.*]] = private unnamed_addr constant [5 x i8] c"Buf2\00", align 1
|
||||
|
||||
// Buf1 initialization part 1 - global init function that calls ByteAddressBuffer C1 constructor with explicit binding
|
||||
// CHECK: define internal void @__cxx_global_var_init()
|
||||
// CHECK-NEXT: entry:
|
||||
// CHECK-NEXT: call void @_ZN4hlsl17ByteAddressBufferC1Ejjij(ptr noundef nonnull align 4 dereferenceable(4) @_ZL4Buf1,
|
||||
// CHECK-SAME: i32 noundef 1, i32 noundef 2, i32 noundef 1, i32 noundef 0)
|
||||
// CHECK-NEXT: call void @_ZN4hlsl17ByteAddressBufferC1EjjijPKc(ptr noundef nonnull align 4 dereferenceable(4) @_ZL4Buf1,
|
||||
// CHECK-SAME: i32 noundef 1, i32 noundef 2, i32 noundef 1, i32 noundef 0, ptr noundef @[[Buf1Str]])
|
||||
|
||||
// Buf1 initialization part 2 - body of ByteAddressBuffer C1 constructor with explicit binding that calls the C2 constructor
|
||||
// CHECK: define linkonce_odr void @_ZN4hlsl17ByteAddressBufferC1Ejjij(ptr noundef nonnull align 4 dereferenceable(4) %this,
|
||||
// CHECK-SAME: i32 noundef %registerNo, i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index)
|
||||
// CHECK: call void @_ZN4hlsl17ByteAddressBufferC2Ejjij(ptr noundef nonnull align 4 dereferenceable(4)
|
||||
// CHECK-SAME: %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}})
|
||||
// CHECK: define linkonce_odr void @_ZN4hlsl17ByteAddressBufferC1EjjijPKc(ptr noundef nonnull align 4 dereferenceable(4) %this,
|
||||
// CHECK-SAME: i32 noundef %registerNo, i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index, ptr noundef %name)
|
||||
// CHECK: call void @_ZN4hlsl17ByteAddressBufferC2EjjijPKc(ptr noundef nonnull align 4 dereferenceable(4)
|
||||
// CHECK-SAME: %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, ptr noundef %{{.*}})
|
||||
|
||||
// Buf2 initialization part 1 - global init function that calls RWByteAddressBuffer C1 constructor with implicit binding
|
||||
// CHECK: define internal void @__cxx_global_var_init.1() #0 {
|
||||
// CHECK: define internal void @__cxx_global_var_init.1()
|
||||
// CHECK-NEXT: entry:
|
||||
// CHECK-NEXT: call void @_ZN4hlsl19RWByteAddressBufferC1Ejijj(ptr noundef nonnull align 4 dereferenceable(4) @_ZL4Buf2,
|
||||
// CHECK-SAME: i32 noundef 0, i32 noundef 1, i32 noundef 0, i32 noundef 0)
|
||||
// CHECK-NEXT: call void @_ZN4hlsl19RWByteAddressBufferC1EjijjPKc(ptr noundef nonnull align 4 dereferenceable(4) @_ZL4Buf2,
|
||||
// CHECK-SAME: i32 noundef 0, i32 noundef 1, i32 noundef 0, i32 noundef 0, ptr noundef @[[Buf2Str]])
|
||||
|
||||
// Buf2 initialization part 2 - body of RWByteAddressBuffer C1 constructor with implicit binding that calls the C2 constructor
|
||||
// CHECK: define linkonce_odr void @_ZN4hlsl19RWByteAddressBufferC1Ejijj(ptr noundef nonnull align 4 dereferenceable(4) %this,
|
||||
// CHECK-SAME: i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index, i32 noundef %orderId)
|
||||
// CHECK: call void @_ZN4hlsl19RWByteAddressBufferC2Ejijj(ptr noundef nonnull align 4 dereferenceable(4) %this1, i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) #4
|
||||
// CHECK: define linkonce_odr void @_ZN4hlsl19RWByteAddressBufferC1EjijjPKc(ptr noundef nonnull align 4 dereferenceable(4) %this,
|
||||
// CHECK-SAME: i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index, i32 noundef %orderId, ptr noundef %name)
|
||||
// CHECK: call void @_ZN4hlsl19RWByteAddressBufferC2EjijjPKc(ptr noundef nonnull align 4 dereferenceable(4) %this1,
|
||||
// CHECK-SAME: i32 noundef %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, ptr noundef %{{.*}})
|
||||
|
||||
// Buf3 initialization part 1 - local variable declared in function foo() is initialized by
|
||||
// RasterizerOrderedByteAddressBuffer C1 default constructor
|
||||
@@ -64,8 +67,8 @@ export void foo() {
|
||||
|
||||
// Buf1 initialization part 3 - ByteAddressBuffer C2 constructor with explicit binding that initializes
|
||||
// handle with @llvm.dx.resource.handlefrombinding
|
||||
// CHECK: define linkonce_odr void @_ZN4hlsl17ByteAddressBufferC2Ejjij(ptr noundef nonnull align 4 dereferenceable(4) %this,
|
||||
// CHECK-SAME: i32 noundef %registerNo, i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index)
|
||||
// CHECK: define linkonce_odr void @_ZN4hlsl17ByteAddressBufferC2EjjijPKc(ptr noundef nonnull align 4 dereferenceable(4) %this,
|
||||
// CHECK-SAME: i32 noundef %registerNo, i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index, ptr noundef %name)
|
||||
// CHECK-DXIL: %[[HANDLE:.*]] = call target("dx.RawBuffer", i8, 0, 0) @llvm.dx.resource.handlefrombinding.tdx.RawBuffer_i8_0_0t(
|
||||
// CHECK-DXIL-SAME: i32 %{{.*}}, i32 %{{.*}}, i32 %{{.*}}, i32 %{{.*}}, i1 false)
|
||||
// CHECK-NEXT: %__handle = getelementptr inbounds nuw %"class.hlsl::ByteAddressBuffer", ptr %{{.*}}, i32 0, i32 0
|
||||
@@ -73,9 +76,10 @@ export void foo() {
|
||||
|
||||
// Buf2 initialization part 3 - body of RWByteAddressBuffer C2 constructor with implicit binding that initializes
|
||||
// handle with @llvm.dx.resource.handlefromimplicitbinding
|
||||
// CHECK: define linkonce_odr void @_ZN4hlsl19RWByteAddressBufferC2Ejijj(ptr noundef nonnull align 4 dereferenceable(4) %this,
|
||||
// CHECK-SAME: i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index, i32 noundef %orderId) unnamed_addr #1 align 2 {
|
||||
// CHECK: %[[HANDLE:.*]] = call target("dx.RawBuffer", i8, 1, 0) @llvm.dx.resource.handlefromimplicitbinding.tdx.RawBuffer_i8_1_0t(i32 %{{.*}}, i32 %{{.*}}, i32 %{{.*}}, i32 %{{.*}}, i1 false)
|
||||
// CHECK: define linkonce_odr void @_ZN4hlsl19RWByteAddressBufferC2EjijjPKc(ptr noundef nonnull align 4 dereferenceable(4) %this,
|
||||
// CHECK-SAME: i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index, i32 noundef %orderId, ptr noundef %name)
|
||||
// CHECK: %[[HANDLE:.*]] = call target("dx.RawBuffer", i8, 1, 0) @llvm.dx.resource.handlefromimplicitbinding.tdx.RawBuffer_i8_1_0t
|
||||
// CHECK-SAME: (i32 %{{.*}}, i32 %{{.*}}, i32 %{{.*}}, i32 %{{.*}}, i1 false)
|
||||
// CHECK-NEXT: %__handle = getelementptr inbounds nuw %"class.hlsl::RWByteAddressBuffer", ptr %this1, i32 0, i32 0
|
||||
// CHECK-NEXT: store target("dx.RawBuffer", i8, 1, 0) %[[HANDLE]], ptr %__handle, align 4
|
||||
|
||||
|
||||
@@ -24,30 +24,33 @@ export void foo() {
|
||||
// CHECK: %"class.hlsl::RWBuffer.1" = type { target("dx.TypedBuffer", i32, 1, 0, 1) }
|
||||
|
||||
// CHECK: @_ZL4Buf1 = internal global %"class.hlsl::RWBuffer" poison, align 4
|
||||
// CHECK: @[[Buf1Str:.*]] = private unnamed_addr constant [5 x i8] c"Buf1\00", align 1
|
||||
// CHECK: @_ZL4Buf2 = internal global %"class.hlsl::RWBuffer.0" poison, align 4
|
||||
// CHECK: @[[Buf2Str:.*]] = private unnamed_addr constant [5 x i8] c"Buf2\00", align 1
|
||||
|
||||
// Buf1 initialization part 1 - global init function that calls RWBuffer<float> C1 constructor with explicit binding
|
||||
// CHECK: define internal void @__cxx_global_var_init()
|
||||
// CHECK-NEXT: entry:
|
||||
// CHECK-NEXT: call void @_ZN4hlsl8RWBufferIfEC1Ejjij(ptr noundef nonnull align 4 dereferenceable(4) @_ZL4Buf1,
|
||||
// CHECK-SAME: i32 noundef 5, i32 noundef 3, i32 noundef 1, i32 noundef 0)
|
||||
// CHECK-NEXT: call void @_ZN4hlsl8RWBufferIfEC1EjjijPKc(ptr noundef nonnull align 4 dereferenceable(4) @_ZL4Buf1,
|
||||
// CHECK-SAME: i32 noundef 5, i32 noundef 3, i32 noundef 1, i32 noundef 0, ptr noundef @[[Buf1Str]])
|
||||
|
||||
// Buf1 initialization part 2 - body of RWBuffer<float> C1 constructor with explicit binding that calls the C2 constructor
|
||||
// CHECK: define linkonce_odr void @_ZN4hlsl8RWBufferIfEC1Ejjij(ptr noundef nonnull align 4 dereferenceable(4) %this,
|
||||
// CHECK-SAME: i32 noundef %registerNo, i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index)
|
||||
// CHECK: call void @_ZN4hlsl8RWBufferIfEC2Ejjij(ptr noundef nonnull align 4 dereferenceable(4)
|
||||
// CHECK-SAME: %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}})
|
||||
// CHECK: define linkonce_odr void @_ZN4hlsl8RWBufferIfEC1EjjijPKc(ptr noundef nonnull align 4 dereferenceable(4) %this,
|
||||
// CHECK-SAME: i32 noundef %registerNo, i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index, ptr noundef %name)
|
||||
// CHECK: call void @_ZN4hlsl8RWBufferIfEC2EjjijPKc(ptr noundef nonnull align 4 dereferenceable(4)
|
||||
// CHECK-SAME: %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, ptr noundef %{{.*}})
|
||||
|
||||
// Buf2 initialization part 1 - global init function that calls RWBuffer<float> C1 constructor with implicit binding
|
||||
// CHECK: define internal void @__cxx_global_var_init.1()
|
||||
// CHECK-NEXT: entry:
|
||||
// CHECK-NEXT: call void @_ZN4hlsl8RWBufferIdEC1Ejijj(ptr noundef nonnull align 4 dereferenceable(4) @_ZL4Buf2,
|
||||
// CHECK-SAME: i32 noundef 0, i32 noundef 1, i32 noundef 0, i32 noundef 0)
|
||||
// CHECK-NEXT: call void @_ZN4hlsl8RWBufferIdEC1EjijjPKc(ptr noundef nonnull align 4 dereferenceable(4) @_ZL4Buf2,
|
||||
// CHECK-SAME: i32 noundef 0, i32 noundef 1, i32 noundef 0, i32 noundef 0, ptr noundef @[[Buf2Str]])
|
||||
|
||||
// Buf2 initialization part 2 - body of RWBuffer<float> C1 constructor with implicit binding that calls the C2 constructor
|
||||
// CHECK: define linkonce_odr void @_ZN4hlsl8RWBufferIdEC1Ejijj(ptr noundef nonnull align 4 dereferenceable(4) %this,
|
||||
// CHECK-SAME: i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index, i32 noundef %orderId)
|
||||
// CHECK: call void @_ZN4hlsl8RWBufferIdEC2Ejijj(ptr noundef nonnull align 4 dereferenceable(4) %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}) #4
|
||||
// CHECK: define linkonce_odr void @_ZN4hlsl8RWBufferIdEC1EjijjPKc(ptr noundef nonnull align 4 dereferenceable(4) %this,
|
||||
// CHECK-SAME: i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index, i32 noundef %orderId, ptr noundef %name)
|
||||
// CHECK: call void @_ZN4hlsl8RWBufferIdEC2EjijjPKc(ptr noundef nonnull align 4 dereferenceable(4)
|
||||
// CHECK-SAME: %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, ptr noundef %{{.*}})
|
||||
|
||||
// Buf3 initialization part 1 - local variable declared in function foo() is initialized by RWBuffer<int> C1 default constructor
|
||||
// CHECK: define void @_Z3foov()
|
||||
@@ -61,8 +64,8 @@ export void foo() {
|
||||
|
||||
// Buf1 initialization part 3 - body of RWBuffer<float> C2 constructor with explicit binding that initializes
|
||||
// handle with @llvm.dx.resource.handlefrombinding
|
||||
// CHECK: define linkonce_odr void @_ZN4hlsl8RWBufferIfEC2Ejjij(ptr noundef nonnull align 4 dereferenceable(4) %this,
|
||||
// CHECK-SAME: i32 noundef %registerNo, i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index)
|
||||
// CHECK: define linkonce_odr void @_ZN4hlsl8RWBufferIfEC2EjjijPKc(ptr noundef nonnull align 4 dereferenceable(4) %this,
|
||||
// CHECK-SAME: i32 noundef %registerNo, i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index, ptr noundef %name)
|
||||
// CHECK-DXIL: %[[HANDLE:.*]] = call target("dx.TypedBuffer", float, 1, 0, 0) @llvm.dx.resource.handlefrombinding.tdx.TypedBuffer_f32_1_0_0t(
|
||||
// CHECK-DXIL-SAME: i32 %{{.*}}, i32 %{{.*}}, i32 %{{.*}}, i32 %{{.*}}, i1 false)
|
||||
// CHECK-NEXT: %__handle = getelementptr inbounds nuw %"class.hlsl::RWBuffer", ptr %{{.*}}, i32 0, i32 0
|
||||
@@ -70,9 +73,10 @@ export void foo() {
|
||||
|
||||
// Buf2 initialization part 3 - body of RWBuffer<float> C2 constructor with implicit binding that initializes
|
||||
// handle with @llvm.dx.resource.handlefromimplicitbinding
|
||||
// CHECK: define linkonce_odr void @_ZN4hlsl8RWBufferIdEC2Ejijj(ptr noundef nonnull align 4 dereferenceable(4) %this,
|
||||
// CHECK-SAME: i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index, i32 noundef %orderId) unnamed_addr #1 align 2 {
|
||||
// CHECK: %[[HANDLE:.*]] = call target("dx.TypedBuffer", double, 1, 0, 0) @llvm.dx.resource.handlefromimplicitbinding.tdx.TypedBuffer_f64_1_0_0t(i32 %{{.*}}, i32 %{{.*}}, i32 %{{.*}}, i32 %{{.*}}, i1 false)
|
||||
// CHECK: define linkonce_odr void @_ZN4hlsl8RWBufferIdEC2EjijjPKc(ptr noundef nonnull align 4 dereferenceable(4) %this,
|
||||
// CHECK-SAME: i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index, i32 noundef %orderId, ptr noundef %name)
|
||||
// CHECK: %[[HANDLE:.*]] = call target("dx.TypedBuffer", double, 1, 0, 0) @llvm.dx.resource.handlefromimplicitbinding.tdx.TypedBuffer_f64_1_0_0t
|
||||
// CHECK-SAME: (i32 %{{.*}}, i32 %{{.*}}, i32 %{{.*}}, i32 %{{.*}}, i1 false)
|
||||
// CHECK-NEXT: %__handle = getelementptr inbounds nuw %"class.hlsl::RWBuffer.0", ptr %{{.*}}, i32 0, i32 0
|
||||
// CHECK-NEXT: store target("dx.TypedBuffer", double, 1, 0, 0) %[[HANDLE]], ptr %__handle, align 4
|
||||
|
||||
|
||||
@@ -23,34 +23,36 @@ export void foo() {
|
||||
// CHECK: %"class.hlsl::AppendStructuredBuffer" = type { target("dx.RawBuffer", float, 1, 0) }
|
||||
|
||||
// CHECK: @_ZL4Buf1 = internal global %"class.hlsl::StructuredBuffer" poison, align 4
|
||||
// CHECK: @[[Buf1Str:.*]] = private unnamed_addr constant [5 x i8] c"Buf1\00", align 1
|
||||
// CHECK: @_ZL4Buf2 = internal global %"class.hlsl::RWStructuredBuffer" poison, align 4
|
||||
// CHECK: @[[Buf2Str:.*]] = private unnamed_addr constant [5 x i8] c"Buf2\00", align 1
|
||||
|
||||
// Buf1 initialization part 1 - global init function that calls StructuredBuffer<float> C1 constructor
|
||||
// with explicit binding
|
||||
// CHECK: define internal void @__cxx_global_var_init()
|
||||
// CHECK-NEXT: entry:
|
||||
// CHECK-NEXT: call void @_ZN4hlsl16StructuredBufferIfEC1Ejjij(ptr noundef nonnull align 4 dereferenceable(4) @_ZL4Buf1,
|
||||
// CHECK-SAME: i32 noundef 10, i32 noundef 2, i32 noundef 1, i32 noundef 0)
|
||||
// CHECK-NEXT: call void @_ZN4hlsl16StructuredBufferIfEC1EjjijPKc(ptr noundef nonnull align 4 dereferenceable(4) @_ZL4Buf1,
|
||||
// CHECK-SAME: i32 noundef 10, i32 noundef 2, i32 noundef 1, i32 noundef 0, ptr noundef @[[Buf1Str]])
|
||||
|
||||
// Buf1 initialization part 2 - body of StructuredBuffer<float> C1 constructor with explicit binding
|
||||
// that calls the C2 constructor
|
||||
// CHECK: define linkonce_odr void @_ZN4hlsl16StructuredBufferIfEC1Ejjij(ptr noundef nonnull align 4 dereferenceable(4) %this,
|
||||
// CHECK-SAME: i32 noundef %registerNo, i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index)
|
||||
// CHECK: call void @_ZN4hlsl16StructuredBufferIfEC2Ejjij(ptr noundef nonnull align 4 dereferenceable(4)
|
||||
// CHECK-SAME: %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}})
|
||||
// CHECK: define linkonce_odr void @_ZN4hlsl16StructuredBufferIfEC1EjjijPKc(ptr noundef nonnull align 4 dereferenceable(4) %this,
|
||||
// CHECK-SAME: i32 noundef %registerNo, i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index, ptr noundef %name)
|
||||
// CHECK: call void @_ZN4hlsl16StructuredBufferIfEC2EjjijPKc(ptr noundef nonnull align 4 dereferenceable(4)
|
||||
// CHECK-SAME: %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, ptr noundef %{{.*}})
|
||||
|
||||
// Buf2 initialization part 1 - global init function that calls RWStructuredBuffer<float> C1 constructor with
|
||||
// implicit binding
|
||||
// CHECK: define internal void @__cxx_global_var_init.1()
|
||||
// CHECK-NEXT: entry:
|
||||
// CHECK-NEXT: call void @_ZN4hlsl18RWStructuredBufferIfEC1Ejijj(ptr noundef nonnull align 4 dereferenceable(4) @_ZL4Buf2,
|
||||
// CHECK-SAME: i32 noundef 0, i32 noundef 1, i32 noundef 0, i32 noundef 0)
|
||||
// CHECK-NEXT: call void @_ZN4hlsl18RWStructuredBufferIfEC1EjijjPKc(ptr noundef nonnull align 4 dereferenceable(4) @_ZL4Buf2,
|
||||
// CHECK-SAME: i32 noundef 0, i32 noundef 1, i32 noundef 0, i32 noundef 0, ptr noundef @[[Buf2Str]])
|
||||
|
||||
// Buf2 initialization part 2 - body of RWStructuredBuffer<float> C1 constructor with implicit binding that calls the C2 constructor
|
||||
// CHECK: define linkonce_odr void @_ZN4hlsl18RWStructuredBufferIfEC1Ejijj(ptr noundef nonnull align 4 dereferenceable(4) %this,
|
||||
// CHECK-SAME: i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index, i32 noundef %orderId)
|
||||
// CHECK: call void @_ZN4hlsl18RWStructuredBufferIfEC2Ejijj(ptr noundef nonnull align 4 dereferenceable(4)
|
||||
// CHECK-SAME; %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}) #4
|
||||
// CHECK: define linkonce_odr void @_ZN4hlsl18RWStructuredBufferIfEC1EjijjPKc(ptr noundef nonnull align 4 dereferenceable(4) %this,
|
||||
// CHECK-SAME: i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index, i32 noundef %orderId, ptr noundef %name)
|
||||
// CHECK: call void @_ZN4hlsl18RWStructuredBufferIfEC2EjijjPKc(ptr noundef nonnull align 4 dereferenceable(4)
|
||||
// CHECK-SAME: %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, ptr noundef %{{.*}})
|
||||
|
||||
// Buf3 initialization part 1 - local variable declared in function foo() is initialized by
|
||||
// AppendStructuredBuffer<float> C1 default constructor
|
||||
@@ -66,8 +68,8 @@ export void foo() {
|
||||
|
||||
// Buf1 initialization part 3 - body of AppendStructuredBuffer<float> C2 constructor with explicit binding
|
||||
// that initializes handle with @llvm.dx.resource.handlefrombinding
|
||||
// CHECK: define linkonce_odr void @_ZN4hlsl16StructuredBufferIfEC2Ejjij(ptr noundef nonnull align 4 dereferenceable(4) %this,
|
||||
// CHECK-SAME: i32 noundef %registerNo, i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index)
|
||||
// CHECK: define linkonce_odr void @_ZN4hlsl16StructuredBufferIfEC2EjjijPKc(ptr noundef nonnull align 4 dereferenceable(4) %this,
|
||||
// CHECK-SAME: i32 noundef %registerNo, i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index, ptr noundef %name)
|
||||
// CHECK-DXIL: %[[HANDLE:.*]] = call target("dx.RawBuffer", float, 0, 0) @llvm.dx.resource.handlefrombinding.tdx.RawBuffer_f32_0_0t(
|
||||
// CHECK-SAME: i32 %{{.*}}, i32 %{{.*}}, i32 %{{.*}}, i32 %{{.*}}, i1 false)
|
||||
// CHECK-NEXT: %__handle = getelementptr inbounds nuw %"class.hlsl::StructuredBuffer", ptr %{{.*}}, i32 0, i32 0
|
||||
@@ -75,9 +77,10 @@ export void foo() {
|
||||
|
||||
// Buf2 initialization part 3 - body of RWStructuredBuffer<float> C2 constructor with implicit binding that initializes
|
||||
// handle with @llvm.dx.resource.handlefromimplicitbinding
|
||||
// CHECK: define linkonce_odr void @_ZN4hlsl18RWStructuredBufferIfEC2Ejijj(ptr noundef nonnull align 4 dereferenceable(4) %this,
|
||||
// CHECK-SAME: i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index, i32 noundef %orderId) unnamed_addr #1 align 2 {
|
||||
// CHECK: %[[HANDLE:.*]] = call target("dx.RawBuffer", float, 1, 0) @llvm.dx.resource.handlefromimplicitbinding.tdx.RawBuffer_f32_1_0t(i32 %{{.*}}, i32 %{{.*}}, i32 %{{.*}}, i32 %{{.*}}, i1 false)
|
||||
// CHECK: define linkonce_odr void @_ZN4hlsl18RWStructuredBufferIfEC2EjijjPKc(ptr noundef nonnull align 4 dereferenceable(4) %this,
|
||||
// CHECK-SAME: i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index, i32 noundef %orderId, ptr noundef %name)
|
||||
// CHECK: %[[HANDLE:.*]] = call target("dx.RawBuffer", float, 1, 0) @llvm.dx.resource.handlefromimplicitbinding.tdx.RawBuffer_f32_1_0t
|
||||
// CHECK-SAME: (i32 %{{.*}}, i32 %{{.*}}, i32 %{{.*}}, i32 %{{.*}}, i1 false)
|
||||
// CHECK-NEXT: %__handle = getelementptr inbounds nuw %"class.hlsl::RWStructuredBuffer", ptr %{{.*}}, i32 0, i32 0
|
||||
// CHECK-NEXT: store target("dx.RawBuffer", float, 1, 0) %[[HANDLE]], ptr %__handle, align 4
|
||||
|
||||
|
||||
Reference in New Issue
Block a user