From ea3b50d03979b4cba7c5913f6c3aa538db868383 Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Mon, 10 Jan 2022 12:25:55 +0100 Subject: [PATCH] Codegen with better annotations on globals. --- src/compiler/llvm_codegen.c | 36 +++++++---- src/compiler/llvm_codegen_expr.c | 2 + src/version.h | 2 +- test/test_suite/arrays/array_literal.c3t | 2 +- test/test_suite/arrays/array_struct.c3t | 2 +- .../test_suite/arrays/complex_array_const.c3t | 8 +-- .../compile_time/compile_time_array_ref.c3t | 8 +-- .../compile_time/compile_time_bitops.c3t | 12 ++-- .../compile_time/compile_time_ptr_ref.c3t | 10 +-- test/test_suite/compile_time/ct_if.c3t | 10 +-- test/test_suite/compile_time/ct_switch.c3t | 20 +++--- .../compile_time/ct_switch_type_check.c3t | 12 ++-- .../compile_time/ternary_folding.c3t | 6 +- .../compile_time_introspection/alignof.c3t | 46 ++++++------- .../compile_time_introspection/nameof.c3t | 64 +++++++++---------- .../compile_time_introspection/offsetof.c3t | 30 ++++----- .../compile_time_introspection/qnameof.c3t | 36 +++++------ .../compile_time_introspection/sizeof.c3t | 32 +++++----- test/test_suite/constants/byte_literals.c3t | 10 +-- test/test_suite/constants/char_literals.c3t | 18 +++--- test/test_suite/constants/constants.c3t | 18 +++--- test/test_suite/debug_symbols/constants.c3t | 10 +-- test/test_suite/enumerations/compile_time.c3t | 10 +-- .../errors/failable_taddr_and_access.c3t | 4 +- .../test_suite/expressions/parsed_numbers.c3t | 8 +-- test/test_suite/expressions/strings.c3t | 2 +- test/test_suite/functions/static_vars.c3t | 4 +- test/test_suite/functions/test_regression.c3t | 4 +- .../functions/test_regression_mingw.c3t | 54 ++++++++-------- test/test_suite/globals/global_extname.c3t | 2 +- test/test_suite/initializer_lists/fasta.c3t | 34 +++++----- .../initializer_lists/general_tests.c3t | 6 +- test/test_suite/initializer_lists/statics.c3t | 4 +- .../initializer_lists/subarrays.c3t | 20 +++--- test/test_suite/literals/literal_general.c3t | 16 ++--- test/test_suite/macros/userland_bitcast.c3t | 4 +- test/test_suite/pointers/const_pointer.c3t | 2 +- test/test_suite/scoping/general_scoping.c3t | 6 +- test/test_suite/slices/slice_assign.c3t | 2 +- .../statements/custom_foreach_with_ref.c3t | 30 ++++----- test/test_suite/statements/fallthough_do.c3t | 6 +- test/test_suite/statements/while_switch.c3t | 4 +- .../strings/literal_to_subarray.c3t | 8 +-- test/test_suite/strings/multiline_strings.c3t | 20 +++--- test/test_suite/strings/string_escape.c3t | 2 +- test/test_suite/strings/string_len.c3t | 2 +- test/test_suite/strings/string_to_array.c3t | 4 +- test/test_suite/struct/simple_struct.c3t | 2 +- test/test_suite/struct/struct_as_value.c3t | 4 +- .../struct/struct_const_construct_simple.c3t | 18 +++--- .../struct/struct_pack_and_align.c3t | 12 ++-- test/test_suite/union/union_codegen_const.c3t | 8 +-- test/test_suite/union/union_in_struct.c3t | 12 ++-- test/test_suite/vector/vector_init.c3t | 2 +- .../vector/vector_to_array_cast.c3t | 4 +- 55 files changed, 365 insertions(+), 349 deletions(-) diff --git a/src/compiler/llvm_codegen.c b/src/compiler/llvm_codegen.c index 244711132..f1e63ca5a 100644 --- a/src/compiler/llvm_codegen.c +++ b/src/compiler/llvm_codegen.c @@ -270,6 +270,7 @@ static void gencontext_emit_global_variable_definition(GenContext *c, Decl *decl scratch_buffer_append(decl->external_name); scratch_buffer_append(".f"); decl->var.failable_ref = LLVMAddGlobal(c->module, llvm_get_type(c, type_anyerr), scratch_buffer_to_string()); + LLVMSetUnnamedAddress(decl->var.failable_ref, LLVMGlobalUnnamedAddr); } } @@ -359,19 +360,30 @@ void llvm_emit_global_variable_init(GenContext *c, Decl *decl) // TODO fix name LLVMValueRef old = decl->backend_ref; - decl->backend_ref = LLVMAddGlobal(c->module, LLVMTypeOf(init_value), decl->extname ? decl->extname : decl->external_name); - LLVMSetThreadLocal(decl->backend_ref, decl->var.is_threadlocal); + LLVMValueRef global_ref = decl->backend_ref = LLVMAddGlobal(c->module, LLVMTypeOf(init_value), decl->extname ? decl->extname : decl->external_name); + LLVMSetThreadLocal(global_ref, decl->var.is_threadlocal); + if (decl->var.is_addr) + { + LLVMSetUnnamedAddress(global_ref, LLVMNoUnnamedAddr); + } + else + { + LLVMUnnamedAddr addr = LLVMLocalUnnamedAddr; + if (decl->visibility == VISIBLE_LOCAL || decl->visibility == VISIBLE_MODULE) addr = LLVMGlobalUnnamedAddr; + LLVMSetUnnamedAddress(decl->backend_ref, addr); + } if (decl->section) { - LLVMSetSection(decl->backend_ref, decl->section); + LLVMSetSection(global_ref, decl->section); } - llvm_set_alignment(decl->backend_ref, alignment); + llvm_set_alignment(global_ref, alignment); LLVMValueRef failable_ref = decl->var.failable_ref; if (failable_ref) { llvm_set_alignment(failable_ref, type_alloca_alignment(type_anyerr)); LLVMSetThreadLocal(failable_ref, decl->var.is_threadlocal); + LLVMSetUnnamedAddress(failable_ref, LLVMGlobalUnnamedAddr); } if (init_expr && IS_FAILABLE(init_expr) && init_expr->expr_kind == EXPR_FAILABLE) { @@ -386,34 +398,34 @@ void llvm_emit_global_variable_init(GenContext *c, Decl *decl) } } - LLVMSetGlobalConstant(decl->backend_ref, decl->var.kind == VARDECL_CONST); + LLVMSetGlobalConstant(global_ref, decl->var.kind == VARDECL_CONST); switch (decl->visibility) { case VISIBLE_MODULE: - LLVMSetVisibility(decl->backend_ref, LLVMProtectedVisibility); + LLVMSetVisibility(global_ref, LLVMProtectedVisibility); if (failable_ref) LLVMSetVisibility(failable_ref, LLVMProtectedVisibility); break; case VISIBLE_PUBLIC: - LLVMSetVisibility(decl->backend_ref, LLVMDefaultVisibility); + LLVMSetVisibility(global_ref, LLVMDefaultVisibility); if (failable_ref) LLVMSetVisibility(failable_ref, LLVMDefaultVisibility); break; case VISIBLE_EXTERN: - LLVMSetLinkage(decl->backend_ref, LLVMExternalLinkage); + LLVMSetLinkage(global_ref, LLVMExternalLinkage); if (failable_ref) LLVMSetLinkage(failable_ref, LLVMExternalLinkage); //LLVMSetVisibility(decl->backend_ref, LLVMDefaultVisibility); break; case VISIBLE_LOCAL: - LLVMSetVisibility(decl->backend_ref, LLVMHiddenVisibility); - if (failable_ref) LLVMSetVisibility(failable_ref, LLVMHiddenVisibility); + LLVMSetLinkage(global_ref, LLVMInternalLinkage); + if (failable_ref) LLVMSetLinkage(failable_ref, LLVMInternalLinkage); break; } if (init_value && LLVMTypeOf(init_value) != llvm_get_type(c, var_type)) { - decl->backend_ref = LLVMConstBitCast(decl->backend_ref, llvm_get_ptr_type(c, var_type)); + decl->backend_ref = global_ref = LLVMConstBitCast(global_ref, llvm_get_ptr_type(c, var_type)); } - LLVMReplaceAllUsesWith(old, decl->backend_ref); + LLVMReplaceAllUsesWith(old, global_ref); LLVMDeleteGlobal(old); // Should we set linkage here? diff --git a/src/compiler/llvm_codegen_expr.c b/src/compiler/llvm_codegen_expr.c index 0075cb5a5..b2bea509f 100644 --- a/src/compiler/llvm_codegen_expr.c +++ b/src/compiler/llvm_codegen_expr.c @@ -1444,6 +1444,7 @@ void llvm_emit_initialize_reference_temporary_const(GenContext *c, BEValue *ref, LLVMTypeRef type = LLVMTypeOf(value); LLVMValueRef global_copy = LLVMAddGlobal(c->module, type, ".__const"); llvm_set_private_linkage(global_copy); + LLVMSetUnnamedAddress(global_copy, LLVMGlobalUnnamedAddr); // Set a nice alignment AlignSize alignment = type_alloca_alignment(expr->type); @@ -3834,6 +3835,7 @@ static void llvm_emit_const_expr(GenContext *c, BEValue *be_value, Expr *expr) { LLVMValueRef global_name = LLVMAddGlobal(c->module, LLVMArrayType(llvm_get_type(c, type_char), expr->const_expr.string.len + 1), ".str"); llvm_set_private_linkage(global_name); + LLVMSetUnnamedAddress(global_name, LLVMGlobalUnnamedAddr); LLVMSetGlobalConstant(global_name, 1); LLVMSetInitializer(global_name, LLVMConstStringInContext(c->context, expr->const_expr.string.chars, diff --git a/src/version.h b/src/version.h index bef80b7d9..89634e7d8 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define COMPILER_VERSION "PRE.12" \ No newline at end of file +#define COMPILER_VERSION "PRE.13" \ No newline at end of file diff --git a/test/test_suite/arrays/array_literal.c3t b/test/test_suite/arrays/array_literal.c3t index 6765f03a5..32a1f60b2 100644 --- a/test/test_suite/arrays/array_literal.c3t +++ b/test/test_suite/arrays/array_literal.c3t @@ -14,7 +14,7 @@ fn double test(uint x) // #expect: array_literal.ll -@.__const = private constant [30 x double] [double 0.000000e+00, double 1.270600e+01, double 4.303000e+00, double 3.182000e+00, double 2.776000e+00, double 2.571000e+00, double 2.447000e+00, double 2.365000e+00, double 2.306000e+00, double 2.262000e+00, double 2.228000e+00, double 2.201000e+00, double 2.179000e+00, double 2.160000e+00, double 2.145000e+00, double 2.131000e+00, double 2.120000e+00, double 2.110000e+00, double 2.101000e+00, double 2.093000e+00, double 2.086000e+00, double 2.080000e+00, double 2.074000e+00, double 2.069000e+00, double 2.064000e+00, double 2.060000e+00, double 2.056000e+00, double 2.052000e+00, double 2.048000e+00, double 2.045000e+00], align 16 +@.__const = private unnamed_addr constant [30 x double] [double 0.000000e+00, double 1.270600e+01, double 4.303000e+00, double 3.182000e+00, double 2.776000e+00, double 2.571000e+00, double 2.447000e+00, double 2.365000e+00, double 2.306000e+00, double 2.262000e+00, double 2.228000e+00, double 2.201000e+00, double 2.179000e+00, double 2.160000e+00, double 2.145000e+00, double 2.131000e+00, double 2.120000e+00, double 2.110000e+00, double 2.101000e+00, double 2.093000e+00, double 2.086000e+00, double 2.080000e+00, double 2.074000e+00, double 2.069000e+00, double 2.064000e+00, double 2.060000e+00, double 2.056000e+00, double 2.052000e+00, double 2.048000e+00, double 2.045000e+00], align 16 define double @array_literal.test(i32 %0) #0 { entry: diff --git a/test/test_suite/arrays/array_struct.c3t b/test/test_suite/arrays/array_struct.c3t index 304ec68ea..7fdb8c656 100644 --- a/test/test_suite/arrays/array_struct.c3t +++ b/test/test_suite/arrays/array_struct.c3t @@ -10,4 +10,4 @@ private Foo[10] array; // #expect: test.ll -@test.array = protected global [10 x %Foo] zeroinitializer, align 16 \ No newline at end of file +@test.array = protected unnamed_addr global [10 x %Foo] zeroinitializer, align 16 \ No newline at end of file diff --git a/test/test_suite/arrays/complex_array_const.c3t b/test/test_suite/arrays/complex_array_const.c3t index c5a387497..bac2df76c 100644 --- a/test/test_suite/arrays/complex_array_const.c3t +++ b/test/test_suite/arrays/complex_array_const.c3t @@ -15,7 +15,7 @@ private Connection[3] link // #expect: test.ll -@.str = private constant [6 x i8] c"link1\00", align 1 -@.str.1 = private constant [6 x i8] c"link2\00", align 1 -@.str.2 = private constant [6 x i8] c"link3\00", align 1 -@test.link = protected global [3 x %Connection] [%Connection { i64 1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i64 10 }, %Connection { i64 2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0), i64 20 }, %Connection { i64 3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i64 30 }], align 16 +@.str = private unnamed_addr constant [6 x i8] c"link1\00", align 1 +@.str.1 = private unnamed_addr constant [6 x i8] c"link2\00", align 1 +@.str.2 = private unnamed_addr constant [6 x i8] c"link3\00", align 1 +@test.link = protected unnamed_addr global [3 x %Connection] [%Connection { i64 1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i64 10 }, %Connection { i64 2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0), i64 20 }, %Connection { i64 3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i64 30 }], align 16 diff --git a/test/test_suite/compile_time/compile_time_array_ref.c3t b/test/test_suite/compile_time/compile_time_array_ref.c3t index f61131800..53ce02579 100644 --- a/test/test_suite/compile_time/compile_time_array_ref.c3t +++ b/test/test_suite/compile_time/compile_time_array_ref.c3t @@ -12,10 +12,10 @@ fn void test() /* #expect: foo.ll -@foo.stack = global [8192 x i8] zeroinitializer, align 16 -@foo.x = global i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @foo.stack, i64 0, i64 1000), align 8 -@test.y = hidden global [2 x i8] zeroinitializer, align 1 -@test.z = hidden global i8* getelementptr inbounds ([2 x i8], [2 x i8]* @test.y, i64 0, i64 1), align 8 +@foo.stack = local_unnamed_addr global [8192 x i8] zeroinitializer, align 16 +@foo.x = local_unnamed_addr global i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @foo.stack, i64 0, i64 1000), align 8 +@test.y = internal unnamed_addr global [2 x i8] zeroinitializer, align 1 +@test.z = internal unnamed_addr global i8* getelementptr inbounds ([2 x i8], [2 x i8]* @test.y, i64 0, i64 1), align 8 ; Function Attrs: nounwind define void @foo.test() #0 { entry: diff --git a/test/test_suite/compile_time/compile_time_bitops.c3t b/test/test_suite/compile_time/compile_time_bitops.c3t index eb3cb79be..a12112e15 100644 --- a/test/test_suite/compile_time/compile_time_bitops.c3t +++ b/test/test_suite/compile_time/compile_time_bitops.c3t @@ -10,9 +10,9 @@ int y3 = ~4; /* #expect: foo.ll -@foo.x1 = global i32 6, align 4 -@foo.x2 = global i32 6, align 4 -@foo.x3 = global i32 0, align 4 -@foo.y1 = global i32 16, align 4 -@foo.y2 = global i32 1, align 4 -@foo.y3 = global i32 -5, align 4 \ No newline at end of file +@foo.x1 = local_unnamed_addr global i32 6, align 4 +@foo.x2 = local_unnamed_addr global i32 6, align 4 +@foo.x3 = local_unnamed_addr global i32 0, align 4 +@foo.y1 = local_unnamed_addr global i32 16, align 4 +@foo.y2 = local_unnamed_addr global i32 1, align 4 +@foo.y3 = local_unnamed_addr global i32 -5, align 4 \ No newline at end of file diff --git a/test/test_suite/compile_time/compile_time_ptr_ref.c3t b/test/test_suite/compile_time/compile_time_ptr_ref.c3t index 157a635e4..565c0c488 100644 --- a/test/test_suite/compile_time/compile_time_ptr_ref.c3t +++ b/test/test_suite/compile_time/compile_time_ptr_ref.c3t @@ -14,9 +14,9 @@ int ptr = 0; %"int*[]" = type { i32**, i64 } @.taddr = private global [5 x i32*] [i32* @test.ptr, i32* @test.ptr, i32* getelementptr inbounds (i32, i32* @test.ptr, i64 1), i32* getelementptr (i32, i32* @test.ptr, i64 -1), i32* bitcast (i8* getelementptr (i8, i8* bitcast (i32* @test.ptr to i8*), i64 -4) to i32*)], align 8 -@test.blurp = global %"int*[]" { i32** getelementptr inbounds ([5 x i32*], [5 x i32*]* @.taddr, i32 0, i32 0), i64 5 }, align 8 -@test.c = global i32* bitcast (i8* getelementptr (i8, i8* bitcast (i32* @test.ptr to i8*), i64 -4) to i32*), align 8 -@test.c2 = global i32* bitcast (i8* getelementptr (i8, i8* bitcast (i32* @test.ptr to i8*), i64 4) to i32*), align 8 -@test.c3 = global i32* bitcast (i8* getelementptr (i8, i8* bitcast (i32* @test.ptr to i8*), i64 4) to i32*), align 8 -@test.ff = global i64 ptrtoint (i32* @test.ptr to i64), align 8 +@test.blurp = local_unnamed_addr global %"int*[]" { i32** getelementptr inbounds ([5 x i32*], [5 x i32*]* @.taddr, i32 0, i32 0), i64 5 }, align 8 +@test.c = local_unnamed_addr global i32* bitcast (i8* getelementptr (i8, i8* bitcast (i32* @test.ptr to i8*), i64 -4) to i32*), align 8 +@test.c2 = local_unnamed_addr global i32* bitcast (i8* getelementptr (i8, i8* bitcast (i32* @test.ptr to i8*), i64 4) to i32*), align 8 +@test.c3 = local_unnamed_addr global i32* bitcast (i8* getelementptr (i8, i8* bitcast (i32* @test.ptr to i8*), i64 4) to i32*), align 8 +@test.ff = local_unnamed_addr global i64 ptrtoint (i32* @test.ptr to i64), align 8 @test.ptr = global i32 0, align 4 \ No newline at end of file diff --git a/test/test_suite/compile_time/ct_if.c3t b/test/test_suite/compile_time/ct_if.c3t index 006554164..4432be030 100644 --- a/test/test_suite/compile_time/ct_if.c3t +++ b/test/test_suite/compile_time/ct_if.c3t @@ -58,8 +58,8 @@ $endif; // #expect: ct_if.ll -@ct_if.d = global i32 5, align 4 -@ct_if.c = global i32 5, align 4 -@ct_if.b = global i32 4, align 4 -@ct_if.a = global i32 3, align 4 -@ct_if.x = global i32 1, align 4 \ No newline at end of file +@ct_if.d = local_unnamed_addr global i32 5, align 4 +@ct_if.c = local_unnamed_addr global i32 5, align 4 +@ct_if.b = local_unnamed_addr global i32 4, align 4 +@ct_if.a = local_unnamed_addr global i32 3, align 4 +@ct_if.x = local_unnamed_addr global i32 1, align 4 \ No newline at end of file diff --git a/test/test_suite/compile_time/ct_switch.c3t b/test/test_suite/compile_time/ct_switch.c3t index 0b2f1b096..4c436bd66 100644 --- a/test/test_suite/compile_time/ct_switch.c3t +++ b/test/test_suite/compile_time/ct_switch.c3t @@ -39,16 +39,16 @@ fn void main() /* #expect: test.ll -@.str = private constant [4 x i8] c"%s\0A\00", align 1 -@.str.1 = private constant [6 x i8] c"prime\00", align 1 -@.str.2 = private constant [4 x i8] c"%s\0A\00", align 1 -@.str.3 = private constant [10 x i8] c"not_prime\00", align 1 -@.str.4 = private constant [4 x i8] c"%s\0A\00", align 1 -@.str.5 = private constant [10 x i8] c"not_prime\00", align 1 -@.str.6 = private constant [4 x i8] c"%s\0A\00", align 1 -@.str.7 = private constant [14 x i8] c"donnowifprime\00", align 1 -@.str.8 = private constant [4 x i8] c"%s\0A\00", align 1 -@.str.9 = private constant [14 x i8] c"donnowifprime\00", align 1 +@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 +@.str.1 = private unnamed_addr constant [6 x i8] c"prime\00", align 1 +@.str.2 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 +@.str.3 = private unnamed_addr constant [10 x i8] c"not_prime\00", align 1 +@.str.4 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 +@.str.5 = private unnamed_addr constant [10 x i8] c"not_prime\00", align 1 +@.str.6 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 +@.str.7 = private unnamed_addr constant [14 x i8] c"donnowifprime\00", align 1 +@.str.8 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 +@.str.9 = private unnamed_addr constant [14 x i8] c"donnowifprime\00", align 1 ; Function Attrs: nounwind declare void @printf(i8*, ...) #0 ; Function Attrs: nounwind diff --git a/test/test_suite/compile_time/ct_switch_type_check.c3t b/test/test_suite/compile_time/ct_switch_type_check.c3t index 55bccbe95..f5e5ab49f 100644 --- a/test/test_suite/compile_time/ct_switch_type_check.c3t +++ b/test/test_suite/compile_time/ct_switch_type_check.c3t @@ -26,12 +26,12 @@ fn void main() /* #expect: test.ll -@.str = private constant [4 x i8] c"%s\0A\00", align 1 -@.str.1 = private constant [4 x i8] c"int\00", align 1 -@.str.2 = private constant [4 x i8] c"%s\0A\00", align 1 -@.str.3 = private constant [7 x i8] c"double\00", align 1 -@.str.4 = private constant [4 x i8] c"%s\0A\00", align 1 -@.str.5 = private constant [10 x i8] c"any other\00", align 1 +@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 +@.str.1 = private unnamed_addr constant [4 x i8] c"int\00", align 1 +@.str.2 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 +@.str.3 = private unnamed_addr constant [7 x i8] c"double\00", align 1 +@.str.4 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 +@.str.5 = private unnamed_addr constant [10 x i8] c"any other\00", align 1 ; Function Attrs: nounwind declare void @printf(i8*, ...) #0 ; Function Attrs: nounwind diff --git a/test/test_suite/compile_time/ternary_folding.c3t b/test/test_suite/compile_time/ternary_folding.c3t index 58b361351..aad91b948 100644 --- a/test/test_suite/compile_time/ternary_folding.c3t +++ b/test/test_suite/compile_time/ternary_folding.c3t @@ -13,9 +13,9 @@ fn int test2() { return 3; } // #expect: ternary_folding.ll -@ternary_folding.foo = global i32 1, align 4 -@ternary_folding.bar = global double 2.000000e+00, align 8 -@ternary_folding.baz = global i8 0, align 1 +@ternary_folding.foo = local_unnamed_addr global i32 1, align 4 +@ternary_folding.bar = local_unnamed_addr global double 2.000000e+00, align 8 +@ternary_folding.baz = local_unnamed_addr global i8 0, align 1 define void @ternary_folding.test() #0 { entry: diff --git a/test/test_suite/compile_time_introspection/alignof.c3t b/test/test_suite/compile_time_introspection/alignof.c3t index 259cf2831..f3e73add6 100644 --- a/test/test_suite/compile_time_introspection/alignof.c3t +++ b/test/test_suite/compile_time_introspection/alignof.c3t @@ -65,26 +65,26 @@ int z05 = $alignof("Foob.c[5]"); // #expect: foo.ll -@foo.x = global i64 16, align 8 -@foo.y = global i16 8, align 2 -@foo.z = global i32 8, align 4 -@foo.w = global i32 8, align 4 -@foo.v = global i32 4, align 4 -@foo.x1 = global i32 8, align 4 -@foo.x2 = global i32 8, align 4 -@foo.x3 = global i32 1, align 4 -@foo.x4 = global i32 4, align 4 -@foo.x5 = global i32 4, align 4 -@foo.x6 = global i32 4, align 4 -@foo.x7 = global i32 4, align 4 -@foo.x8 = global i32 8, align 4 -@foo.x9 = global i32 4, align 4 -@foo.x10 = global i32 4, align 4 -@foo.x11 = global i32 4, align 4 -@foo.z0 = global i32 8, align 4 -@foo.z00 = global i32 8, align 4 -@foo.z01 = global i32 1, align 4 -@foo.z02 = global i32 2, align 4 -@foo.z03 = global i32 1, align 4 -@foo.z04 = global i32 4, align 4 -@foo.z05 = global i32 1, align 4 \ No newline at end of file +@foo.x = local_unnamed_addr global i64 16, align 8 +@foo.y = local_unnamed_addr global i16 8, align 2 +@foo.z = local_unnamed_addr global i32 8, align 4 +@foo.w = local_unnamed_addr global i32 8, align 4 +@foo.v = local_unnamed_addr global i32 4, align 4 +@foo.x1 = local_unnamed_addr global i32 8, align 4 +@foo.x2 = local_unnamed_addr global i32 8, align 4 +@foo.x3 = local_unnamed_addr global i32 1, align 4 +@foo.x4 = local_unnamed_addr global i32 4, align 4 +@foo.x5 = local_unnamed_addr global i32 4, align 4 +@foo.x6 = local_unnamed_addr global i32 4, align 4 +@foo.x7 = local_unnamed_addr global i32 4, align 4 +@foo.x8 = local_unnamed_addr global i32 8, align 4 +@foo.x9 = local_unnamed_addr global i32 4, align 4 +@foo.x10 = local_unnamed_addr global i32 4, align 4 +@foo.x11 = local_unnamed_addr global i32 4, align 4 +@foo.z0 = local_unnamed_addr global i32 8, align 4 +@foo.z00 = local_unnamed_addr global i32 8, align 4 +@foo.z01 = local_unnamed_addr global i32 1, align 4 +@foo.z02 = local_unnamed_addr global i32 2, align 4 +@foo.z03 = local_unnamed_addr global i32 1, align 4 +@foo.z04 = local_unnamed_addr global i32 4, align 4 +@foo.z05 = local_unnamed_addr global i32 1, align 4 \ No newline at end of file diff --git a/test/test_suite/compile_time_introspection/nameof.c3t b/test/test_suite/compile_time_introspection/nameof.c3t index f795a2b83..a1b39d10c 100644 --- a/test/test_suite/compile_time_introspection/nameof.c3t +++ b/test/test_suite/compile_time_introspection/nameof.c3t @@ -34,35 +34,35 @@ fn void main() // #expect: mymodule.ll -@.str = private constant [4 x i8] c"%s\0A\00", align 1 -@.str.1 = private constant [14 x i8] c"mymodule::Foo\00", align 1 -@.str.2 = private constant [4 x i8] c"%s\0A\00", align 1 -@.str.3 = private constant [14 x i8] c"mymodule::Foo\00", align 1 -@.str.4 = private constant [4 x i8] c"%s\0A\00", align 1 -@.str.5 = private constant [4 x i8] c"Foo\00", align 1 -@.str.6 = private constant [4 x i8] c"%s\0A\00", align 1 -@.str.7 = private constant [4 x i8] c"Foo\00", align 1 -@.str.8 = private constant [4 x i8] c"%s\0A\00", align 1 -@.str.9 = private constant [13 x i8] c"mymodule.Foo\00", align 1 -@.str.10 = private constant [4 x i8] c"%s\0A\00", align 1 -@.str.11 = private constant [13 x i8] c"mymodule.Foo\00", align 1 -@.str.12 = private constant [4 x i8] c"%s\0A\00", align 1 -@.str.13 = private constant [12 x i8] c"mymodule::b\00", align 1 -@.str.14 = private constant [4 x i8] c"%s\0A\00", align 1 -@.str.15 = private constant [12 x i8] c"mymodule::b\00", align 1 -@.str.16 = private constant [4 x i8] c"%s\0A\00", align 1 -@.str.17 = private constant [2 x i8] c"b\00", align 1 -@.str.18 = private constant [4 x i8] c"%s\0A\00", align 1 -@.str.19 = private constant [2 x i8] c"b\00", align 1 -@.str.20 = private constant [4 x i8] c"%s\0A\00", align 1 -@.str.21 = private constant [11 x i8] c"mymodule.b\00", align 1 -@.str.22 = private constant [4 x i8] c"%s\0A\00", align 1 -@.str.23 = private constant [11 x i8] c"mymodule.b\00", align 1 -@.str.24 = private constant [4 x i8] c"%s\0A\00", align 1 -@.str.25 = private constant [2 x i8] c"a\00", align 1 -@.str.26 = private constant [4 x i8] c"%s\0A\00", align 1 -@.str.27 = private constant [2 x i8] c"a\00", align 1 -@.str.28 = private constant [4 x i8] c"%s\0A\00", align 1 -@.str.29 = private constant [2 x i8] c"a\00", align 1 -@.str.30 = private constant [4 x i8] c"%s\0A\00", align 1 -@.str.31 = private constant [2 x i8] c"a\00", align 1 \ No newline at end of file +@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 +@.str.1 = private unnamed_addr constant [14 x i8] c"mymodule::Foo\00", align 1 +@.str.2 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 +@.str.3 = private unnamed_addr constant [14 x i8] c"mymodule::Foo\00", align 1 +@.str.4 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 +@.str.5 = private unnamed_addr constant [4 x i8] c"Foo\00", align 1 +@.str.6 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 +@.str.7 = private unnamed_addr constant [4 x i8] c"Foo\00", align 1 +@.str.8 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 +@.str.9 = private unnamed_addr constant [13 x i8] c"mymodule.Foo\00", align 1 +@.str.10 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 +@.str.11 = private unnamed_addr constant [13 x i8] c"mymodule.Foo\00", align 1 +@.str.12 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 +@.str.13 = private unnamed_addr constant [12 x i8] c"mymodule::b\00", align 1 +@.str.14 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 +@.str.15 = private unnamed_addr constant [12 x i8] c"mymodule::b\00", align 1 +@.str.16 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 +@.str.17 = private unnamed_addr constant [2 x i8] c"b\00", align 1 +@.str.18 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 +@.str.19 = private unnamed_addr constant [2 x i8] c"b\00", align 1 +@.str.20 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 +@.str.21 = private unnamed_addr constant [11 x i8] c"mymodule.b\00", align 1 +@.str.22 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 +@.str.23 = private unnamed_addr constant [11 x i8] c"mymodule.b\00", align 1 +@.str.24 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 +@.str.25 = private unnamed_addr constant [2 x i8] c"a\00", align 1 +@.str.26 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 +@.str.27 = private unnamed_addr constant [2 x i8] c"a\00", align 1 +@.str.28 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 +@.str.29 = private unnamed_addr constant [2 x i8] c"a\00", align 1 +@.str.30 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 +@.str.31 = private unnamed_addr constant [2 x i8] c"a\00", align 1 \ No newline at end of file diff --git a/test/test_suite/compile_time_introspection/offsetof.c3t b/test/test_suite/compile_time_introspection/offsetof.c3t index 5ad956f71..aff15a0a9 100644 --- a/test/test_suite/compile_time_introspection/offsetof.c3t +++ b/test/test_suite/compile_time_introspection/offsetof.c3t @@ -53,18 +53,18 @@ int z02 = $offsetof("Foob.c[5]"); int z03 = $offsetof("Foob.a"); // #expect: foo.ll -@foo.y = global i16 16, align 2 -@foo.z = global i32 16, align 4 -@foo.w = global i32 16, align 4 -@foo.x1 = global i32 3, align 4 -@foo.x2 = global i32 4, align 4 -@foo.x4 = global i32 16, align 4 -@foo.x6 = global i32 20, align 4 -@foo.x5 = global i32 16, align 4 -@foo.x7 = global i32 28, align 4 -@foo.x8 = global i32 24, align 4 -@foo.z0 = global i32 0, align 4 -@foo.z00 = global i32 0, align 4 -@foo.z01 = global i32 1, align 4 -@foo.z02 = global i32 5, align 4 -@foo.z03 = global i32 0, align 4 +@foo.y = local_unnamed_addr global i16 16, align 2 +@foo.z = local_unnamed_addr global i32 16, align 4 +@foo.w = local_unnamed_addr global i32 16, align 4 +@foo.x1 = local_unnamed_addr global i32 3, align 4 +@foo.x2 = local_unnamed_addr global i32 4, align 4 +@foo.x4 = local_unnamed_addr global i32 16, align 4 +@foo.x6 = local_unnamed_addr global i32 20, align 4 +@foo.x5 = local_unnamed_addr global i32 16, align 4 +@foo.x7 = local_unnamed_addr global i32 28, align 4 +@foo.x8 = local_unnamed_addr global i32 24, align 4 +@foo.z0 = local_unnamed_addr global i32 0, align 4 +@foo.z00 = local_unnamed_addr global i32 0, align 4 +@foo.z01 = local_unnamed_addr global i32 1, align 4 +@foo.z02 = local_unnamed_addr global i32 5, align 4 +@foo.z03 = local_unnamed_addr global i32 0, align 4 diff --git a/test/test_suite/compile_time_introspection/qnameof.c3t b/test/test_suite/compile_time_introspection/qnameof.c3t index c669e6496..7cb9fff86 100644 --- a/test/test_suite/compile_time_introspection/qnameof.c3t +++ b/test/test_suite/compile_time_introspection/qnameof.c3t @@ -21,24 +21,24 @@ fn void main() // #expect: qnametest.ll -@.str = private constant [12 x i8] c"printf: %s\0A\00", align 1 -@.str.1 = private constant [7 x i8] c"printf\00", align 1 -@.str.2 = private constant [13 x i8] c"printfq: %s\0A\00", align 1 -@.str.3 = private constant [18 x i8] c"qnametest::printf\00", align 1 -@.str.4 = private constant [11 x i8] c"Blobq: %s\0A\00", align 1 -@.str.5 = private constant [16 x i8] c"qnametest::Blob\00", align 1 -@.str.6 = private constant [10 x i8] c"Blob: %s\0A\00", align 1 -@.str.7 = private constant [5 x i8] c"Blob\00", align 1 -@.str.8 = private constant [8 x i8] c"xq: %s\0A\00", align 1 -@.str.9 = private constant [13 x i8] c"qnametest::x\00", align 1 -@.str.10 = private constant [7 x i8] c"x: %s\0A\00", align 1 -@.str.11 = private constant [2 x i8] c"x\00", align 1 -@.str.12 = private constant [11 x i8] c"helpq: %s\0A\00", align 1 -@.str.13 = private constant [5 x i8] c"help\00", align 1 -@.str.14 = private constant [11 x i8] c"mainq: %s\0A\00", align 1 -@.str.15 = private constant [16 x i8] c"qnametest::main\00", align 1 -@.str.16 = private constant [15 x i8] c"Blob**[3]: %s\0A\00", align 1 -@.str.17 = private constant [10 x i8] c"Blob**[3]\00", align 1 +@.str = private unnamed_addr constant [12 x i8] c"printf: %s\0A\00", align 1 +@.str.1 = private unnamed_addr constant [7 x i8] c"printf\00", align 1 +@.str.2 = private unnamed_addr constant [13 x i8] c"printfq: %s\0A\00", align 1 +@.str.3 = private unnamed_addr constant [18 x i8] c"qnametest::printf\00", align 1 +@.str.4 = private unnamed_addr constant [11 x i8] c"Blobq: %s\0A\00", align 1 +@.str.5 = private unnamed_addr constant [16 x i8] c"qnametest::Blob\00", align 1 +@.str.6 = private unnamed_addr constant [10 x i8] c"Blob: %s\0A\00", align 1 +@.str.7 = private unnamed_addr constant [5 x i8] c"Blob\00", align 1 +@.str.8 = private unnamed_addr constant [8 x i8] c"xq: %s\0A\00", align 1 +@.str.9 = private unnamed_addr constant [13 x i8] c"qnametest::x\00", align 1 +@.str.10 = private unnamed_addr constant [7 x i8] c"x: %s\0A\00", align 1 +@.str.11 = private unnamed_addr constant [2 x i8] c"x\00", align 1 +@.str.12 = private unnamed_addr constant [11 x i8] c"helpq: %s\0A\00", align 1 +@.str.13 = private unnamed_addr constant [5 x i8] c"help\00", align 1 +@.str.14 = private unnamed_addr constant [11 x i8] c"mainq: %s\0A\00", align 1 +@.str.15 = private unnamed_addr constant [16 x i8] c"qnametest::main\00", align 1 +@.str.16 = private unnamed_addr constant [15 x i8] c"Blob**[3]: %s\0A\00", align 1 +@.str.17 = private unnamed_addr constant [10 x i8] c"Blob**[3]\00", align 1 define void @qnametest.main() %help = alloca i32, align 4 diff --git a/test/test_suite/compile_time_introspection/sizeof.c3t b/test/test_suite/compile_time_introspection/sizeof.c3t index a0e8fe74d..ea33fa5f5 100644 --- a/test/test_suite/compile_time_introspection/sizeof.c3t +++ b/test/test_suite/compile_time_introspection/sizeof.c3t @@ -48,19 +48,19 @@ struct Foo // #expect: foo.ll -@foo.x = global i64 64, align 8 -@foo.y = global i16 64, align 2 -@foo.z = global i32 64, align 4 -@foo.w = global i32 64, align 4 -@foo.v = global i32 1, align 4 -@foo.x1 = global i32 8, align 4 -@foo.y1 = global i32 2, align 4 -@foo.a = global i32 60, align 4 -@foo.b = global i32 5, align 4 -@foo.c = global i32 5, align 4 -@foo.d = global i32 1600, align 4 -@foo.e = global i32 8, align 4 -@foo.a2 = global i32 60, align 4 -@foo.a3 = global i32 60, align 4 -@foo.a4 = global i32 60, align 4 -@foo.a5 = global i32 60, align 4 \ No newline at end of file +@foo.x = local_unnamed_addr global i64 64, align 8 +@foo.y = local_unnamed_addr global i16 64, align 2 +@foo.z = local_unnamed_addr global i32 64, align 4 +@foo.w = local_unnamed_addr global i32 64, align 4 +@foo.v = local_unnamed_addr global i32 1, align 4 +@foo.x1 = local_unnamed_addr global i32 8, align 4 +@foo.y1 = local_unnamed_addr global i32 2, align 4 +@foo.a = local_unnamed_addr global i32 60, align 4 +@foo.b = local_unnamed_addr global i32 5, align 4 +@foo.c = local_unnamed_addr global i32 5, align 4 +@foo.d = local_unnamed_addr global i32 1600, align 4 +@foo.e = local_unnamed_addr global i32 8, align 4 +@foo.a2 = local_unnamed_addr global i32 60, align 4 +@foo.a3 = local_unnamed_addr global i32 60, align 4 +@foo.a4 = local_unnamed_addr global i32 60, align 4 +@foo.a5 = local_unnamed_addr global i32 60, align 4 \ No newline at end of file diff --git a/test/test_suite/constants/byte_literals.c3t b/test/test_suite/constants/byte_literals.c3t index 9909bc1f5..1a68db76d 100644 --- a/test/test_suite/constants/byte_literals.c3t +++ b/test/test_suite/constants/byte_literals.c3t @@ -6,8 +6,8 @@ char[*] foo64 = b64"SGVsbG8gV29ybGQ="; // #expect: byte_literals.ll -@byte_literals.foob = global [1 x i8] c"\A0", align 1 -@byte_literals.fooz = global [7 x i8] c"\00\AA\BB\CC\DD\EE\FF", align 1 -@byte_literals.fooy = global [4 x i8] c"\DE\AD\BE\EF", align 1 -@byte_literals.foow = global [5 x i8] c"EI#M\ED", align 1 -@byte_literals.foo64 = global [11 x i8] c"Hello World", align 1 +@byte_literals.foob = local_unnamed_addr global [1 x i8] c"\A0", align 1 +@byte_literals.fooz = local_unnamed_addr global [7 x i8] c"\00\AA\BB\CC\DD\EE\FF", align 1 +@byte_literals.fooy = local_unnamed_addr global [4 x i8] c"\DE\AD\BE\EF", align 1 +@byte_literals.foow = local_unnamed_addr global [5 x i8] c"EI#M\ED", align 1 +@byte_literals.foo64 = local_unnamed_addr global [11 x i8] c"Hello World", align 1 diff --git a/test/test_suite/constants/char_literals.c3t b/test/test_suite/constants/char_literals.c3t index 2a3aa06d0..c4bbb0d6b 100644 --- a/test/test_suite/constants/char_literals.c3t +++ b/test/test_suite/constants/char_literals.c3t @@ -13,12 +13,12 @@ char i = '\e'; // #expect: test.ll -@test.a = global i8 32, align 1 -@test.b = global i8 13, align 1 -@test.c = global i8 9, align 1 -@test.d = global i8 10, align 1 -@test.e = global i8 0, align 1 -@test.f = global i8 39, align 1 -@test.g = global i8 34, align 1 -@test.h = global i8 92, align 1 -@test.i = global i8 27, align 1 +@test.a = local_unnamed_addr global i8 32, align 1 +@test.b = local_unnamed_addr global i8 13, align 1 +@test.c = local_unnamed_addr global i8 9, align 1 +@test.d = local_unnamed_addr global i8 10, align 1 +@test.e = local_unnamed_addr global i8 0, align 1 +@test.f = local_unnamed_addr global i8 39, align 1 +@test.g = local_unnamed_addr global i8 34, align 1 +@test.h = local_unnamed_addr global i8 92, align 1 +@test.i = local_unnamed_addr global i8 27, align 1 diff --git a/test/test_suite/constants/constants.c3t b/test/test_suite/constants/constants.c3t index 821669e4a..0b5c28082 100644 --- a/test/test_suite/constants/constants.c3t +++ b/test/test_suite/constants/constants.c3t @@ -19,15 +19,15 @@ fn void test() // #expect: constants.ll -@constants.AA = protected constant i8 -1, align 1 -@constants.BB = constant i8 -56, align 1 -@constants.CC = protected constant i32 -1, align 4 -@constants.DD = protected constant i32 -1, align 4 -@constants.x = protected global i32 255, align 4 -@constants.z = protected global i32 -1, align 4 -@constants.w = protected global i8 -1, align 1 -@constants.v = protected global i16 -1, align 2 -@constants.z2 = protected global i32 -1, align 4 +@constants.AA = protected unnamed_addr constant i8 -1, align 1 +@constants.BB = local_unnamed_addr constant i8 -56, align 1 +@constants.CC = protected unnamed_addr constant i32 -1, align 4 +@constants.DD = protected unnamed_addr constant i32 -1, align 4 +@constants.x = protected unnamed_addr global i32 255, align 4 +@constants.z = protected unnamed_addr global i32 -1, align 4 +@constants.w = protected unnamed_addr global i8 -1, align 1 +@constants.v = protected unnamed_addr global i16 -1, align 2 +@constants.z2 = protected unnamed_addr global i32 -1, align 4 entry: %xx = alloca i32 diff --git a/test/test_suite/debug_symbols/constants.c3t b/test/test_suite/debug_symbols/constants.c3t index 1195ee63b..e3a1a1bc4 100644 --- a/test/test_suite/debug_symbols/constants.c3t +++ b/test/test_suite/debug_symbols/constants.c3t @@ -7,11 +7,13 @@ private const FOO = ~(uint)(0); /* #expect: constants.ll -@constants.AA = protected constant i8 1, align 1 -@constants.BB = constant i8 -56, align 1 -@constants.CC = protected constant i32 -1, align 4 -@constants.FOO = protected constant i32 -1, align 4 +@constants.AA = protected unnamed_addr constant i8 1, align 1 +@constants.BB = local_unnamed_addr constant i8 -56, align 1 +@constants.CC = protected unnamed_addr constant i32 -1, align 4 +@constants.FOO = protected unnamed_addr constant i32 -1, align 4 + !llvm.dbg.cu = !{!0} + !0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "c3c", isOptimized: false, runtimeVersion: 1, emissionKind: FullDebug, enums: !2, globals: !3, splitDebugInlining: false) !1 = !DIFile(filename: "constants.c3", !2 = !{} diff --git a/test/test_suite/enumerations/compile_time.c3t b/test/test_suite/enumerations/compile_time.c3t index d51584493..195dac759 100644 --- a/test/test_suite/enumerations/compile_time.c3t +++ b/test/test_suite/enumerations/compile_time.c3t @@ -13,8 +13,8 @@ int myenum_sizeof = $sizeof(MyEnum); // #expect: compile_time.ll -@compile_time.myenum_max = global i32 14, align 4 -@compile_time.myenum_min = global i32 -5, align 4 -@compile_time.myenum_elements = global i32 3, align 4 -@compile_time.myenum_alignof = global i32 2, align 4 -@compile_time.myenum_sizeof = global i32 2, align 4 \ No newline at end of file +@compile_time.myenum_max = local_unnamed_addr global i32 14, align 4 +@compile_time.myenum_min = local_unnamed_addr global i32 -5, align 4 +@compile_time.myenum_elements = local_unnamed_addr global i32 3, align 4 +@compile_time.myenum_alignof = local_unnamed_addr global i32 2, align 4 +@compile_time.myenum_sizeof = local_unnamed_addr global i32 2, align 4 \ No newline at end of file diff --git a/test/test_suite/errors/failable_taddr_and_access.c3t b/test/test_suite/errors/failable_taddr_and_access.c3t index 486cb67f5..e7275c8a7 100644 --- a/test/test_suite/errors/failable_taddr_and_access.c3t +++ b/test/test_suite/errors/failable_taddr_and_access.c3t @@ -30,8 +30,8 @@ fn void main() @Foo = linkonce_odr constant i8 1 @"test.MyErr$elements" = linkonce_odr constant [1 x i8*] zeroinitializer @MyErr = linkonce_odr constant i8 1 -@.str = private constant [4 x i8] c"%d\0A\00", align 1 -@.str.1 = private constant [17 x i8] c"Not visible: %d\0A\00", align 1 +@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 +@.str.1 = private unnamed_addr constant [17 x i8] c"Not visible: %d\0A\00", align 1 ; Function Attrs: nounwind declare i32 @printf(i8*, ...) #0 diff --git a/test/test_suite/expressions/parsed_numbers.c3t b/test/test_suite/expressions/parsed_numbers.c3t index 727d824eb..ce2809a64 100644 --- a/test/test_suite/expressions/parsed_numbers.c3t +++ b/test/test_suite/expressions/parsed_numbers.c3t @@ -7,7 +7,7 @@ double d = 12.3e+12; // #expect: numbers.ll -@numbers.a = global double 2.125000e+00, align 8 -@numbers.b = global double -1.230000e-11, align 8 -@numbers.c = global double 5.312500e-01, align 8 -@numbers.d = global double 1.230000e+13, align 8 \ No newline at end of file +@numbers.a = local_unnamed_addr global double 2.125000e+00, align 8 +@numbers.b = local_unnamed_addr global double -1.230000e-11, align 8 +@numbers.c = local_unnamed_addr global double 5.312500e-01, align 8 +@numbers.d = local_unnamed_addr global double 1.230000e+13, align 8 \ No newline at end of file diff --git a/test/test_suite/expressions/strings.c3t b/test/test_suite/expressions/strings.c3t index 11e1135c2..e73306b83 100644 --- a/test/test_suite/expressions/strings.c3t +++ b/test/test_suite/expressions/strings.c3t @@ -7,4 +7,4 @@ fn char* foo() // #expect: test.ll -@.str = private constant [32 x i8] c"*** Word \22%s\22 on line %d is not\00" \ No newline at end of file +@.str = private unnamed_addr constant [32 x i8] c"*** Word \22%s\22 on line %d is not\00" \ No newline at end of file diff --git a/test/test_suite/functions/static_vars.c3t b/test/test_suite/functions/static_vars.c3t index a9d2a35f6..33819fa34 100644 --- a/test/test_suite/functions/static_vars.c3t +++ b/test/test_suite/functions/static_vars.c3t @@ -10,8 +10,8 @@ fn int test() // #expect: foo.ll -@test.x = hidden global i32 1, align 4 -@test.y = hidden thread_local global i32 2, align 4 +@test.x = internal unnamed_addr global i32 1, align 4 +@test.y = internal thread_local unnamed_addr global i32 2, align 4 define i32 @foo.test() diff --git a/test/test_suite/functions/test_regression.c3t b/test/test_suite/functions/test_regression.c3t index adb91f339..265e1b4a1 100644 --- a/test/test_suite/functions/test_regression.c3t +++ b/test/test_suite/functions/test_regression.c3t @@ -660,7 +660,7 @@ entry: // #expect: test2.int.ll %Blob = type { i32 } -@test2.int.argh = global i32 234, align 4 +@test2.int.argh = local_unnamed_addr global i32 234, align 4 define i32 @test2.int.getMult(i32 %0) #0 { entry: @@ -686,7 +686,7 @@ entry: // #expect: test2.double.ll %Blob = type { double } -@test2.double.argh = global double 2.340000e+02, align 8 +@test2.double.argh = local_unnamed_addr global double 2.340000e+02, align 8 define double @test2.double.getMult(double %0) entry: diff --git a/test/test_suite/functions/test_regression_mingw.c3t b/test/test_suite/functions/test_regression_mingw.c3t index 40c3ed875..7b7ae7959 100644 --- a/test/test_suite/functions/test_regression_mingw.c3t +++ b/test/test_suite/functions/test_regression_mingw.c3t @@ -254,31 +254,31 @@ fn Type getValue(Blob blob) @Foor = linkonce_odr constant i8 1 @Foo2 = linkonce_odr constant i8 1 @Foo = linkonce_odr constant i8 1 -@.str = private constant [13 x i8] c"helloWorld!\0A\00", align 1 -@test_static.x = hidden global i32 1, align 4 -@.str.1 = private constant [16 x i8] c"Test static %d\0A\00", align 1 -@.__const = private constant [3 x i32] [i32 1, i32 2, i32 3], align 4 -@.str.2 = private constant [17 x i8] c"Element[%d]: %d\0A\00", align 1 -@.str.3 = private constant [28 x i8] c"Min %d Max %d Elements: %d\0A\00", align 1 -@.str.4 = private constant [7 x i8] c"Hello\0A\00", align 1 -@.str.5 = private constant [17 x i8] c"Element[%d]: %d\0A\00", align 1 -@.__const.6 = private constant %Blob { i32 42 }, align 4 -@.__const.7 = private constant %Blob.0 { double 3.330000e+01 }, align 8 -@.str.8 = private constant [10 x i8] c"a was %d\0A\00", align 1 -@.str.9 = private constant [10 x i8] c"b was %f\0A\00", align 1 -@.str.10 = private constant [17 x i8] c"Mult int was %d\0A\00", align 1 -@.str.11 = private constant [20 x i8] c"Mult double was %f\0A\00", align 1 -@.__const.12 = private constant [4 x i32] [i32 1, i32 2, i32 3, i32 3], align 16 -@.str.13 = private constant [22 x i8] c"1Vararg4unsplatA: %d\0A\00", align 1 -@.str.14 = private constant [4 x i8] c"%d\0A\00", align 1 -@.__const.15 = private constant [3 x i32] [i32 1, i32 2, i32 3], align 4 -@.str.16 = private constant [21 x i8] c"Vararg4unsplatB: %d\0A\00", align 1 -@.str.17 = private constant [21 x i8] c"Vararg4unsplatC: %d\0A\00", align 1 -@.str.18 = private constant [13 x i8] c"Vararg4: %d\0A\00", align 1 -@.str.19 = private constant [13 x i8] c"Vararg1: %d\0A\00", align 1 -@.str.20 = private constant [13 x i8] c"Vararg0: %d\0A\00", align 1 -@.str.21 = private constant [12 x i8] c"Foo is: %d\0A\00", align 1 -@.str.22 = private constant [9 x i8] c"Mutating\00", align 1 +@.str = private unnamed_addr constant [13 x i8] c"helloWorld!\0A\00", align 1 +@test_static.x = internal unnamed_addr global i32 1, align 4 +@.str.1 = private unnamed_addr constant [16 x i8] c"Test static %d\0A\00", align 1 +@.__const = private unnamed_addr constant [3 x i32] [i32 1, i32 2, i32 3], align 4 +@.str.2 = private unnamed_addr constant [17 x i8] c"Element[%d]: %d\0A\00", align 1 +@.str.3 = private unnamed_addr constant [28 x i8] c"Min %d Max %d Elements: %d\0A\00", align 1 +@.str.4 = private unnamed_addr constant [7 x i8] c"Hello\0A\00", align 1 +@.str.5 = private unnamed_addr constant [17 x i8] c"Element[%d]: %d\0A\00", align 1 +@.__const.6 = private unnamed_addr constant %Blob { i32 42 }, align 4 +@.__const.7 = private unnamed_addr constant %Blob.0 { double 3.330000e+01 }, align 8 +@.str.8 = private unnamed_addr constant [10 x i8] c"a was %d\0A\00", align 1 +@.str.9 = private unnamed_addr constant [10 x i8] c"b was %f\0A\00", align 1 +@.str.10 = private unnamed_addr constant [17 x i8] c"Mult int was %d\0A\00", align 1 +@.str.11 = private unnamed_addr constant [20 x i8] c"Mult double was %f\0A\00", align 1 +@.__const.12 = private unnamed_addr constant [4 x i32] [i32 1, i32 2, i32 3, i32 3], align 16 +@.str.13 = private unnamed_addr constant [22 x i8] c"1Vararg4unsplatA: %d\0A\00", align 1 +@.str.14 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 +@.__const.15 = private unnamed_addr constant [3 x i32] [i32 1, i32 2, i32 3], align 4 +@.str.16 = private unnamed_addr constant [21 x i8] c"Vararg4unsplatB: %d\0A\00", align 1 +@.str.17 = private unnamed_addr constant [21 x i8] c"Vararg4unsplatC: %d\0A\00", align 1 +@.str.18 = private unnamed_addr constant [13 x i8] c"Vararg4: %d\0A\00", align 1 +@.str.19 = private unnamed_addr constant [13 x i8] c"Vararg1: %d\0A\00", align 1 +@.str.20 = private unnamed_addr constant [13 x i8] c"Vararg0: %d\0A\00", align 1 +@.str.21 = private unnamed_addr constant [12 x i8] c"Foo is: %d\0A\00", align 1 +@.str.22 = private unnamed_addr constant [9 x i8] c"Mutating\00", align 1 declare i32 @test2.int.getValue(i32) @@ -710,7 +710,7 @@ entry: // #expect: test2.int.ll %Blob = type { i32 } -@test2.int.argh = global i32 234, align 4 +@test2.int.argh = local_unnamed_addr global i32 234, align 4 define i32 @test2.int.getMult(i32 %0) entry: @@ -735,7 +735,7 @@ entry: // #expect: test2.double.ll %Blob = type { double } -@test2.double.argh = global double 2.340000e+02, align 8 +@test2.double.argh = local_unnamed_addr global double 2.340000e+02, align 8 define double @test2.double.getMult(double %0) entry: diff --git a/test/test_suite/globals/global_extname.c3t b/test/test_suite/globals/global_extname.c3t index 26f486e22..6de9b442d 100644 --- a/test/test_suite/globals/global_extname.c3t +++ b/test/test_suite/globals/global_extname.c3t @@ -4,4 +4,4 @@ int baz @extname("foobar") = 123; // #expect: foo.ll -@foobar = global i32 123, align 4 \ No newline at end of file +@foobar = local_unnamed_addr global i32 123, align 4 \ No newline at end of file diff --git a/test/test_suite/initializer_lists/fasta.c3t b/test/test_suite/initializer_lists/fasta.c3t index 0e4111f58..19bed0fb0 100644 --- a/test/test_suite/initializer_lists/fasta.c3t +++ b/test/test_suite/initializer_lists/fasta.c3t @@ -110,25 +110,25 @@ fn void main(int argc, char **argv) %"char[]" = type { i8*, i64 } %"double[]" = type { double*, i64 } -@fasta.IM = constant i32 139968, align 4 -@fasta.IA = constant i32 3877, align 4 -@fasta.IC = constant i32 29573, align 4 -@fasta.SEED = constant i32 42, align 4 -@fasta.seed = global i32 42, align 4 -@.str = private constant [288 x i8] c"GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA\00", align 1 -@fasta.alu = protected global %"char[]" { i8* getelementptr inbounds ([288 x i8], [288 x i8]* @.str, i32 0, i32 0), i64 287 }, align 8 -@.str.11 = private constant [16 x i8] c"acgtBDHKMNRSVWY\00", align 1 -@fasta.iub = global %"char[]" { i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i32 0, i32 0), i64 15 }, align 8 +@fasta.IM = local_unnamed_addr constant i32 139968, align 4 +@fasta.IA = local_unnamed_addr constant i32 3877, align 4 +@fasta.IC = local_unnamed_addr constant i32 29573, align 4 +@fasta.SEED = local_unnamed_addr constant i32 42, align 4 +@fasta.seed = local_unnamed_addr global i32 42, align 4 +@.str = private unnamed_addr constant [288 x i8] c"GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA\00", align 1 +@fasta.alu = protected unnamed_addr global %"char[]" { i8* getelementptr inbounds ([288 x i8], [288 x i8]* @.str, i32 0, i32 0), i64 287 }, align 8 +@.str.11 = private unnamed_addr constant [16 x i8] c"acgtBDHKMNRSVWY\00", align 1 +@fasta.iub = local_unnamed_addr global %"char[]" { i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i32 0, i32 0), i64 15 }, align 8 @.taddr = private global [15 x double] [double 2.700000e-01, double 1.200000e-01, double 1.200000e-01, double 2.700000e-01, double 2.000000e-02, double 2.000000e-02, double 2.000000e-02, double 2.000000e-02, double 2.000000e-02, double 2.000000e-02, double 2.000000e-02, double 2.000000e-02, double 2.000000e-02, double 2.000000e-02, double 2.000000e-02], align 8 -@fasta.iub_p = global %"double[]" { double* getelementptr inbounds ([15 x double], [15 x double]* @.taddr, i32 0, i32 0), i64 15 }, align 8 -@.str.12 = private constant [5 x i8] c"acgt\00", align 1 -@fasta.homosapiens = global %"char[]" { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i32 0, i32 0), i64 4 }, align 8 +@fasta.iub_p = local_unnamed_addr global %"double[]" { double* getelementptr inbounds ([15 x double], [15 x double]* @.taddr, i32 0, i32 0), i64 15 }, align 8 +@.str.12 = private unnamed_addr constant [5 x i8] c"acgt\00", align 1 +@fasta.homosapiens = local_unnamed_addr global %"char[]" { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i32 0, i32 0), i64 4 }, align 8 @.taddr.13 = private global [4 x double] [double 0x3FD3639D20BAEB5B, double 0x3FC957AE3DCD561B, double 0x3FC9493AEAB6C2BF, double 0x3FD34BEE4B030838], align 8 -@fasta.homosapiens_p = global %"double[]" { double* getelementptr inbounds ([4 x double], [4 x double]* @.taddr.13, i32 0, i32 0), i64 4 }, align 8 -@fasta.LINELEN = constant i32 60, align 4 -@.str.14 = private constant [23 x i8] c">ONE Homo sapiens alu\0A\00", align 1 -@.str.15 = private constant [26 x i8] c">TWO IUB ambiguity codes\0A\00", align 1 -@.str.16 = private constant [31 x i8] c">THREE Homo sapiens frequency\0A\00", align 1 +@fasta.homosapiens_p = local_unnamed_addr global %"double[]" { double* getelementptr inbounds ([4 x double], [4 x double]* @.taddr.13, i32 0, i32 0), i64 4 }, align 8 +@fasta.LINELEN = local_unnamed_addr constant i32 60, align 4 +@.str.14 = private unnamed_addr constant [23 x i8] c">ONE Homo sapiens alu\0A\00", align 1 +@.str.15 = private unnamed_addr constant [26 x i8] c">TWO IUB ambiguity codes\0A\00", align 1 +@.str.16 = private unnamed_addr constant [31 x i8] c">THREE Homo sapiens frequency\0A\00", align 1 ; Function Attrs: nounwind define float @fasta.fasta_rand(float %0) #0 { diff --git a/test/test_suite/initializer_lists/general_tests.c3t b/test/test_suite/initializer_lists/general_tests.c3t index 82b326767..96ddcb4d0 100644 --- a/test/test_suite/initializer_lists/general_tests.c3t +++ b/test/test_suite/initializer_lists/general_tests.c3t @@ -40,9 +40,9 @@ fn int test() @Baz = linkonce_odr constant i8 1 @Bar = linkonce_odr constant i8 1 -@.__const = private constant { i32, [4 x i8] } { i32 1, [4 x i8] undef }, align 8 -@test.foo1 = hidden global i32 22, align 4 -@.str = private constant [7 x i8] c"Hello!\00", align 1 +@.__const = private unnamed_addr constant { i32, [4 x i8] } { i32 1, [4 x i8] undef }, align 8 +@test.foo1 = internal unnamed_addr global i32 22, align 4 +@.str = private unnamed_addr constant [7 x i8] c"Hello!\00", align 1 ; Function Attrs: nounwind define i32 @general_tests.test() #0 { diff --git a/test/test_suite/initializer_lists/statics.c3t b/test/test_suite/initializer_lists/statics.c3t index 56194f864..d4faaf207 100644 --- a/test/test_suite/initializer_lists/statics.c3t +++ b/test/test_suite/initializer_lists/statics.c3t @@ -38,8 +38,8 @@ fn int main() @Baz = linkonce_odr constant i8 1 @Bar = linkonce_odr constant i8 1 @.taddr = private global [1 x %Bar] [%Bar { i32 1, i32 2 }], align 4 -@test.c = hidden global %"Bar[]" { %Bar* getelementptr inbounds ([1 x %Bar], [1 x %Bar]* @.taddr, i32 0, i32 0), i64 1 }, align 8 -@.str = private constant [7 x i8] c"%d %d\0A\00", align 1 +@test.c = internal unnamed_addr global %"Bar[]" { %Bar* getelementptr inbounds ([1 x %Bar], [1 x %Bar]* @.taddr, i32 0, i32 0), i64 1 }, align 8 +@.str = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 declare i32 @printf(i8*, ...) diff --git a/test/test_suite/initializer_lists/subarrays.c3t b/test/test_suite/initializer_lists/subarrays.c3t index 86ae65889..59c107740 100644 --- a/test/test_suite/initializer_lists/subarrays.c3t +++ b/test/test_suite/initializer_lists/subarrays.c3t @@ -53,18 +53,18 @@ fn int main() @Baz = linkonce_odr constant i8 1 @Bar = linkonce_odr constant i8 1 @.taddr = private global [2 x %Bar] [%Bar { i32 3, i32 4 }, %Bar { i32 8, i32 9 }], align 4 -@subarrays.arrbar = global %"Bar[]" { %Bar* getelementptr inbounds ([2 x %Bar], [2 x %Bar]* @.taddr, i32 0, i32 0), i64 2 }, align 8 +@subarrays.arrbar = local_unnamed_addr global %"Bar[]" { %Bar* getelementptr inbounds ([2 x %Bar], [2 x %Bar]* @.taddr, i32 0, i32 0), i64 2 }, align 8 @.taddr.3 = private global [2 x i32] [i32 1, i32 2], align 4 -@subarrays.xd = global %"int[]" { i32* getelementptr inbounds ([2 x i32], [2 x i32]* @.taddr.3, i32 0, i32 0), i64 2 }, align 8 +@subarrays.xd = local_unnamed_addr global %"int[]" { i32* getelementptr inbounds ([2 x i32], [2 x i32]* @.taddr.3, i32 0, i32 0), i64 2 }, align 8 @.taddr.4 = private global [2 x i32] [i32 3, i32 4], align 4 -@subarrays.fofeo = global i32* getelementptr inbounds ([2 x i32], [2 x i32]* @.taddr.4, i32 0, i32 0), align 8 -@.str = private constant [4 x i8] c"%d\0A\00", align 1 -@.str.5 = private constant [7 x i8] c"Start:\00", align 1 -@.str.6 = private constant [26 x i8] c"X len: %d mid element %d\0A\00", align 1 -@.str.7 = private constant [18 x i8] c"Y mid element %d\0A\00", align 1 -@.str.8 = private constant [25 x i8] c"Fofeo second element %d\0A\00", align 1 -@.__const = private constant { i32, [4 x i8] } { i32 1, [4 x i8] undef }, align 8 -@.str.9 = private constant [3 x i8] c"Ok\00", align 1 +@subarrays.fofeo = local_unnamed_addr global i32* getelementptr inbounds ([2 x i32], [2 x i32]* @.taddr.4, i32 0, i32 0), align 8 +@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 +@.str.5 = private unnamed_addr constant [7 x i8] c"Start:\00", align 1 +@.str.6 = private unnamed_addr constant [26 x i8] c"X len: %d mid element %d\0A\00", align 1 +@.str.7 = private unnamed_addr constant [18 x i8] c"Y mid element %d\0A\00", align 1 +@.str.8 = private unnamed_addr constant [25 x i8] c"Fofeo second element %d\0A\00", align 1 +@.__const = private unnamed_addr constant { i32, [4 x i8] } { i32 1, [4 x i8] undef }, align 8 +@.str.9 = private unnamed_addr constant [3 x i8] c"Ok\00", align 1 define i32 @main() #0 { entry: diff --git a/test/test_suite/literals/literal_general.c3t b/test/test_suite/literals/literal_general.c3t index b09e6fdb0..8ff8d01be 100644 --- a/test/test_suite/literals/literal_general.c3t +++ b/test/test_suite/literals/literal_general.c3t @@ -12,11 +12,11 @@ uint foo = '謝'; /* #expect: foo.ll -@foo.aa = global i32 228, align 4 -@foo.x = global i32 1094861636, align 4 -@foo.y = global i32 1214606447, align 4 -@foo.z = global i16 12594, align 2 -@foo.d = global i32 49, align 4 -@foo.b = global i8 64, align 1 -@foo.abc = global i32 322052779, align 4 -@foo.foo = global i32 35613, align 4 +@foo.aa = local_unnamed_addr global i32 228, align 4 +@foo.x = local_unnamed_addr global i32 1094861636, align 4 +@foo.y = local_unnamed_addr global i32 1214606447, align 4 +@foo.z = local_unnamed_addr global i16 12594, align 2 +@foo.d = local_unnamed_addr global i32 49, align 4 +@foo.b = local_unnamed_addr global i8 64, align 1 +@foo.abc = local_unnamed_addr global i32 322052779, align 4 +@foo.foo = local_unnamed_addr global i32 35613, align 4 diff --git a/test/test_suite/macros/userland_bitcast.c3t b/test/test_suite/macros/userland_bitcast.c3t index 5bb217e88..89f7ae97a 100644 --- a/test/test_suite/macros/userland_bitcast.c3t +++ b/test/test_suite/macros/userland_bitcast.c3t @@ -78,8 +78,8 @@ fn void main() %Foo = type { i16, i8, i8, i16, i16 } @Foo = linkonce_odr constant i8 1 -@.str = private constant [16 x i8] c"%f => %d => %f\0A\00", align 1 -@.str.1 = private constant [18 x i8] c"%e => %llu => %e\0A\00", align 1 +@.str = private unnamed_addr constant [16 x i8] c"%f => %d => %f\0A\00", align 1 +@.str.1 = private unnamed_addr constant [18 x i8] c"%e => %llu => %e\0A\00", align 1 ; Function Attrs: nounwind define i64 @userland_bitcast.testFoo(i16 signext %0) #0 { diff --git a/test/test_suite/pointers/const_pointer.c3t b/test/test_suite/pointers/const_pointer.c3t index 78ab41b2b..d7761a1b8 100644 --- a/test/test_suite/pointers/const_pointer.c3t +++ b/test/test_suite/pointers/const_pointer.c3t @@ -13,4 +13,4 @@ private void*[3] data = { &foo, &bar, &xx }; @const_pointer.foo = protected global double 1.700000e+01, align 8 @const_pointer.bar = protected global double 1.200000e+01, align 8 @const_pointer.xx = protected global float 1.200000e+01, align 4 -@const_pointer.data = protected global [3 x i8*] [i8* bitcast (double* @const_pointer.foo to i8*), i8* bitcast (double* @const_pointer.bar to i8*), i8* bitcast (float* @const_pointer.xx to i8*)], align 16 +@const_pointer.data = protected unnamed_addr global [3 x i8*] [i8* bitcast (double* @const_pointer.foo to i8*), i8* bitcast (double* @const_pointer.bar to i8*), i8* bitcast (float* @const_pointer.xx to i8*)], align 16 diff --git a/test/test_suite/scoping/general_scoping.c3t b/test/test_suite/scoping/general_scoping.c3t index 70a53a8a6..03aa9ed98 100644 --- a/test/test_suite/scoping/general_scoping.c3t +++ b/test/test_suite/scoping/general_scoping.c3t @@ -31,9 +31,9 @@ fn void main() @goo = linkonce_odr constant i8 1 @Foo = linkonce_odr constant i8 1 -@test.bob = global %Foo zeroinitializer, align 8 -@.str = private constant [7 x i8] c"%d %d\0A\00", align 1 -@.str.1 = private constant [7 x i8] c"%d %d\0A\00", align 1 +@test.bob = local_unnamed_addr global %Foo zeroinitializer, align 8 +@.str = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 +@.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 ; Function Attrs: nounwind declare void @printf(i8*, ...) #0 diff --git a/test/test_suite/slices/slice_assign.c3t b/test/test_suite/slices/slice_assign.c3t index c2607dc6b..38970579d 100644 --- a/test/test_suite/slices/slice_assign.c3t +++ b/test/test_suite/slices/slice_assign.c3t @@ -18,7 +18,7 @@ fn void main() /* #expect: test.ll -@.str = private constant [4 x i8] c"%d\0A\00", align 1 +@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 declare void @printf(i8*, ...) #0 diff --git a/test/test_suite/statements/custom_foreach_with_ref.c3t b/test/test_suite/statements/custom_foreach_with_ref.c3t index 0319b6f92..77013884c 100644 --- a/test/test_suite/statements/custom_foreach_with_ref.c3t +++ b/test/test_suite/statements/custom_foreach_with_ref.c3t @@ -87,21 +87,21 @@ fn void main() %Foo = type { [3 x i32] } @Foo = linkonce_odr constant i8 1 -@.str = private constant [11 x i8] c"getFields\0A\00", align 1 -@.str.1 = private constant [11 x i8] c"Call made\0A\00", align 1 -@.__const = private constant %Foo { [3 x i32] [i32 1, i32 5, i32 7] }, align 4 -@.str.2 = private constant [10 x i8] c"%d %d %d\0A\00", align 1 -@.str.3 = private constant [14 x i8] c"Hello %d: %d\0A\00", align 1 -@.str.4 = private constant [14 x i8] c"Hello %d: %d\0A\00", align 1 -@.str.5 = private constant [18 x i8] c"After one %d: %d\0A\00", align 1 -@.str.6 = private constant [19 x i8] c"By pointer %d: %d\0A\00", align 1 -@.str.7 = private constant [15 x i8] c"Adding %d: %d\0A\00", align 1 -@.__const.8 = private constant [5 x i32] [i32 1, i32 2, i32 10, i32 111, i32 123], align 16 -@.str.9 = private constant [15 x i8] c"Adding %d: %d\0A\00", align 1 -@.str.10 = private constant [19 x i8] c"Pull value %d: %d\0A\00", align 1 -@.str.11 = private constant [27 x i8] c"Pull value tempptr %d: %d\0A\00", align 1 -@.str.12 = private constant [7 x i8] c"%d %d\0A\00", align 1 -@.str.13 = private constant [7 x i8] c"%d %d\0A\00", align 1 +@.str = private unnamed_addr constant [11 x i8] c"getFields\0A\00", align 1 +@.str.1 = private unnamed_addr constant [11 x i8] c"Call made\0A\00", align 1 +@.__const = private unnamed_addr constant %Foo { [3 x i32] [i32 1, i32 5, i32 7] }, align 4 +@.str.2 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1 +@.str.3 = private unnamed_addr constant [14 x i8] c"Hello %d: %d\0A\00", align 1 +@.str.4 = private unnamed_addr constant [14 x i8] c"Hello %d: %d\0A\00", align 1 +@.str.5 = private unnamed_addr constant [18 x i8] c"After one %d: %d\0A\00", align 1 +@.str.6 = private unnamed_addr constant [19 x i8] c"By pointer %d: %d\0A\00", align 1 +@.str.7 = private unnamed_addr constant [15 x i8] c"Adding %d: %d\0A\00", align 1 +@.__const.8 = private unnamed_addr constant [5 x i32] [i32 1, i32 2, i32 10, i32 111, i32 123], align 16 +@.str.9 = private unnamed_addr constant [15 x i8] c"Adding %d: %d\0A\00", align 1 +@.str.10 = private unnamed_addr constant [19 x i8] c"Pull value %d: %d\0A\00", align 1 +@.str.11 = private unnamed_addr constant [27 x i8] c"Pull value tempptr %d: %d\0A\00", align 1 +@.str.12 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 +@.str.13 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 define void @foo.getFields([5 x i32]* noalias sret([5 x i32]) align 4 %0) #0 { entry: diff --git a/test/test_suite/statements/fallthough_do.c3t b/test/test_suite/statements/fallthough_do.c3t index 949e0e5df..2a0c00254 100644 --- a/test/test_suite/statements/fallthough_do.c3t +++ b/test/test_suite/statements/fallthough_do.c3t @@ -36,9 +36,9 @@ fn void main() /* #expect: foo.ll -@test.x = hidden global i32 0, align 4 -@.str = private constant [4 x i8] c"%d\0A\00", align 1 -@.str.1 = private constant [8 x i8] c"%d, %d\0A\00", align 1 +@test.x = internal unnamed_addr global i32 0, align 4 +@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 +@.str.1 = private unnamed_addr constant [8 x i8] c"%d, %d\0A\00", align 1 define void @foo.main() #0 { entry: diff --git a/test/test_suite/statements/while_switch.c3t b/test/test_suite/statements/while_switch.c3t index dc589accb..0f7f5941b 100644 --- a/test/test_suite/statements/while_switch.c3t +++ b/test/test_suite/statements/while_switch.c3t @@ -31,8 +31,8 @@ fn int main() /* #expect: test.ll -@.str = private constant [2 x i8] c"3\00", align 1 -@.str.1 = private constant [2 x i8] c"4\00", align 1 +@.str = private unnamed_addr constant [2 x i8] c"3\00", align 1 +@.str.1 = private unnamed_addr constant [2 x i8] c"4\00", align 1 define i32 @main() #0 { entry: diff --git a/test/test_suite/strings/literal_to_subarray.c3t b/test/test_suite/strings/literal_to_subarray.c3t index 910e86abb..16b4150f5 100644 --- a/test/test_suite/strings/literal_to_subarray.c3t +++ b/test/test_suite/strings/literal_to_subarray.c3t @@ -7,12 +7,12 @@ fn void test() char[] x = "world"; } -// #expect: literal_to_subarray.ll +/* #expect: literal_to_subarray.ll %"char[]" = type { i8*, i64 } -@.str = private constant [6 x i8] c"hello\00", align 1 -@literal_to_subarray.y = global %"char[]" { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i64 5 }, align 8 -@.str.1 = private constant [6 x i8] c"world\00", align 1 +@.str = private unnamed_addr constant [6 x i8] c"hello\00", align 1 +@literal_to_subarray.y = local_unnamed_addr global %"char[]" { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i64 5 }, align 8 +@.str.1 = private unnamed_addr constant [6 x i8] c"world\00", align 1 ; Function Attrs: nounwind define void @literal_to_subarray.test() #0 { entry: diff --git a/test/test_suite/strings/multiline_strings.c3t b/test/test_suite/strings/multiline_strings.c3t index c8e16e144..8cd235f6b 100644 --- a/test/test_suite/strings/multiline_strings.c3t +++ b/test/test_suite/strings/multiline_strings.c3t @@ -46,14 +46,14 @@ char *message03 = """ // #expect: multiline_strings.ll -@.str = private constant [45 x i8] c" hello\0A world E\0A where is \22quoted\22\0Atotal\00", align 1 -@.str.10 = private constant [52 x i8] c" hello\0A world E\0A where is \22quoted\22\0A total\00", align 1 -@.str.11 = private constant [56 x i8] c" hello\0A world E\0A where is \22quoted\22\0A total\00", align 1 -@.str.12 = private constant [41 x i8] c"\0A `oh` superman\0A where are you now?\0A\00", align 1 -@.str.13 = private constant [7 x i8] c"HfoDke\00", align 1 -@.str.14 = private constant [9 x i8] c"document\00", align 1 +@.str = private unnamed_addr constant [45 x i8] c" hello\0A world E\0A where is \22quoted\22\0Atotal\00", align 1 +@.str.10 = private unnamed_addr constant [52 x i8] c" hello\0A world E\0A where is \22quoted\22\0A total\00", align 1 +@.str.11 = private unnamed_addr constant [56 x i8] c" hello\0A world E\0A where is \22quoted\22\0A total\00", align 1 +@.str.12 = private unnamed_addr constant [41 x i8] c"\0A `oh` superman\0A where are you now?\0A\00", align 1 +@.str.13 = private unnamed_addr constant [7 x i8] c"HfoDke\00", align 1 +@.str.14 = private unnamed_addr constant [9 x i8] c"document\00", align 1 -@.str.15 = private constant [6 x i8] c"hello\00", align 1 -@.str.16 = private constant [6 x i8] c"hello\00", align 1 -@.str.17 = private constant [2 x i8] c" \00", align 1 -@.str.18 = private constant [6 x i8] c"hello\00", align 1 +@.str.15 = private unnamed_addr constant [6 x i8] c"hello\00", align 1 +@.str.16 = private unnamed_addr constant [6 x i8] c"hello\00", align 1 +@.str.17 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@.str.18 = private unnamed_addr constant [6 x i8] c"hello\00", align 1 diff --git a/test/test_suite/strings/string_escape.c3t b/test/test_suite/strings/string_escape.c3t index e3b76bd65..5702cfd63 100644 --- a/test/test_suite/strings/string_escape.c3t +++ b/test/test_suite/strings/string_escape.c3t @@ -6,7 +6,7 @@ fn void main() /* #expect: string_escape.ll -@.str = private constant [18 x i8] c"Hello\00 world! now\00", align 1 +@.str = private unnamed_addr constant [18 x i8] c"Hello\00 world! now\00", align 1 define void @string_escape.main() #0 { entry: diff --git a/test/test_suite/strings/string_len.c3t b/test/test_suite/strings/string_len.c3t index 24068dd03..976089ba5 100644 --- a/test/test_suite/strings/string_len.c3t +++ b/test/test_suite/strings/string_len.c3t @@ -4,4 +4,4 @@ int i = "123".len; /* #expect: string_len.ll -@string_len.i = global i32 3, align 4 \ No newline at end of file +@string_len.i = local_unnamed_addr global i32 3, align 4 \ No newline at end of file diff --git a/test/test_suite/strings/string_to_array.c3t b/test/test_suite/strings/string_to_array.c3t index 3c1d3f323..9a72352c7 100644 --- a/test/test_suite/strings/string_to_array.c3t +++ b/test/test_suite/strings/string_to_array.c3t @@ -10,8 +10,8 @@ fn int main() /* #expect: foo.ll -@.str = private constant [3 x i8] c"ab\00", align 1 -@.str.1 = private constant [4 x i8] c"abc\00", align 1 +@.str = private unnamed_addr constant [3 x i8] c"ab\00", align 1 +@.str.1 = private unnamed_addr constant [4 x i8] c"abc\00", align 1 define i32 @main() #0 { entry: diff --git a/test/test_suite/struct/simple_struct.c3t b/test/test_suite/struct/simple_struct.c3t index fb5f5308a..07bf821fe 100644 --- a/test/test_suite/struct/simple_struct.c3t +++ b/test/test_suite/struct/simple_struct.c3t @@ -11,4 +11,4 @@ struct Foo // #expect: test.ll %Foo = type { i32, double } -@test.a = protected global %Foo zeroinitializer, align 8 \ No newline at end of file +@test.a = protected unnamed_addr global %Foo zeroinitializer, align 8 \ No newline at end of file diff --git a/test/test_suite/struct/struct_as_value.c3t b/test/test_suite/struct/struct_as_value.c3t index 9cb3ce59c..160a0397d 100644 --- a/test/test_suite/struct/struct_as_value.c3t +++ b/test/test_suite/struct/struct_as_value.c3t @@ -16,8 +16,8 @@ fn Event test(int x) // #expect: test.ll @Event = linkonce_odr constant i8 1 -@.__const = private constant %Event { i32 1 }, align 4 -@.__const.1 = private constant %Event { i32 2 }, align 4 +@.__const = private unnamed_addr constant %Event { i32 1 }, align 4 +@.__const.1 = private unnamed_addr constant %Event { i32 2 }, align 4 ; Function Attrs: nounwind define i32 @test.test(i32 %0) #0 { diff --git a/test/test_suite/struct/struct_const_construct_simple.c3t b/test/test_suite/struct/struct_const_construct_simple.c3t index 57041cfb2..589843720 100644 --- a/test/test_suite/struct/struct_const_construct_simple.c3t +++ b/test/test_suite/struct/struct_const_construct_simple.c3t @@ -22,12 +22,12 @@ private Foo foo8 = FOO7; %Foo = type { i32, i64 } @Foo = linkonce_odr constant i8 1 -@structo.x = protected global i64 16, align 8 -@structo.foo1 = protected global %Foo { i32 1, i64 2 }, align 8 -@structo.foo2 = protected global %Foo { i32 2, i64 0 }, align 8 -@structo.foo3 = protected global %Foo { i32 0, i64 3 }, align 8 -@structo.foo4 = protected global %Foo { i32 4, i64 1 }, align 8 -@structo.foo5 = protected global %Foo zeroinitializer, align 8 -@structo.foo6 = protected global %Foo zeroinitializer, align 8 -@structo.FOO7 = protected constant %Foo { i32 1, i64 2 }, align 8 -@structo.foo8 = protected global %Foo { i32 1, i64 2 }, align 8 +@structo.x = protected unnamed_addr global i64 16, align 8 +@structo.foo1 = protected unnamed_addr global %Foo { i32 1, i64 2 }, align 8 +@structo.foo2 = protected unnamed_addr global %Foo { i32 2, i64 0 }, align 8 +@structo.foo3 = protected unnamed_addr global %Foo { i32 0, i64 3 }, align 8 +@structo.foo4 = protected unnamed_addr global %Foo { i32 4, i64 1 }, align 8 +@structo.foo5 = protected unnamed_addr global %Foo zeroinitializer, align 8 +@structo.foo6 = protected unnamed_addr global %Foo zeroinitializer, align 8 +@structo.FOO7 = protected unnamed_addr constant %Foo { i32 1, i64 2 }, align 8 +@structo.foo8 = protected unnamed_addr global %Foo { i32 1, i64 2 }, align 8 diff --git a/test/test_suite/struct/struct_pack_and_align.c3t b/test/test_suite/struct/struct_pack_and_align.c3t index 33c707700..ec7b0c579 100644 --- a/test/test_suite/struct/struct_pack_and_align.c3t +++ b/test/test_suite/struct/struct_pack_and_align.c3t @@ -76,12 +76,12 @@ Foo6 foo6 = { 1, 2, 3 }; %Foo5 = type { i32, [12 x i8], i8, [15 x i8] } %Foo6 = type { i32, i16, i16 } -@struct2.foo1 = global %Foo1 <{ i64 1, i8 2, [3 x i8] undef }>, align 4 -@struct2.foo2 = global %Foo2 <{ i8 1, i64 2, [3 x i8] undef }>, align 4 -@struct2.foo3 = global %Foo3 <{ i8 1, i64 2, [7 x i8] undef }>, align 8 -@struct2.foo4 = global %Foo4 <{ i8 1, i64 2 }>, align 1 -@struct2.foo5 = global %Foo5 { i32 1, [12 x i8] undef, i8 2, [15 x i8] undef }, align 16 -@struct2.foo6 = global %Foo6 { i32 1, i16 2, i16 3 }, align 1 +@struct2.foo1 = local_unnamed_addr global %Foo1 <{ i64 1, i8 2, [3 x i8] undef }>, align 4 +@struct2.foo2 = local_unnamed_addr global %Foo2 <{ i8 1, i64 2, [3 x i8] undef }>, align 4 +@struct2.foo3 = local_unnamed_addr global %Foo3 <{ i8 1, i64 2, [7 x i8] undef }>, align 8 +@struct2.foo4 = local_unnamed_addr global %Foo4 <{ i8 1, i64 2 }>, align 1 +@struct2.foo5 = local_unnamed_addr global %Foo5 { i32 1, [12 x i8] undef, i8 2, [15 x i8] undef }, align 16 +@struct2.foo6 = local_unnamed_addr global %Foo6 { i32 1, i16 2, i16 3 }, align 1 @struct2.test5 entry: diff --git a/test/test_suite/union/union_codegen_const.c3t b/test/test_suite/union/union_codegen_const.c3t index a6c31cd2a..a211ff248 100644 --- a/test/test_suite/union/union_codegen_const.c3t +++ b/test/test_suite/union/union_codegen_const.c3t @@ -13,8 +13,8 @@ Foo i = { .b = 2.3, .a = 23 }; // #expect: test.ll -@test.f = protected global { i32, [4 x i8] } { i32 23, [4 x i8] undef }, align 8 -@test.g = protected global %Foo { double 2.300000e+00 }, align 8 -@test.h = protected global %Foo { double 2.300000e+00 }, align 8 -@test.i = global { i32, [4 x i8] } { i32 23, [4 x i8] undef }, align 8 +@test.f = protected unnamed_addr global { i32, [4 x i8] } { i32 23, [4 x i8] undef }, align 8 +@test.g = protected unnamed_addr global %Foo { double 2.300000e+00 }, align 8 +@test.h = protected unnamed_addr global %Foo { double 2.300000e+00 }, align 8 +@test.i = local_unnamed_addr global { i32, [4 x i8] } { i32 23, [4 x i8] undef }, align 8 diff --git a/test/test_suite/union/union_in_struct.c3t b/test/test_suite/union/union_in_struct.c3t index f654b57ee..4e681fb5b 100644 --- a/test/test_suite/union/union_in_struct.c3t +++ b/test/test_suite/union/union_in_struct.c3t @@ -37,9 +37,9 @@ fn void test(Blend_Map_Entry* foo) %Blend_Map_Entry = type { %vals } %vals = type { [2 x double], [8 x i8] } -@test.foo1 = global { i8, [4 x i8], { i32, [4 x i8] }, i32 } { i8 0, [4 x i8] undef, { i32, [4 x i8] } { i32 3, [4 x i8] undef }, i32 4 }, align 8 -@test.foo2 = global %Foo { i8 0, %anon { double 3.000000e+00 }, i32 4 }, align 8 -@test.a = global { { [5 x float], [4 x i8] } } { { [5 x float], [4 x i8] } { [5 x float] [float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00], [4 x i8] undef } }, align 8 -@test.b = global %Blend_Map_Entry { %vals { [2 x double] [double 6.000000e+00, double 7.000000e+00], [8 x i8] undef } }, align 8 -@test.c = global { { { [2 x float], float, [2 x float] }, [4 x i8] } } { { { [2 x float], float, [2 x float] }, [4 x i8] } { { [2 x float], float, [2 x float] } { [2 x float] zeroinitializer, float 1.000000e+00, [2 x float] zeroinitializer }, [4 x i8] undef } }, align 8 -@test.d = global { { [5 x float], [4 x i8] } } { { [5 x float], [4 x i8] } { [5 x float] [float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00], [4 x i8] undef } }, align 8 +@test.foo1 = local_unnamed_addr global { i8, [4 x i8], { i32, [4 x i8] }, i32 } { i8 0, [4 x i8] undef, { i32, [4 x i8] } { i32 3, [4 x i8] undef }, i32 4 }, align 8 +@test.foo2 = local_unnamed_addr global %Foo { i8 0, %anon { double 3.000000e+00 }, i32 4 }, align 8 +@test.a = local_unnamed_addr global { { [5 x float], [4 x i8] } } { { [5 x float], [4 x i8] } { [5 x float] [float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00], [4 x i8] undef } }, align 8 +@test.b = local_unnamed_addr global %Blend_Map_Entry { %vals { [2 x double] [double 6.000000e+00, double 7.000000e+00], [8 x i8] undef } }, align 8 +@test.c = local_unnamed_addr global { { { [2 x float], float, [2 x float] }, [4 x i8] } } { { { [2 x float], float, [2 x float] }, [4 x i8] } { { [2 x float], float, [2 x float] } { [2 x float] zeroinitializer, float 1.000000e+00, [2 x float] zeroinitializer }, [4 x i8] undef } }, align 8 +@test.d = local_unnamed_addr global { { [5 x float], [4 x i8] } } { { [5 x float], [4 x i8] } { [5 x float] [float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00], [4 x i8] undef } }, align 8 diff --git a/test/test_suite/vector/vector_init.c3t b/test/test_suite/vector/vector_init.c3t index 00fabc35e..566f46967 100644 --- a/test/test_suite/vector/vector_init.c3t +++ b/test/test_suite/vector/vector_init.c3t @@ -14,7 +14,7 @@ fn void main() /* #expect: vector_init.ll -@vector_init.baz = global <4 x i32> , align 16 +@vector_init.baz = local_unnamed_addr global <4 x i32> , align 16 ; Function Attrs: nounwind define void @vector_init.main() #0 { diff --git a/test/test_suite/vector/vector_to_array_cast.c3t b/test/test_suite/vector/vector_to_array_cast.c3t index 1ee0ff50f..f7e5e3590 100644 --- a/test/test_suite/vector/vector_to_array_cast.c3t +++ b/test/test_suite/vector/vector_to_array_cast.c3t @@ -14,8 +14,8 @@ fn void tester() /* #expect: test.ll -@test.b = global <2 x i32> , align 8 -@test.c = global [2 x i32] [i32 1, i32 2], align 4 +@test.b = local_unnamed_addr global <2 x i32> , align 8 +@test.c = local_unnamed_addr global [2 x i32] [i32 1, i32 2], align 4 define void @test.tester() #0 { entry: