From 8607f08093d35e469f6e0403378780ac29bc1335 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Wed, 6 Mar 2024 16:46:27 -0500 Subject: [PATCH] Bool is now an i1 --- analyzer/builtin.go | 2 +- generator/control-flow_test.go | 6 +++--- generator/misc_test.go | 2 +- generator/type_test.go | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/analyzer/builtin.go b/analyzer/builtin.go index 437cc85..a9e2e55 100644 --- a/analyzer/builtin.go +++ b/analyzer/builtin.go @@ -42,7 +42,7 @@ func primitiveType (name string) *entity.TypeNamed { func init () { builtinTypes["Index"] = &entity.TypeWord { Acc: entity.AccessPublic } builtinTypes["Byte"] = &entity.TypeInt { Acc: entity.AccessPublic, Signed: false, Width: 8 } - builtinTypes["Bool"] = &entity.TypeInt { Acc: entity.AccessPublic, Signed: false, Width: 8 } + builtinTypes["Bool"] = &entity.TypeInt { Acc: entity.AccessPublic, Signed: false, Width: 1 } builtinTypes["Rune"] = &entity.TypeInt { Acc: entity.AccessPublic, Signed: false, Width: 32 } builtinTypes["String"] = &entity.TypeSlice { Acc: entity.AccessPublic, diff --git a/generator/control-flow_test.go b/generator/control-flow_test.go index 294418b..ea5376b 100644 --- a/generator/control-flow_test.go +++ b/generator/control-flow_test.go @@ -200,7 +200,7 @@ U: (| Int F64) func TestMatchReturn (test *testing.T) { testString (test, -`%"AAAAAAAAAAAAAAAAAAAAAA==::Bool" = type i8 +`%"AAAAAAAAAAAAAAAAAAAAAA==::Bool" = type i1 %"0zNZN147MN2wzMAQ6NS2dQ==::U" = type { i64, i64 } define %"AAAAAAAAAAAAAAAAAAAAAA==::Bool" @"0zNZN147MN2wzMAQ6NS2dQ==::isInt"(%"0zNZN147MN2wzMAQ6NS2dQ==::U" %u) { 0: @@ -232,7 +232,7 @@ U: (| Int F64) func TestMatchReturnValueUsed (test *testing.T) { testString (test, -`%"AAAAAAAAAAAAAAAAAAAAAA==::Bool" = type i8 +`%"AAAAAAAAAAAAAAAAAAAAAA==::Bool" = type i1 %"0zNZN147MN2wzMAQ6NS2dQ==::U" = type { i64, i64 } define %"AAAAAAAAAAAAAAAAAAAAAA==::Bool" @"0zNZN147MN2wzMAQ6NS2dQ==::isInt"(%"0zNZN147MN2wzMAQ6NS2dQ==::U" %u) { 0: @@ -340,7 +340,7 @@ U: (| Int F64 UInt) func TestIfElseReturnValueUsed (test *testing.T) { testString (test, -`%"AAAAAAAAAAAAAAAAAAAAAA==::Bool" = type i8 +`%"AAAAAAAAAAAAAAAAAAAAAA==::Bool" = type i1 define %"AAAAAAAAAAAAAAAAAAAAAA==::Bool" @"0zNZN147MN2wzMAQ6NS2dQ==::is5"(i64 %x) { 0: %1 = alloca i64 diff --git a/generator/misc_test.go b/generator/misc_test.go index 516bfff..b61f45b 100644 --- a/generator/misc_test.go +++ b/generator/misc_test.go @@ -93,7 +93,7 @@ testString (test, func TestCompare (test *testing.T) { testString (test, -`%"AAAAAAAAAAAAAAAAAAAAAA==::Bool" = type i8 +`%"AAAAAAAAAAAAAAAAAAAAAA==::Bool" = type i1 %"0zNZN147MN2wzMAQ6NS2dQ==::A" = type i64 define void @"0zNZN147MN2wzMAQ6NS2dQ==::main"() { 0: diff --git a/generator/type_test.go b/generator/type_test.go index f62c585..4923b37 100644 --- a/generator/type_test.go +++ b/generator/type_test.go @@ -9,7 +9,7 @@ testString (test, %"0zNZN147MN2wzMAQ6NS2dQ==::Pegasus" = type { ptr, ptr, ptr, ptr, ptr } %"0zNZN147MN2wzMAQ6NS2dQ==::Point" = type { i64, i64 } %"0zNZN147MN2wzMAQ6NS2dQ==::Rectangle" = type { %"0zNZN147MN2wzMAQ6NS2dQ==::Point", %"0zNZN147MN2wzMAQ6NS2dQ==::Point" } -%"AAAAAAAAAAAAAAAAAAAAAA==::Bool" = type i8 +%"AAAAAAAAAAAAAAAAAAAAAA==::Bool" = type i1 %"AAAAAAAAAAAAAAAAAAAAAA==::Byte" = type i8 %"AAAAAAAAAAAAAAAAAAAAAA==::Rune" = type i32 %"0zNZN147MN2wzMAQ6NS2dQ==::AllInts" = type { %"AAAAAAAAAAAAAAAAAAAAAA==::Bool", %"AAAAAAAAAAAAAAAAAAAAAA==::Byte", %"AAAAAAAAAAAAAAAAAAAAAA==::Index", %"AAAAAAAAAAAAAAAAAAAAAA==::Rune", i64, i64, i8, i16, i32, i64, i8, i16, i32, i64 }