From 5720d19e1ee3034ed474170c5cff55975c8ee649 Mon Sep 17 00:00:00 2001 From: Philipp Grulich Date: Fri, 27 Sep 2024 01:27:12 +0200 Subject: [PATCH] Added support for nautilus::val and T is a enum class --- .../after_ssa/callEnumClassFunction.trace | 3 ++ .../after_ssa/callEnumFunction.trace | 3 ++ .../data/enum-tests/after_ssa/getEnum.trace | 3 ++ .../enum-tests/after_ssa/handleEnum.trace | 4 +++ .../after_ssa/handleEnumLogLevel.trace | 7 +++++ .../data/enum-tests/after_ssa/isEnum.trace | 19 +++++++++++++ .../enum-tests/ir/callEnumClassFunction.trace | 7 +++++ .../data/enum-tests/ir/callEnumFunction.trace | 7 +++++ .../test/data/enum-tests/ir/getEnum.trace | 7 +++++ .../test/data/enum-tests/ir/handleEnum.trace | 8 ++++++ .../enum-tests/ir/handleEnumLogLevel.trace | 11 ++++++++ nautilus/test/data/enum-tests/ir/isEnum.trace | 28 +++++++++++++++++++ .../tracing/callEnumClassFunction.trace | 3 ++ .../enum-tests/tracing/callEnumFunction.trace | 3 ++ .../data/enum-tests/tracing/getEnum.trace | 3 ++ .../tracing/handleEnumLogLevel.trace | 20 +++---------- .../test/data/enum-tests/tracing/isEnum.trace | 17 +++++++++++ 17 files changed, 137 insertions(+), 16 deletions(-) diff --git a/nautilus/test/data/enum-tests/after_ssa/callEnumClassFunction.trace b/nautilus/test/data/enum-tests/after_ssa/callEnumClassFunction.trace index e69de29b..ce58c9e3 100644 --- a/nautilus/test/data/enum-tests/after_ssa/callEnumClassFunction.trace +++ b/nautilus/test/data/enum-tests/after_ssa/callEnumClassFunction.trace @@ -0,0 +1,3 @@ +B0($1:ui8) + CALL $2 nautilus::enumClassFunction(nautilus::LogLevel)($1) :i32 + RETURN $2 :i32 diff --git a/nautilus/test/data/enum-tests/after_ssa/callEnumFunction.trace b/nautilus/test/data/enum-tests/after_ssa/callEnumFunction.trace index e69de29b..8a907f5b 100644 --- a/nautilus/test/data/enum-tests/after_ssa/callEnumFunction.trace +++ b/nautilus/test/data/enum-tests/after_ssa/callEnumFunction.trace @@ -0,0 +1,3 @@ +B0($1:ui32) + CALL $2 nautilus::enumFunction(nautilus::Color)($1) :i32 + RETURN $2 :i32 diff --git a/nautilus/test/data/enum-tests/after_ssa/getEnum.trace b/nautilus/test/data/enum-tests/after_ssa/getEnum.trace index e69de29b..c3a92b79 100644 --- a/nautilus/test/data/enum-tests/after_ssa/getEnum.trace +++ b/nautilus/test/data/enum-tests/after_ssa/getEnum.trace @@ -0,0 +1,3 @@ +B0() + CONST $1 0 :ui32 + RETURN $1 :ui32 diff --git a/nautilus/test/data/enum-tests/after_ssa/handleEnum.trace b/nautilus/test/data/enum-tests/after_ssa/handleEnum.trace index e69de29b..3b004170 100644 --- a/nautilus/test/data/enum-tests/after_ssa/handleEnum.trace +++ b/nautilus/test/data/enum-tests/after_ssa/handleEnum.trace @@ -0,0 +1,4 @@ +B0($1:ui32) + CONST $2 0 :ui32 + EQ $3 $1 $2 :bool + RETURN $3 :bool diff --git a/nautilus/test/data/enum-tests/after_ssa/handleEnumLogLevel.trace b/nautilus/test/data/enum-tests/after_ssa/handleEnumLogLevel.trace index e69de29b..f440b5e0 100644 --- a/nautilus/test/data/enum-tests/after_ssa/handleEnumLogLevel.trace +++ b/nautilus/test/data/enum-tests/after_ssa/handleEnumLogLevel.trace @@ -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 diff --git a/nautilus/test/data/enum-tests/after_ssa/isEnum.trace b/nautilus/test/data/enum-tests/after_ssa/isEnum.trace index e69de29b..58ef03b3 100644 --- a/nautilus/test/data/enum-tests/after_ssa/isEnum.trace +++ b/nautilus/test/data/enum-tests/after_ssa/isEnum.trace @@ -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 diff --git a/nautilus/test/data/enum-tests/ir/callEnumClassFunction.trace b/nautilus/test/data/enum-tests/ir/callEnumClassFunction.trace index e69de29b..4a7ddacb 100644 --- a/nautilus/test/data/enum-tests/ir/callEnumClassFunction.trace +++ b/nautilus/test/data/enum-tests/ir/callEnumClassFunction.trace @@ -0,0 +1,7 @@ +NESIR { +execute() { +Block_0($1:ui8): + $2 = nautilus::enumClassFunction(nautilus::LogLevel)($1) :i32 + return ($2) :i32 +} +} //NESIR \ No newline at end of file diff --git a/nautilus/test/data/enum-tests/ir/callEnumFunction.trace b/nautilus/test/data/enum-tests/ir/callEnumFunction.trace index e69de29b..26212912 100644 --- a/nautilus/test/data/enum-tests/ir/callEnumFunction.trace +++ b/nautilus/test/data/enum-tests/ir/callEnumFunction.trace @@ -0,0 +1,7 @@ +NESIR { +execute() { +Block_0($1:ui32): + $2 = nautilus::enumFunction(nautilus::Color)($1) :i32 + return ($2) :i32 +} +} //NESIR \ No newline at end of file diff --git a/nautilus/test/data/enum-tests/ir/getEnum.trace b/nautilus/test/data/enum-tests/ir/getEnum.trace index e69de29b..a0e646a5 100644 --- a/nautilus/test/data/enum-tests/ir/getEnum.trace +++ b/nautilus/test/data/enum-tests/ir/getEnum.trace @@ -0,0 +1,7 @@ +NESIR { +execute() { +Block_0(): + $1 = 0 :ui32 + return ($1) :ui32 +} +} //NESIR \ No newline at end of file diff --git a/nautilus/test/data/enum-tests/ir/handleEnum.trace b/nautilus/test/data/enum-tests/ir/handleEnum.trace index e69de29b..87b6a963 100644 --- a/nautilus/test/data/enum-tests/ir/handleEnum.trace +++ b/nautilus/test/data/enum-tests/ir/handleEnum.trace @@ -0,0 +1,8 @@ +NESIR { +execute() { +Block_0($1:ui32): + $2 = 0 :ui32 + $3 = $1 == $2 :bool + return ($3) :bool +} +} //NESIR \ No newline at end of file diff --git a/nautilus/test/data/enum-tests/ir/handleEnumLogLevel.trace b/nautilus/test/data/enum-tests/ir/handleEnumLogLevel.trace index e69de29b..534564a5 100644 --- a/nautilus/test/data/enum-tests/ir/handleEnumLogLevel.trace +++ b/nautilus/test/data/enum-tests/ir/handleEnumLogLevel.trace @@ -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 \ No newline at end of file diff --git a/nautilus/test/data/enum-tests/ir/isEnum.trace b/nautilus/test/data/enum-tests/ir/isEnum.trace index e69de29b..f95dbb9c 100644 --- a/nautilus/test/data/enum-tests/ir/isEnum.trace +++ b/nautilus/test/data/enum-tests/ir/isEnum.trace @@ -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 \ No newline at end of file diff --git a/nautilus/test/data/enum-tests/tracing/callEnumClassFunction.trace b/nautilus/test/data/enum-tests/tracing/callEnumClassFunction.trace index e69de29b..ce58c9e3 100644 --- a/nautilus/test/data/enum-tests/tracing/callEnumClassFunction.trace +++ b/nautilus/test/data/enum-tests/tracing/callEnumClassFunction.trace @@ -0,0 +1,3 @@ +B0($1:ui8) + CALL $2 nautilus::enumClassFunction(nautilus::LogLevel)($1) :i32 + RETURN $2 :i32 diff --git a/nautilus/test/data/enum-tests/tracing/callEnumFunction.trace b/nautilus/test/data/enum-tests/tracing/callEnumFunction.trace index e69de29b..8a907f5b 100644 --- a/nautilus/test/data/enum-tests/tracing/callEnumFunction.trace +++ b/nautilus/test/data/enum-tests/tracing/callEnumFunction.trace @@ -0,0 +1,3 @@ +B0($1:ui32) + CALL $2 nautilus::enumFunction(nautilus::Color)($1) :i32 + RETURN $2 :i32 diff --git a/nautilus/test/data/enum-tests/tracing/getEnum.trace b/nautilus/test/data/enum-tests/tracing/getEnum.trace index e69de29b..c3a92b79 100644 --- a/nautilus/test/data/enum-tests/tracing/getEnum.trace +++ b/nautilus/test/data/enum-tests/tracing/getEnum.trace @@ -0,0 +1,3 @@ +B0() + CONST $1 0 :ui32 + RETURN $1 :ui32 diff --git a/nautilus/test/data/enum-tests/tracing/handleEnumLogLevel.trace b/nautilus/test/data/enum-tests/tracing/handleEnumLogLevel.trace index 61160251..f440b5e0 100644 --- a/nautilus/test/data/enum-tests/tracing/handleEnumLogLevel.trace +++ b/nautilus/test/data/enum-tests/tracing/handleEnumLogLevel.trace @@ -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 diff --git a/nautilus/test/data/enum-tests/tracing/isEnum.trace b/nautilus/test/data/enum-tests/tracing/isEnum.trace index e69de29b..72ebe93d 100644 --- a/nautilus/test/data/enum-tests/tracing/isEnum.trace +++ b/nautilus/test/data/enum-tests/tracing/isEnum.trace @@ -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