Skip to content

Commit

Permalink
Added support for nautilus::val<T> and T is a enum class
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippGrulich committed Oct 1, 2024
1 parent c0dd0ad commit 5720d19
Show file tree
Hide file tree
Showing 17 changed files with 137 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
B0($1:ui8)
CALL $2 nautilus::enumClassFunction(nautilus::LogLevel)($1) :i32
RETURN $2 :i32
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
B0($1:ui32)
CALL $2 nautilus::enumFunction(nautilus::Color)($1) :i32
RETURN $2 :i32
3 changes: 3 additions & 0 deletions nautilus/test/data/enum-tests/after_ssa/getEnum.trace
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
B0()
CONST $1 0 :ui32
RETURN $1 :ui32
4 changes: 4 additions & 0 deletions nautilus/test/data/enum-tests/after_ssa/handleEnum.trace
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
B0($1:ui32)
CONST $2 0 :ui32
EQ $3 $1 $2 :bool
RETURN $3 :bool
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
B0($1:ui8)
CONST $2 6 :ui8
EQ $3 $1 $2 :bool
CONST $4 5 :ui8
EQ $5 $1 $4 :bool
OR $6 $3 $5 :bool
RETURN $6 :bool
19 changes: 19 additions & 0 deletions nautilus/test/data/enum-tests/after_ssa/isEnum.trace
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
B0($1:ui32)
CONST $2 0 :ui32
EQ $3 $1 $2 :bool
CMP $4 $3 B1() B2($1) :void
B1()
CONST $5 1 :i32
JMP $0 B5($5) :void
B2($1:ui32)
CONST $7 1 :ui32
EQ $8 $1 $7 :bool
CMP $9 $8 B3() B4() :void
B3()
CONST $10 2 :i32
JMP $0 B5($10) :void
B4()
CONST $12 42 :i32
JMP $0 B5($12) :void
B5($5:i32)
RETURN $5 :i32
7 changes: 7 additions & 0 deletions nautilus/test/data/enum-tests/ir/callEnumClassFunction.trace
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
NESIR {
execute() {
Block_0($1:ui8):
$2 = nautilus::enumClassFunction(nautilus::LogLevel)($1) :i32
return ($2) :i32
}
} //NESIR
7 changes: 7 additions & 0 deletions nautilus/test/data/enum-tests/ir/callEnumFunction.trace
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
NESIR {
execute() {
Block_0($1:ui32):
$2 = nautilus::enumFunction(nautilus::Color)($1) :i32
return ($2) :i32
}
} //NESIR
7 changes: 7 additions & 0 deletions nautilus/test/data/enum-tests/ir/getEnum.trace
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
NESIR {
execute() {
Block_0():
$1 = 0 :ui32
return ($1) :ui32
}
} //NESIR
8 changes: 8 additions & 0 deletions nautilus/test/data/enum-tests/ir/handleEnum.trace
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
NESIR {
execute() {
Block_0($1:ui32):
$2 = 0 :ui32
$3 = $1 == $2 :bool
return ($3) :bool
}
} //NESIR
11 changes: 11 additions & 0 deletions nautilus/test/data/enum-tests/ir/handleEnumLogLevel.trace
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
NESIR {
execute() {
Block_0($1:ui8):
$2 = 6 :ui8
$3 = $1 == $2 :bool
$4 = 5 :ui8
$5 = $1 == $4 :bool
$6 = $3 or $5 :bool
return ($6) :bool
}
} //NESIR
28 changes: 28 additions & 0 deletions nautilus/test/data/enum-tests/ir/isEnum.trace
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
NESIR {
execute() {
Block_0($1:ui32):
$2 = 0 :ui32
$3 = $1 == $2 :bool
if $3 ? Block_1() : Block_2($1) :void

Block_1():
$5 = 1 :i32
br Block_5($5) :void

Block_5($5:i32):
return ($5) :i32

Block_2($1:ui32):
$7 = 1 :ui32
$8 = $1 == $7 :bool
if $8 ? Block_3() : Block_4() :void

Block_3():
$10 = 2 :i32
br Block_5($10) :void

Block_4():
$12 = 42 :i32
br Block_5($12) :void
}
} //NESIR
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
B0($1:ui8)
CALL $2 nautilus::enumClassFunction(nautilus::LogLevel)($1) :i32
RETURN $2 :i32
3 changes: 3 additions & 0 deletions nautilus/test/data/enum-tests/tracing/callEnumFunction.trace
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
B0($1:ui32)
CALL $2 nautilus::enumFunction(nautilus::Color)($1) :i32
RETURN $2 :i32
3 changes: 3 additions & 0 deletions nautilus/test/data/enum-tests/tracing/getEnum.trace
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
B0()
CONST $1 0 :ui32
RETURN $1 :ui32
20 changes: 4 additions & 16 deletions nautilus/test/data/enum-tests/tracing/handleEnumLogLevel.trace
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
B0($1:ui8)
CONST $2 6 :ui8
EQ $3 $1 $2 :bool
CMP $4 $3 B1() B2() :void
B1()
CONST $5 true :bool
RETURN $5 :bool
B2()
CONST $7 5 :ui8
EQ $8 $1 $7 :bool
CMP $9 $8 B3() B4() :void
B3()
CONST $10 true :bool
ASSIGN $5 $10 :bool
RETURN $5 :bool
B4()
CONST $12 false :bool
ASSIGN $5 $12 :bool
RETURN $5 :bool
CONST $4 5 :ui8
EQ $5 $1 $4 :bool
OR $6 $3 $5 :bool
RETURN $6 :bool
17 changes: 17 additions & 0 deletions nautilus/test/data/enum-tests/tracing/isEnum.trace
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
B0($1:ui32)
CONST $2 0 :ui32
EQ $3 $1 $2 :bool
CMP $4 $3 B1() B2() :void
B1()
CONST $5 1 :i32
RETURN $5 :i32
B2()
CONST $7 1 :ui32
EQ $8 $1 $7 :bool
CMP $9 $8 B3() B4() :void
B3()
CONST $10 2 :i32
RETURN $10 :i32
B4()
CONST $12 42 :i32
RETURN $12 :i32

0 comments on commit 5720d19

Please sign in to comment.