SPV return from main: Simplify a legacy design such returns are not jumps to exit block.

Structured control-flow rules allow leaving the middle of a construct through
a return, but not through a jump to a block that does a return.

Addresses issue #58.
This commit is contained in:
John Kessenich 2015-09-14 20:58:02 -06:00
parent 5f5b205ce9
commit e770b3e6cf
74 changed files with 9648 additions and 9816 deletions

View file

@ -8,7 +8,7 @@ Linked compute stage:
TBD functionality: Is atomic_uint an opaque handle in the uniform storage class, or an addresses in the atomic storage class?
// Module Version 99
// Generated by (magic number): 51a00bb
// Id's are bound by 75
// Id's are bound by 74
Source ESSL 310
Capability Shader
@ -16,113 +16,111 @@ TBD functionality: Is atomic_uint an opaque handle in the uniform storage class,
MemoryModel Logical GLSL450
EntryPoint GLCompute 4 "main"
Name 4 "main"
Name 11 "func(au1;"
Name 10 "c"
Name 13 "atoms("
Name 22 "counter"
Name 23 "param"
Name 26 "val"
Name 30 "countArr"
Name 39 "origi"
Name 41 "atomi"
Name 45 "origu"
Name 47 "atomu"
Name 49 "value"
Name 72 "arrX"
Name 73 "arrY"
Name 74 "arrZ"
Decorate 22(counter) Binding 0
Decorate 30(countArr) Binding 0
Decorate 72(arrX) NoStaticUse
Decorate 73(arrY) NoStaticUse
Decorate 74(arrZ) NoStaticUse
Name 10 "func(au1;"
Name 9 "c"
Name 12 "atoms("
Name 21 "counter"
Name 22 "param"
Name 25 "val"
Name 29 "countArr"
Name 38 "origi"
Name 40 "atomi"
Name 44 "origu"
Name 46 "atomu"
Name 48 "value"
Name 71 "arrX"
Name 72 "arrY"
Name 73 "arrZ"
Decorate 21(counter) Binding 0
Decorate 29(countArr) Binding 0
Decorate 71(arrX) NoStaticUse
Decorate 72(arrY) NoStaticUse
Decorate 73(arrZ) NoStaticUse
2: TypeVoid
3: TypeFunction 2
7: TypeInt 32 0
8: TypePointer Function 7(int)
9: TypeFunction 7(int) 8(ptr)
16: 7(int) Constant 1
17: 7(int) Constant 0
20: 7(int) Constant 256
21: TypePointer UniformConstant 7(int)
22(counter): 21(ptr) Variable UniformConstant
27: 7(int) Constant 4
28: TypeArray 7(int) 27
29: TypePointer UniformConstant 28
30(countArr): 29(ptr) Variable UniformConstant
31: TypeInt 32 1
32: 31(int) Constant 2
38: TypePointer Function 31(int)
40: TypePointer WorkgroupLocal 31(int)
41(atomi): 40(ptr) Variable WorkgroupLocal
43: 31(int) Constant 3
46: TypePointer WorkgroupLocal 7(int)
47(atomu): 46(ptr) Variable WorkgroupLocal
49(value): 21(ptr) Variable UniformConstant
53: 7(int) Constant 7
61: 31(int) Constant 7
67: 7(int) Constant 10
70: TypeArray 31(int) 16
71: TypePointer PrivateGlobal 70
72(arrX): 71(ptr) Variable PrivateGlobal
73(arrY): 71(ptr) Variable PrivateGlobal
74(arrZ): 71(ptr) Variable PrivateGlobal
6: TypeInt 32 0
7: TypePointer Function 6(int)
8: TypeFunction 6(int) 7(ptr)
15: 6(int) Constant 1
16: 6(int) Constant 0
19: 6(int) Constant 256
20: TypePointer UniformConstant 6(int)
21(counter): 20(ptr) Variable UniformConstant
26: 6(int) Constant 4
27: TypeArray 6(int) 26
28: TypePointer UniformConstant 27
29(countArr): 28(ptr) Variable UniformConstant
30: TypeInt 32 1
31: 30(int) Constant 2
37: TypePointer Function 30(int)
39: TypePointer WorkgroupLocal 30(int)
40(atomi): 39(ptr) Variable WorkgroupLocal
42: 30(int) Constant 3
45: TypePointer WorkgroupLocal 6(int)
46(atomu): 45(ptr) Variable WorkgroupLocal
48(value): 20(ptr) Variable UniformConstant
52: 6(int) Constant 7
60: 30(int) Constant 7
66: 6(int) Constant 10
69: TypeArray 30(int) 15
70: TypePointer PrivateGlobal 69
71(arrX): 70(ptr) Variable PrivateGlobal
72(arrY): 70(ptr) Variable PrivateGlobal
73(arrZ): 70(ptr) Variable PrivateGlobal
4(main): 2 Function None 3
5: Label
23(param): 8(ptr) Variable Function
26(val): 8(ptr) Variable Function
MemoryBarrier 16 20
24: 7(int) Load 22(counter)
Store 23(param) 24
25: 7(int) FunctionCall 11(func(au1;) 23(param)
33: 21(ptr) AccessChain 30(countArr) 32
34: 7(int) Load 33
35: 7(int) AtomicLoad 34 16 17
Store 26(val) 35
36: 7(int) Load 22(counter)
37: 7(int) AtomicIDecrement 36 16 17
Branch 6
6: Label
22(param): 7(ptr) Variable Function
25(val): 7(ptr) Variable Function
MemoryBarrier 15 19
23: 6(int) Load 21(counter)
Store 22(param) 23
24: 6(int) FunctionCall 10(func(au1;) 22(param)
32: 20(ptr) AccessChain 29(countArr) 31
33: 6(int) Load 32
34: 6(int) AtomicLoad 33 15 16
Store 25(val) 34
35: 6(int) Load 21(counter)
36: 6(int) AtomicIDecrement 35 15 16
Return
FunctionEnd
11(func(au1;): 7(int) Function None 9
10(c): 8(ptr) FunctionParameter
12: Label
15: 7(int) Load 10(c)
18: 7(int) AtomicIIncrement 15 16 17
ReturnValue 18
10(func(au1;): 6(int) Function None 8
9(c): 7(ptr) FunctionParameter
11: Label
14: 6(int) Load 9(c)
17: 6(int) AtomicIIncrement 14 15 16
ReturnValue 17
FunctionEnd
13(atoms(): 2 Function None 3
14: Label
39(origi): 38(ptr) Variable Function
45(origu): 8(ptr) Variable Function
42: 31(int) Load 41(atomi)
44: 31(int) AtomicIAdd 42 16 17 43
Store 39(origi) 44
48: 7(int) Load 47(atomu)
50: 7(int) Load 49(value)
51: 7(int) AtomicAnd 48 16 17 50
Store 45(origu) 51
52: 7(int) Load 47(atomu)
54: 7(int) AtomicOr 52 16 17 53
Store 45(origu) 54
55: 7(int) Load 47(atomu)
56: 7(int) AtomicXor 55 16 17 53
Store 45(origu) 56
57: 7(int) Load 47(atomu)
58: 7(int) Load 49(value)
59: 7(int) AtomicSMin 57 16 17 58
Store 45(origu) 59
60: 31(int) Load 41(atomi)
62: 31(int) AtomicSMax 60 16 17 61
Store 39(origi) 62
63: 31(int) Load 41(atomi)
64: 31(int) Load 39(origi)
65: 31(int) AtomicExchange 63 16 17 64
Store 39(origi) 65
66: 7(int) Load 47(atomu)
68: 7(int) Load 49(value)
69: 7(int) AtomicCompareExchange 66 16 17 67 68
Store 45(origu) 69
12(atoms(): 2 Function None 3
13: Label
38(origi): 37(ptr) Variable Function
44(origu): 7(ptr) Variable Function
41: 30(int) Load 40(atomi)
43: 30(int) AtomicIAdd 41 15 16 42
Store 38(origi) 43
47: 6(int) Load 46(atomu)
49: 6(int) Load 48(value)
50: 6(int) AtomicAnd 47 15 16 49
Store 44(origu) 50
51: 6(int) Load 46(atomu)
53: 6(int) AtomicOr 51 15 16 52
Store 44(origu) 53
54: 6(int) Load 46(atomu)
55: 6(int) AtomicXor 54 15 16 52
Store 44(origu) 55
56: 6(int) Load 46(atomu)
57: 6(int) Load 48(value)
58: 6(int) AtomicSMin 56 15 16 57
Store 44(origu) 58
59: 30(int) Load 40(atomi)
61: 30(int) AtomicSMax 59 15 16 60
Store 38(origi) 61
62: 30(int) Load 40(atomi)
63: 30(int) Load 38(origi)
64: 30(int) AtomicExchange 62 15 16 63
Store 38(origi) 64
65: 6(int) Load 46(atomu)
67: 6(int) Load 48(value)
68: 6(int) AtomicCompareExchange 65 15 16 66 67
Store 44(origu) 68
Return
FunctionEnd