From d3fddfb634d527c7c9d24edfb1ba5069b51c0581 Mon Sep 17 00:00:00 2001 From: xushiwei Date: Tue, 30 Apr 2024 23:18:18 +0800 Subject: [PATCH] mv _testcgo => _testrt --- cl/{_testcgo => _testrt}/alloca/in.go | 0 cl/{_testcgo => _testrt}/alloca/out.ll | 0 cl/{_testcgo => _testrt}/allocstr/in.go | 0 cl/{_testcgo => _testrt}/allocstr/out.ll | 6 +++++- cl/{_testcgo => _testrt}/any/in.go | 0 cl/{_testcgo => _testrt}/any/out.ll | 0 cl/{_testdata => _testrt}/builtin/in.go | 0 cl/{_testdata => _testrt}/builtin/out.ll | 0 cl/{_testcgo => _testrt}/cstr/in.go | 0 cl/{_testcgo => _testrt}/cstr/out.ll | 0 cl/{_testcgo => _testrt}/hello/in.go | 0 cl/{_testcgo => _testrt}/hello/out.ll | 0 cl/{_testcgo => _testrt}/strlen/in.go | 0 cl/{_testcgo => _testrt}/strlen/out.ll | 0 cl/{_testcgo => _testrt}/struct/in.go | 0 cl/{_testcgo => _testrt}/struct/out.ll | 0 cl/{_testcgo => _testrt}/sum/in.go | 0 cl/{_testcgo => _testrt}/sum/out.ll | 0 cl/{_testcgo => _testrt}/typalias/in.go | 0 cl/{_testcgo => _testrt}/typalias/out.ll | 0 cl/{_testcgo => _testrt}/unreachable/in.go | 0 cl/{_testcgo => _testrt}/unreachable/out.ll | 0 cl/compile_test.go | 4 ++-- ssa/cl_test.go | 4 ++-- 24 files changed, 9 insertions(+), 5 deletions(-) rename cl/{_testcgo => _testrt}/alloca/in.go (100%) rename cl/{_testcgo => _testrt}/alloca/out.ll (100%) rename cl/{_testcgo => _testrt}/allocstr/in.go (100%) rename cl/{_testcgo => _testrt}/allocstr/out.ll (78%) rename cl/{_testcgo => _testrt}/any/in.go (100%) rename cl/{_testcgo => _testrt}/any/out.ll (100%) rename cl/{_testdata => _testrt}/builtin/in.go (100%) rename cl/{_testdata => _testrt}/builtin/out.ll (100%) rename cl/{_testcgo => _testrt}/cstr/in.go (100%) rename cl/{_testcgo => _testrt}/cstr/out.ll (100%) rename cl/{_testcgo => _testrt}/hello/in.go (100%) rename cl/{_testcgo => _testrt}/hello/out.ll (100%) rename cl/{_testcgo => _testrt}/strlen/in.go (100%) rename cl/{_testcgo => _testrt}/strlen/out.ll (100%) rename cl/{_testcgo => _testrt}/struct/in.go (100%) rename cl/{_testcgo => _testrt}/struct/out.ll (100%) rename cl/{_testcgo => _testrt}/sum/in.go (100%) rename cl/{_testcgo => _testrt}/sum/out.ll (100%) rename cl/{_testcgo => _testrt}/typalias/in.go (100%) rename cl/{_testcgo => _testrt}/typalias/out.ll (100%) rename cl/{_testcgo => _testrt}/unreachable/in.go (100%) rename cl/{_testcgo => _testrt}/unreachable/out.ll (100%) diff --git a/cl/_testcgo/alloca/in.go b/cl/_testrt/alloca/in.go similarity index 100% rename from cl/_testcgo/alloca/in.go rename to cl/_testrt/alloca/in.go diff --git a/cl/_testcgo/alloca/out.ll b/cl/_testrt/alloca/out.ll similarity index 100% rename from cl/_testcgo/alloca/out.ll rename to cl/_testrt/alloca/out.ll diff --git a/cl/_testcgo/allocstr/in.go b/cl/_testrt/allocstr/in.go similarity index 100% rename from cl/_testcgo/allocstr/in.go rename to cl/_testrt/allocstr/in.go diff --git a/cl/_testcgo/allocstr/out.ll b/cl/_testrt/allocstr/out.ll similarity index 78% rename from cl/_testcgo/allocstr/out.ll rename to cl/_testrt/allocstr/out.ll index ddb4b10e..5a3a68b3 100644 --- a/cl/_testcgo/allocstr/out.ll +++ b/cl/_testrt/allocstr/out.ll @@ -5,10 +5,12 @@ source_filename = "main" %"github.com/goplus/llgo/internal/runtime.Slice" = type { ptr, i64, i64 } @"main.init$guard" = global ptr null +@0 = private unnamed_addr constant [13 x i8] c"Hello world\0A\00", align 1 define %"github.com/goplus/llgo/internal/runtime.String" @main.hello() { _llgo_0: - ret [13 x i8] c"Hello world\0A\00" + %0 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @0, i64 12) + ret %"github.com/goplus/llgo/internal/runtime.String" %0 } define void @main.init() { @@ -36,6 +38,8 @@ _llgo_0: ret void } +declare %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr, i64) + declare i64 @"github.com/goplus/llgo/internal/runtime.StringLen"(%"github.com/goplus/llgo/internal/runtime.Slice") declare ptr @"github.com/goplus/llgo/internal/runtime.CStrCopy"(ptr, %"github.com/goplus/llgo/internal/runtime.String") diff --git a/cl/_testcgo/any/in.go b/cl/_testrt/any/in.go similarity index 100% rename from cl/_testcgo/any/in.go rename to cl/_testrt/any/in.go diff --git a/cl/_testcgo/any/out.ll b/cl/_testrt/any/out.ll similarity index 100% rename from cl/_testcgo/any/out.ll rename to cl/_testrt/any/out.ll diff --git a/cl/_testdata/builtin/in.go b/cl/_testrt/builtin/in.go similarity index 100% rename from cl/_testdata/builtin/in.go rename to cl/_testrt/builtin/in.go diff --git a/cl/_testdata/builtin/out.ll b/cl/_testrt/builtin/out.ll similarity index 100% rename from cl/_testdata/builtin/out.ll rename to cl/_testrt/builtin/out.ll diff --git a/cl/_testcgo/cstr/in.go b/cl/_testrt/cstr/in.go similarity index 100% rename from cl/_testcgo/cstr/in.go rename to cl/_testrt/cstr/in.go diff --git a/cl/_testcgo/cstr/out.ll b/cl/_testrt/cstr/out.ll similarity index 100% rename from cl/_testcgo/cstr/out.ll rename to cl/_testrt/cstr/out.ll diff --git a/cl/_testcgo/hello/in.go b/cl/_testrt/hello/in.go similarity index 100% rename from cl/_testcgo/hello/in.go rename to cl/_testrt/hello/in.go diff --git a/cl/_testcgo/hello/out.ll b/cl/_testrt/hello/out.ll similarity index 100% rename from cl/_testcgo/hello/out.ll rename to cl/_testrt/hello/out.ll diff --git a/cl/_testcgo/strlen/in.go b/cl/_testrt/strlen/in.go similarity index 100% rename from cl/_testcgo/strlen/in.go rename to cl/_testrt/strlen/in.go diff --git a/cl/_testcgo/strlen/out.ll b/cl/_testrt/strlen/out.ll similarity index 100% rename from cl/_testcgo/strlen/out.ll rename to cl/_testrt/strlen/out.ll diff --git a/cl/_testcgo/struct/in.go b/cl/_testrt/struct/in.go similarity index 100% rename from cl/_testcgo/struct/in.go rename to cl/_testrt/struct/in.go diff --git a/cl/_testcgo/struct/out.ll b/cl/_testrt/struct/out.ll similarity index 100% rename from cl/_testcgo/struct/out.ll rename to cl/_testrt/struct/out.ll diff --git a/cl/_testcgo/sum/in.go b/cl/_testrt/sum/in.go similarity index 100% rename from cl/_testcgo/sum/in.go rename to cl/_testrt/sum/in.go diff --git a/cl/_testcgo/sum/out.ll b/cl/_testrt/sum/out.ll similarity index 100% rename from cl/_testcgo/sum/out.ll rename to cl/_testrt/sum/out.ll diff --git a/cl/_testcgo/typalias/in.go b/cl/_testrt/typalias/in.go similarity index 100% rename from cl/_testcgo/typalias/in.go rename to cl/_testrt/typalias/in.go diff --git a/cl/_testcgo/typalias/out.ll b/cl/_testrt/typalias/out.ll similarity index 100% rename from cl/_testcgo/typalias/out.ll rename to cl/_testrt/typalias/out.ll diff --git a/cl/_testcgo/unreachable/in.go b/cl/_testrt/unreachable/in.go similarity index 100% rename from cl/_testcgo/unreachable/in.go rename to cl/_testrt/unreachable/in.go diff --git a/cl/_testcgo/unreachable/out.ll b/cl/_testrt/unreachable/out.ll similarity index 100% rename from cl/_testcgo/unreachable/out.ll rename to cl/_testrt/unreachable/out.ll diff --git a/cl/compile_test.go b/cl/compile_test.go index c56355fa..b9c3443f 100644 --- a/cl/compile_test.go +++ b/cl/compile_test.go @@ -28,8 +28,8 @@ func testCompile(t *testing.T, src, expected string) { cltest.TestCompileEx(t, src, "foo.go", expected) } -func TestFromTestcgo(t *testing.T) { - cltest.FromDir(t, "allocstr", "./_testcgo", true) +func TestFromTestrt(t *testing.T) { + cltest.FromDir(t, "", "./_testrt", true) } func TestFromTestdata(t *testing.T) { diff --git a/ssa/cl_test.go b/ssa/cl_test.go index 8690bc6c..b5630353 100644 --- a/ssa/cl_test.go +++ b/ssa/cl_test.go @@ -22,8 +22,8 @@ import ( "github.com/goplus/llgo/cl/cltest" ) -func TestFromTestcgo(t *testing.T) { - cltest.FromDir(t, "", "../cl/_testcgo", true) +func TestFromTestrt(t *testing.T) { + cltest.FromDir(t, "", "../cl/_testrt", true) } func TestFromTestdata(t *testing.T) {