diff --git a/cl/_testdata/print/out.ll b/cl/_testdata/print/out.ll index 0e4003b5..3288ef27 100644 --- a/cl/_testdata/print/out.ll +++ b/cl/_testdata/print/out.ll @@ -5,7 +5,7 @@ source_filename = "main" %"github.com/goplus/llgo/internal/runtime.String" = type { ptr, i64 } %main.stringStruct = type { ptr, i64 } %main.slice = type { ptr, i64, i64 } -%"github.com/goplus/llgo/internal/runtime.iface" = type { ptr, ptr } +%"github.com/goplus/llgo/internal/runtime.eface" = type { ptr, ptr } @"main.init$guard" = global ptr null @main.minhexdigits = global ptr null @@ -104,127 +104,251 @@ _llgo_0: call void @main.prinfsub(double 1.001000e+02) call void @main.printnl() %6 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 13) - %7 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyIntptr"(ptr %6, i64 1315859240) - call void @main.printany(%"github.com/goplus/llgo/internal/runtime.iface" %7) + %7 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %8 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %7, i32 0, i32 0 + store ptr %6, ptr %8, align 8 + %9 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %7, i32 0, i32 1 + store ptr inttoptr (i32 1315859240 to ptr), ptr %9, align 8 + %10 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %7, align 8 + call void @main.printany(%"github.com/goplus/llgo/internal/runtime.eface" %10) call void @main.printnl() - %8 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 14) - %9 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyIntptr"(ptr %8, i64 4746175415993761792) - call void @main.printany(%"github.com/goplus/llgo/internal/runtime.iface" %9) + %11 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 14) + %12 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %13 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %12, i32 0, i32 0 + store ptr %11, ptr %13, align 8 + %14 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %12, i32 0, i32 1 + store ptr inttoptr (i64 4746175415993761792 to ptr), ptr %14, align 8 + %15 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %12, align 8 + call void @main.printany(%"github.com/goplus/llgo/internal/runtime.eface" %15) call void @main.printnl() br i1 true, label %_llgo_3, label %_llgo_2 _llgo_1: ; preds = %_llgo_3 - %10 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 32) - %11 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %10, i64 0 - %12 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %13 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %12, i32 0, i32 0 - store ptr @2, ptr %13, align 8 - %14 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %12, i32 0, i32 1 - store i64 10, ptr %14, align 4 - %15 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %12, align 8 - %16 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyString"(%"github.com/goplus/llgo/internal/runtime.String" %15) - store %"github.com/goplus/llgo/internal/runtime.iface" %16, ptr %11, align 8 - %17 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %10, i64 1 - %18 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 1) - %19 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyIntptr"(ptr %18, i64 -1) - store %"github.com/goplus/llgo/internal/runtime.iface" %19, ptr %17, align 8 - %20 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %10, i64 16, i64 2, i64 0, i64 2, i64 2) - call void @main.println(%"github.com/goplus/llgo/internal/runtime.Slice" %20) + %16 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 32) + %17 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %16, i64 0 + %18 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 + %19 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %18, i32 0, i32 0 + store ptr @2, ptr %19, align 8 + %20 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %18, i32 0, i32 1 + store i64 10, ptr %20, align 4 + %21 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %18, align 8 + %22 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24) + %23 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16) + store %"github.com/goplus/llgo/internal/runtime.String" %21, ptr %23, align 8 + %24 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %25 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %24, i32 0, i32 0 + store ptr %22, ptr %25, align 8 + %26 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %24, i32 0, i32 1 + store ptr %23, ptr %26, align 8 + %27 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %24, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %27, ptr %17, align 8 + %28 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %16, i64 1 + %29 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 1) + %30 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %31 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %30, i32 0, i32 0 + store ptr %29, ptr %31, align 8 + %32 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %30, i32 0, i32 1 + store ptr inttoptr (i64 -1 to ptr), ptr %32, align 8 + %33 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %30, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %33, ptr %28, align 8 + %34 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %16, i64 16, i64 2, i64 0, i64 2, i64 2) + call void @main.println(%"github.com/goplus/llgo/internal/runtime.Slice" %34) br label %_llgo_2 _llgo_2: ; preds = %_llgo_3, %_llgo_1, %_llgo_0 - %21 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 48) - %22 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %21, i64 0 - %23 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %24 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %23, i32 0, i32 0 - store ptr @3, ptr %24, align 8 - %25 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %23, i32 0, i32 1 - store i64 8, ptr %25, align 4 - %26 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %23, align 8 - %27 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyString"(%"github.com/goplus/llgo/internal/runtime.String" %26) - store %"github.com/goplus/llgo/internal/runtime.iface" %27, ptr %22, align 8 - %28 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %21, i64 1 - %29 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 1) - %30 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyIntptr"(ptr %29, i64 -1) - store %"github.com/goplus/llgo/internal/runtime.iface" %30, ptr %28, align 8 - %31 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %21, i64 2 - %32 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 1) - %33 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyIntptr"(ptr %32, i64 -1) - store %"github.com/goplus/llgo/internal/runtime.iface" %33, ptr %31, align 8 - %34 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %21, i64 16, i64 3, i64 0, i64 3, i64 3) - call void @main.println(%"github.com/goplus/llgo/internal/runtime.Slice" %34) - %35 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 256) - %36 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %35, i64 0 - %37 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 1) - %38 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyIntptr"(ptr %37, i64 -1) - store %"github.com/goplus/llgo/internal/runtime.iface" %38, ptr %36, align 8 - %39 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %35, i64 1 - %40 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 1) - %41 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyIntptr"(ptr %40, i64 0) - store %"github.com/goplus/llgo/internal/runtime.iface" %41, ptr %39, align 8 - %42 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %35, i64 2 - %43 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 5) - %44 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyIntptr"(ptr %43, i64 97) - store %"github.com/goplus/llgo/internal/runtime.iface" %44, ptr %42, align 8 - %45 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %35, i64 3 - %46 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 5) - %47 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyIntptr"(ptr %46, i64 65) - store %"github.com/goplus/llgo/internal/runtime.iface" %47, ptr %45, align 8 - %48 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %35, i64 4 - %49 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 5) - %50 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyIntptr"(ptr %49, i64 20013) - store %"github.com/goplus/llgo/internal/runtime.iface" %50, ptr %48, align 8 - %51 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %35, i64 5 - %52 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 3) - %53 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyIntptr"(ptr %52, i64 1) - store %"github.com/goplus/llgo/internal/runtime.iface" %53, ptr %51, align 8 - %54 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %35, i64 6 - %55 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 4) - %56 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyIntptr"(ptr %55, i64 2) - store %"github.com/goplus/llgo/internal/runtime.iface" %56, ptr %54, align 8 - %57 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %35, i64 7 - %58 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 5) - %59 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyIntptr"(ptr %58, i64 3) - store %"github.com/goplus/llgo/internal/runtime.iface" %59, ptr %57, align 8 - %60 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %35, i64 8 - %61 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 6) - %62 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyIntptr"(ptr %61, i64 4) - store %"github.com/goplus/llgo/internal/runtime.iface" %62, ptr %60, align 8 - %63 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %35, i64 9 - %64 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 2) - %65 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyIntptr"(ptr %64, i64 5) - store %"github.com/goplus/llgo/internal/runtime.iface" %65, ptr %63, align 8 - %66 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %35, i64 10 - %67 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 8) - %68 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyIntptr"(ptr %67, i64 1) - store %"github.com/goplus/llgo/internal/runtime.iface" %68, ptr %66, align 8 - %69 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %35, i64 11 - %70 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 9) - %71 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyIntptr"(ptr %70, i64 2) - store %"github.com/goplus/llgo/internal/runtime.iface" %71, ptr %69, align 8 - %72 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %35, i64 12 - %73 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 10) - %74 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyIntptr"(ptr %73, i64 3) - store %"github.com/goplus/llgo/internal/runtime.iface" %74, ptr %72, align 8 - %75 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %35, i64 13 - %76 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 11) - %77 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyIntptr"(ptr %76, i64 4) - store %"github.com/goplus/llgo/internal/runtime.iface" %77, ptr %75, align 8 - %78 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %35, i64 14 - %79 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 12) - %80 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyIntptr"(ptr %79, i64 5) - store %"github.com/goplus/llgo/internal/runtime.iface" %80, ptr %78, align 8 - %81 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %35, i64 15 - %82 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %83 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %82, i32 0, i32 0 - store ptr @4, ptr %83, align 8 - %84 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %82, i32 0, i32 1 - store i64 4, ptr %84, align 4 - %85 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %82, align 8 - %86 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyString"(%"github.com/goplus/llgo/internal/runtime.String" %85) - store %"github.com/goplus/llgo/internal/runtime.iface" %86, ptr %81, align 8 - %87 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %35, i64 16, i64 16, i64 0, i64 16, i64 16) - call void @main.println(%"github.com/goplus/llgo/internal/runtime.Slice" %87) + %35 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 48) + %36 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %35, i64 0 + %37 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 + %38 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %37, i32 0, i32 0 + store ptr @3, ptr %38, align 8 + %39 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %37, i32 0, i32 1 + store i64 8, ptr %39, align 4 + %40 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %37, align 8 + %41 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24) + %42 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16) + store %"github.com/goplus/llgo/internal/runtime.String" %40, ptr %42, align 8 + %43 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %44 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %43, i32 0, i32 0 + store ptr %41, ptr %44, align 8 + %45 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %43, i32 0, i32 1 + store ptr %42, ptr %45, align 8 + %46 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %43, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %46, ptr %36, align 8 + %47 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %35, i64 1 + %48 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 1) + %49 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %50 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %49, i32 0, i32 0 + store ptr %48, ptr %50, align 8 + %51 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %49, i32 0, i32 1 + store ptr inttoptr (i64 -1 to ptr), ptr %51, align 8 + %52 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %49, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %52, ptr %47, align 8 + %53 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %35, i64 2 + %54 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 1) + %55 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %56 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %55, i32 0, i32 0 + store ptr %54, ptr %56, align 8 + %57 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %55, i32 0, i32 1 + store ptr inttoptr (i64 -1 to ptr), ptr %57, align 8 + %58 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %55, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %58, ptr %53, align 8 + %59 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %35, i64 16, i64 3, i64 0, i64 3, i64 3) + call void @main.println(%"github.com/goplus/llgo/internal/runtime.Slice" %59) + %60 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 256) + %61 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %60, i64 0 + %62 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 1) + %63 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %64 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %63, i32 0, i32 0 + store ptr %62, ptr %64, align 8 + %65 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %63, i32 0, i32 1 + store ptr inttoptr (i64 -1 to ptr), ptr %65, align 8 + %66 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %63, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %66, ptr %61, align 8 + %67 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %60, i64 1 + %68 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 1) + %69 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %70 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %69, i32 0, i32 0 + store ptr %68, ptr %70, align 8 + %71 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %69, i32 0, i32 1 + store ptr null, ptr %71, align 8 + %72 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %69, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %72, ptr %67, align 8 + %73 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %60, i64 2 + %74 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 5) + %75 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %76 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %75, i32 0, i32 0 + store ptr %74, ptr %76, align 8 + %77 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %75, i32 0, i32 1 + store ptr inttoptr (i64 97 to ptr), ptr %77, align 8 + %78 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %75, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %78, ptr %73, align 8 + %79 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %60, i64 3 + %80 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 5) + %81 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %82 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %81, i32 0, i32 0 + store ptr %80, ptr %82, align 8 + %83 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %81, i32 0, i32 1 + store ptr inttoptr (i64 65 to ptr), ptr %83, align 8 + %84 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %81, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %84, ptr %79, align 8 + %85 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %60, i64 4 + %86 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 5) + %87 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %88 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %87, i32 0, i32 0 + store ptr %86, ptr %88, align 8 + %89 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %87, i32 0, i32 1 + store ptr inttoptr (i64 20013 to ptr), ptr %89, align 8 + %90 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %87, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %90, ptr %85, align 8 + %91 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %60, i64 5 + %92 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 3) + %93 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %94 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %93, i32 0, i32 0 + store ptr %92, ptr %94, align 8 + %95 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %93, i32 0, i32 1 + store ptr inttoptr (i64 1 to ptr), ptr %95, align 8 + %96 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %93, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %96, ptr %91, align 8 + %97 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %60, i64 6 + %98 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 4) + %99 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %100 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %99, i32 0, i32 0 + store ptr %98, ptr %100, align 8 + %101 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %99, i32 0, i32 1 + store ptr inttoptr (i64 2 to ptr), ptr %101, align 8 + %102 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %99, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %102, ptr %97, align 8 + %103 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %60, i64 7 + %104 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 5) + %105 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %106 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %105, i32 0, i32 0 + store ptr %104, ptr %106, align 8 + %107 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %105, i32 0, i32 1 + store ptr inttoptr (i64 3 to ptr), ptr %107, align 8 + %108 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %105, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %108, ptr %103, align 8 + %109 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %60, i64 8 + %110 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 6) + %111 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %112 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %111, i32 0, i32 0 + store ptr %110, ptr %112, align 8 + %113 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %111, i32 0, i32 1 + store ptr inttoptr (i64 4 to ptr), ptr %113, align 8 + %114 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %111, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %114, ptr %109, align 8 + %115 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %60, i64 9 + %116 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 2) + %117 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %118 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %117, i32 0, i32 0 + store ptr %116, ptr %118, align 8 + %119 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %117, i32 0, i32 1 + store ptr inttoptr (i64 5 to ptr), ptr %119, align 8 + %120 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %117, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %120, ptr %115, align 8 + %121 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %60, i64 10 + %122 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 8) + %123 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %124 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %123, i32 0, i32 0 + store ptr %122, ptr %124, align 8 + %125 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %123, i32 0, i32 1 + store ptr inttoptr (i64 1 to ptr), ptr %125, align 8 + %126 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %123, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %126, ptr %121, align 8 + %127 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %60, i64 11 + %128 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 9) + %129 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %130 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %129, i32 0, i32 0 + store ptr %128, ptr %130, align 8 + %131 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %129, i32 0, i32 1 + store ptr inttoptr (i64 2 to ptr), ptr %131, align 8 + %132 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %129, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %132, ptr %127, align 8 + %133 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %60, i64 12 + %134 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 10) + %135 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %136 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %135, i32 0, i32 0 + store ptr %134, ptr %136, align 8 + %137 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %135, i32 0, i32 1 + store ptr inttoptr (i64 3 to ptr), ptr %137, align 8 + %138 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %135, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %138, ptr %133, align 8 + %139 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %60, i64 13 + %140 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 11) + %141 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %142 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %141, i32 0, i32 0 + store ptr %140, ptr %142, align 8 + %143 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %141, i32 0, i32 1 + store ptr inttoptr (i64 4 to ptr), ptr %143, align 8 + %144 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %141, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %144, ptr %139, align 8 + %145 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %60, i64 14 + %146 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 12) + %147 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %148 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %147, i32 0, i32 0 + store ptr %146, ptr %148, align 8 + %149 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %147, i32 0, i32 1 + store ptr inttoptr (i64 5 to ptr), ptr %149, align 8 + %150 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %147, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %150, ptr %145, align 8 + %151 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %60, i64 15 + %152 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 + %153 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %152, i32 0, i32 0 + store ptr @4, ptr %153, align 8 + %154 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %152, i32 0, i32 1 + store i64 4, ptr %154, align 4 + %155 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %152, align 8 + %156 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24) + %157 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16) + store %"github.com/goplus/llgo/internal/runtime.String" %155, ptr %157, align 8 + %158 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %159 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %158, i32 0, i32 0 + store ptr %156, ptr %159, align 8 + %160 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %158, i32 0, i32 1 + store ptr %157, ptr %160, align 8 + %161 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %158, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %161, ptr %151, align 8 + %162 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %60, i64 16, i64 16, i64 0, i64 16, i64 16) + call void @main.println(%"github.com/goplus/llgo/internal/runtime.Slice" %162) ret i32 0 _llgo_3: ; preds = %_llgo_0 @@ -245,190 +369,429 @@ _llgo_0: ret void } -define void @main.printany(%"github.com/goplus/llgo/internal/runtime.iface" %0) { +define void @main.printany(%"github.com/goplus/llgo/internal/runtime.eface" %0) { _llgo_0: - %1 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 1) - %2 = call { i64, i1 } @"github.com/goplus/llgo/internal/runtime.CheckI2Int"(%"github.com/goplus/llgo/internal/runtime.iface" %0, ptr %1) - %3 = extractvalue { i64, i1 } %2, 0 - %4 = trunc i64 %3 to i1 - %5 = extractvalue { i64, i1 } %2, 1 - br i1 %5, label %_llgo_2, label %_llgo_3 + %1 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 0 + %2 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 1) + %3 = icmp eq ptr %1, %2 + %4 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 1 + %5 = ptrtoint ptr %4 to i64 + %6 = trunc i64 %5 to i1 + %7 = alloca { i1, i1 }, align 8 + %8 = getelementptr inbounds { i1, i1 }, ptr %7, i32 0, i32 0 + store i1 %6, ptr %8, align 1 + %9 = getelementptr inbounds { i1, i1 }, ptr %7, i32 0, i32 1 + store i1 true, ptr %9, align 1 + %10 = load { i1, i1 }, ptr %7, align 1 + %11 = alloca { i1, i1 }, align 8 + %12 = getelementptr inbounds { i1, i1 }, ptr %11, i32 0, i32 0 + store i1 false, ptr %12, align 1 + %13 = getelementptr inbounds { i1, i1 }, ptr %11, i32 0, i32 1 + store i1 false, ptr %13, align 1 + %14 = load { i1, i1 }, ptr %11, align 1 + %15 = select i1 %3, { i1, i1 } %10, { i1, i1 } %14 + %16 = extractvalue { i1, i1 } %15, 0 + %17 = extractvalue { i1, i1 } %15, 1 + br i1 %17, label %_llgo_2, label %_llgo_3 _llgo_1: ; preds = %_llgo_30, %_llgo_29, %_llgo_28, %_llgo_26, %_llgo_24, %_llgo_22, %_llgo_20, %_llgo_18, %_llgo_16, %_llgo_14, %_llgo_12, %_llgo_10, %_llgo_8, %_llgo_6, %_llgo_4, %_llgo_2 ret void _llgo_2: ; preds = %_llgo_0 - call void @main.printbool(i1 %4) + call void @main.printbool(i1 %16) br label %_llgo_1 _llgo_3: ; preds = %_llgo_0 - %6 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 2) - %7 = call { i64, i1 } @"github.com/goplus/llgo/internal/runtime.CheckI2Int"(%"github.com/goplus/llgo/internal/runtime.iface" %0, ptr %6) - %8 = extractvalue { i64, i1 } %7, 0 - %9 = extractvalue { i64, i1 } %7, 1 - br i1 %9, label %_llgo_4, label %_llgo_5 + %18 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 0 + %19 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 2) + %20 = icmp eq ptr %18, %19 + %21 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 1 + %22 = ptrtoint ptr %21 to i64 + %23 = alloca { i64, i1 }, align 8 + %24 = getelementptr inbounds { i64, i1 }, ptr %23, i32 0, i32 0 + store i64 %22, ptr %24, align 4 + %25 = getelementptr inbounds { i64, i1 }, ptr %23, i32 0, i32 1 + store i1 true, ptr %25, align 1 + %26 = load { i64, i1 }, ptr %23, align 4 + %27 = alloca { i64, i1 }, align 8 + %28 = getelementptr inbounds { i64, i1 }, ptr %27, i32 0, i32 0 + store i64 0, ptr %28, align 4 + %29 = getelementptr inbounds { i64, i1 }, ptr %27, i32 0, i32 1 + store i1 false, ptr %29, align 1 + %30 = load { i64, i1 }, ptr %27, align 4 + %31 = select i1 %20, { i64, i1 } %26, { i64, i1 } %30 + %32 = extractvalue { i64, i1 } %31, 0 + %33 = extractvalue { i64, i1 } %31, 1 + br i1 %33, label %_llgo_4, label %_llgo_5 _llgo_4: ; preds = %_llgo_3 - call void @main.printint(i64 %8) + call void @main.printint(i64 %32) br label %_llgo_1 _llgo_5: ; preds = %_llgo_3 - %10 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 3) - %11 = call { i64, i1 } @"github.com/goplus/llgo/internal/runtime.CheckI2Int"(%"github.com/goplus/llgo/internal/runtime.iface" %0, ptr %10) - %12 = extractvalue { i64, i1 } %11, 0 - %13 = trunc i64 %12 to i8 - %14 = extractvalue { i64, i1 } %11, 1 - br i1 %14, label %_llgo_6, label %_llgo_7 + %34 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 0 + %35 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 3) + %36 = icmp eq ptr %34, %35 + %37 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 1 + %38 = ptrtoint ptr %37 to i64 + %39 = trunc i64 %38 to i8 + %40 = alloca { i8, i1 }, align 8 + %41 = getelementptr inbounds { i8, i1 }, ptr %40, i32 0, i32 0 + store i8 %39, ptr %41, align 1 + %42 = getelementptr inbounds { i8, i1 }, ptr %40, i32 0, i32 1 + store i1 true, ptr %42, align 1 + %43 = load { i8, i1 }, ptr %40, align 1 + %44 = alloca { i8, i1 }, align 8 + %45 = getelementptr inbounds { i8, i1 }, ptr %44, i32 0, i32 0 + store i8 0, ptr %45, align 1 + %46 = getelementptr inbounds { i8, i1 }, ptr %44, i32 0, i32 1 + store i1 false, ptr %46, align 1 + %47 = load { i8, i1 }, ptr %44, align 1 + %48 = select i1 %36, { i8, i1 } %43, { i8, i1 } %47 + %49 = extractvalue { i8, i1 } %48, 0 + %50 = extractvalue { i8, i1 } %48, 1 + br i1 %50, label %_llgo_6, label %_llgo_7 _llgo_6: ; preds = %_llgo_5 - %15 = sext i8 %13 to i64 - call void @main.printint(i64 %15) + %51 = sext i8 %49 to i64 + call void @main.printint(i64 %51) br label %_llgo_1 _llgo_7: ; preds = %_llgo_5 - %16 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 4) - %17 = call { i64, i1 } @"github.com/goplus/llgo/internal/runtime.CheckI2Int"(%"github.com/goplus/llgo/internal/runtime.iface" %0, ptr %16) - %18 = extractvalue { i64, i1 } %17, 0 - %19 = trunc i64 %18 to i16 - %20 = extractvalue { i64, i1 } %17, 1 - br i1 %20, label %_llgo_8, label %_llgo_9 + %52 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 0 + %53 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 4) + %54 = icmp eq ptr %52, %53 + %55 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 1 + %56 = ptrtoint ptr %55 to i64 + %57 = trunc i64 %56 to i16 + %58 = alloca { i16, i1 }, align 8 + %59 = getelementptr inbounds { i16, i1 }, ptr %58, i32 0, i32 0 + store i16 %57, ptr %59, align 2 + %60 = getelementptr inbounds { i16, i1 }, ptr %58, i32 0, i32 1 + store i1 true, ptr %60, align 1 + %61 = load { i16, i1 }, ptr %58, align 2 + %62 = alloca { i16, i1 }, align 8 + %63 = getelementptr inbounds { i16, i1 }, ptr %62, i32 0, i32 0 + store i16 0, ptr %63, align 2 + %64 = getelementptr inbounds { i16, i1 }, ptr %62, i32 0, i32 1 + store i1 false, ptr %64, align 1 + %65 = load { i16, i1 }, ptr %62, align 2 + %66 = select i1 %54, { i16, i1 } %61, { i16, i1 } %65 + %67 = extractvalue { i16, i1 } %66, 0 + %68 = extractvalue { i16, i1 } %66, 1 + br i1 %68, label %_llgo_8, label %_llgo_9 _llgo_8: ; preds = %_llgo_7 - %21 = sext i16 %19 to i64 - call void @main.printint(i64 %21) + %69 = sext i16 %67 to i64 + call void @main.printint(i64 %69) br label %_llgo_1 _llgo_9: ; preds = %_llgo_7 - %22 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 5) - %23 = call { i64, i1 } @"github.com/goplus/llgo/internal/runtime.CheckI2Int"(%"github.com/goplus/llgo/internal/runtime.iface" %0, ptr %22) - %24 = extractvalue { i64, i1 } %23, 0 - %25 = trunc i64 %24 to i32 - %26 = extractvalue { i64, i1 } %23, 1 - br i1 %26, label %_llgo_10, label %_llgo_11 + %70 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 0 + %71 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 5) + %72 = icmp eq ptr %70, %71 + %73 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 1 + %74 = ptrtoint ptr %73 to i64 + %75 = trunc i64 %74 to i32 + %76 = alloca { i32, i1 }, align 8 + %77 = getelementptr inbounds { i32, i1 }, ptr %76, i32 0, i32 0 + store i32 %75, ptr %77, align 4 + %78 = getelementptr inbounds { i32, i1 }, ptr %76, i32 0, i32 1 + store i1 true, ptr %78, align 1 + %79 = load { i32, i1 }, ptr %76, align 4 + %80 = alloca { i32, i1 }, align 8 + %81 = getelementptr inbounds { i32, i1 }, ptr %80, i32 0, i32 0 + store i32 0, ptr %81, align 4 + %82 = getelementptr inbounds { i32, i1 }, ptr %80, i32 0, i32 1 + store i1 false, ptr %82, align 1 + %83 = load { i32, i1 }, ptr %80, align 4 + %84 = select i1 %72, { i32, i1 } %79, { i32, i1 } %83 + %85 = extractvalue { i32, i1 } %84, 0 + %86 = extractvalue { i32, i1 } %84, 1 + br i1 %86, label %_llgo_10, label %_llgo_11 _llgo_10: ; preds = %_llgo_9 - %27 = sext i32 %25 to i64 - call void @main.printint(i64 %27) + %87 = sext i32 %85 to i64 + call void @main.printint(i64 %87) br label %_llgo_1 _llgo_11: ; preds = %_llgo_9 - %28 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 6) - %29 = call { i64, i1 } @"github.com/goplus/llgo/internal/runtime.CheckI2Int"(%"github.com/goplus/llgo/internal/runtime.iface" %0, ptr %28) - %30 = extractvalue { i64, i1 } %29, 0 - %31 = extractvalue { i64, i1 } %29, 1 - br i1 %31, label %_llgo_12, label %_llgo_13 + %88 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 0 + %89 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 6) + %90 = icmp eq ptr %88, %89 + %91 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 1 + %92 = ptrtoint ptr %91 to i64 + %93 = alloca { i64, i1 }, align 8 + %94 = getelementptr inbounds { i64, i1 }, ptr %93, i32 0, i32 0 + store i64 %92, ptr %94, align 4 + %95 = getelementptr inbounds { i64, i1 }, ptr %93, i32 0, i32 1 + store i1 true, ptr %95, align 1 + %96 = load { i64, i1 }, ptr %93, align 4 + %97 = alloca { i64, i1 }, align 8 + %98 = getelementptr inbounds { i64, i1 }, ptr %97, i32 0, i32 0 + store i64 0, ptr %98, align 4 + %99 = getelementptr inbounds { i64, i1 }, ptr %97, i32 0, i32 1 + store i1 false, ptr %99, align 1 + %100 = load { i64, i1 }, ptr %97, align 4 + %101 = select i1 %90, { i64, i1 } %96, { i64, i1 } %100 + %102 = extractvalue { i64, i1 } %101, 0 + %103 = extractvalue { i64, i1 } %101, 1 + br i1 %103, label %_llgo_12, label %_llgo_13 _llgo_12: ; preds = %_llgo_11 - call void @main.printint(i64 %30) + call void @main.printint(i64 %102) br label %_llgo_1 _llgo_13: ; preds = %_llgo_11 - %32 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 7) - %33 = call { i64, i1 } @"github.com/goplus/llgo/internal/runtime.CheckI2Int"(%"github.com/goplus/llgo/internal/runtime.iface" %0, ptr %32) - %34 = extractvalue { i64, i1 } %33, 0 - %35 = extractvalue { i64, i1 } %33, 1 - br i1 %35, label %_llgo_14, label %_llgo_15 + %104 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 0 + %105 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 7) + %106 = icmp eq ptr %104, %105 + %107 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 1 + %108 = ptrtoint ptr %107 to i64 + %109 = alloca { i64, i1 }, align 8 + %110 = getelementptr inbounds { i64, i1 }, ptr %109, i32 0, i32 0 + store i64 %108, ptr %110, align 4 + %111 = getelementptr inbounds { i64, i1 }, ptr %109, i32 0, i32 1 + store i1 true, ptr %111, align 1 + %112 = load { i64, i1 }, ptr %109, align 4 + %113 = alloca { i64, i1 }, align 8 + %114 = getelementptr inbounds { i64, i1 }, ptr %113, i32 0, i32 0 + store i64 0, ptr %114, align 4 + %115 = getelementptr inbounds { i64, i1 }, ptr %113, i32 0, i32 1 + store i1 false, ptr %115, align 1 + %116 = load { i64, i1 }, ptr %113, align 4 + %117 = select i1 %106, { i64, i1 } %112, { i64, i1 } %116 + %118 = extractvalue { i64, i1 } %117, 0 + %119 = extractvalue { i64, i1 } %117, 1 + br i1 %119, label %_llgo_14, label %_llgo_15 _llgo_14: ; preds = %_llgo_13 - call void @main.printuint(i64 %34) + call void @main.printuint(i64 %118) br label %_llgo_1 _llgo_15: ; preds = %_llgo_13 - %36 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 8) - %37 = call { i64, i1 } @"github.com/goplus/llgo/internal/runtime.CheckI2Int"(%"github.com/goplus/llgo/internal/runtime.iface" %0, ptr %36) - %38 = extractvalue { i64, i1 } %37, 0 - %39 = trunc i64 %38 to i8 - %40 = extractvalue { i64, i1 } %37, 1 - br i1 %40, label %_llgo_16, label %_llgo_17 + %120 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 0 + %121 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 8) + %122 = icmp eq ptr %120, %121 + %123 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 1 + %124 = ptrtoint ptr %123 to i64 + %125 = trunc i64 %124 to i8 + %126 = alloca { i8, i1 }, align 8 + %127 = getelementptr inbounds { i8, i1 }, ptr %126, i32 0, i32 0 + store i8 %125, ptr %127, align 1 + %128 = getelementptr inbounds { i8, i1 }, ptr %126, i32 0, i32 1 + store i1 true, ptr %128, align 1 + %129 = load { i8, i1 }, ptr %126, align 1 + %130 = alloca { i8, i1 }, align 8 + %131 = getelementptr inbounds { i8, i1 }, ptr %130, i32 0, i32 0 + store i8 0, ptr %131, align 1 + %132 = getelementptr inbounds { i8, i1 }, ptr %130, i32 0, i32 1 + store i1 false, ptr %132, align 1 + %133 = load { i8, i1 }, ptr %130, align 1 + %134 = select i1 %122, { i8, i1 } %129, { i8, i1 } %133 + %135 = extractvalue { i8, i1 } %134, 0 + %136 = extractvalue { i8, i1 } %134, 1 + br i1 %136, label %_llgo_16, label %_llgo_17 _llgo_16: ; preds = %_llgo_15 - %41 = zext i8 %39 to i64 - call void @main.printuint(i64 %41) + %137 = zext i8 %135 to i64 + call void @main.printuint(i64 %137) br label %_llgo_1 _llgo_17: ; preds = %_llgo_15 - %42 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 9) - %43 = call { i64, i1 } @"github.com/goplus/llgo/internal/runtime.CheckI2Int"(%"github.com/goplus/llgo/internal/runtime.iface" %0, ptr %42) - %44 = extractvalue { i64, i1 } %43, 0 - %45 = trunc i64 %44 to i16 - %46 = extractvalue { i64, i1 } %43, 1 - br i1 %46, label %_llgo_18, label %_llgo_19 + %138 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 0 + %139 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 9) + %140 = icmp eq ptr %138, %139 + %141 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 1 + %142 = ptrtoint ptr %141 to i64 + %143 = trunc i64 %142 to i16 + %144 = alloca { i16, i1 }, align 8 + %145 = getelementptr inbounds { i16, i1 }, ptr %144, i32 0, i32 0 + store i16 %143, ptr %145, align 2 + %146 = getelementptr inbounds { i16, i1 }, ptr %144, i32 0, i32 1 + store i1 true, ptr %146, align 1 + %147 = load { i16, i1 }, ptr %144, align 2 + %148 = alloca { i16, i1 }, align 8 + %149 = getelementptr inbounds { i16, i1 }, ptr %148, i32 0, i32 0 + store i16 0, ptr %149, align 2 + %150 = getelementptr inbounds { i16, i1 }, ptr %148, i32 0, i32 1 + store i1 false, ptr %150, align 1 + %151 = load { i16, i1 }, ptr %148, align 2 + %152 = select i1 %140, { i16, i1 } %147, { i16, i1 } %151 + %153 = extractvalue { i16, i1 } %152, 0 + %154 = extractvalue { i16, i1 } %152, 1 + br i1 %154, label %_llgo_18, label %_llgo_19 _llgo_18: ; preds = %_llgo_17 - %47 = zext i16 %45 to i64 - call void @main.printuint(i64 %47) + %155 = zext i16 %153 to i64 + call void @main.printuint(i64 %155) br label %_llgo_1 _llgo_19: ; preds = %_llgo_17 - %48 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 10) - %49 = call { i64, i1 } @"github.com/goplus/llgo/internal/runtime.CheckI2Int"(%"github.com/goplus/llgo/internal/runtime.iface" %0, ptr %48) - %50 = extractvalue { i64, i1 } %49, 0 - %51 = trunc i64 %50 to i32 - %52 = extractvalue { i64, i1 } %49, 1 - br i1 %52, label %_llgo_20, label %_llgo_21 + %156 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 0 + %157 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 10) + %158 = icmp eq ptr %156, %157 + %159 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 1 + %160 = ptrtoint ptr %159 to i64 + %161 = trunc i64 %160 to i32 + %162 = alloca { i32, i1 }, align 8 + %163 = getelementptr inbounds { i32, i1 }, ptr %162, i32 0, i32 0 + store i32 %161, ptr %163, align 4 + %164 = getelementptr inbounds { i32, i1 }, ptr %162, i32 0, i32 1 + store i1 true, ptr %164, align 1 + %165 = load { i32, i1 }, ptr %162, align 4 + %166 = alloca { i32, i1 }, align 8 + %167 = getelementptr inbounds { i32, i1 }, ptr %166, i32 0, i32 0 + store i32 0, ptr %167, align 4 + %168 = getelementptr inbounds { i32, i1 }, ptr %166, i32 0, i32 1 + store i1 false, ptr %168, align 1 + %169 = load { i32, i1 }, ptr %166, align 4 + %170 = select i1 %158, { i32, i1 } %165, { i32, i1 } %169 + %171 = extractvalue { i32, i1 } %170, 0 + %172 = extractvalue { i32, i1 } %170, 1 + br i1 %172, label %_llgo_20, label %_llgo_21 _llgo_20: ; preds = %_llgo_19 - %53 = zext i32 %51 to i64 - call void @main.printuint(i64 %53) + %173 = zext i32 %171 to i64 + call void @main.printuint(i64 %173) br label %_llgo_1 _llgo_21: ; preds = %_llgo_19 - %54 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 11) - %55 = call { i64, i1 } @"github.com/goplus/llgo/internal/runtime.CheckI2Int"(%"github.com/goplus/llgo/internal/runtime.iface" %0, ptr %54) - %56 = extractvalue { i64, i1 } %55, 0 - %57 = extractvalue { i64, i1 } %55, 1 - br i1 %57, label %_llgo_22, label %_llgo_23 + %174 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 0 + %175 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 11) + %176 = icmp eq ptr %174, %175 + %177 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 1 + %178 = ptrtoint ptr %177 to i64 + %179 = alloca { i64, i1 }, align 8 + %180 = getelementptr inbounds { i64, i1 }, ptr %179, i32 0, i32 0 + store i64 %178, ptr %180, align 4 + %181 = getelementptr inbounds { i64, i1 }, ptr %179, i32 0, i32 1 + store i1 true, ptr %181, align 1 + %182 = load { i64, i1 }, ptr %179, align 4 + %183 = alloca { i64, i1 }, align 8 + %184 = getelementptr inbounds { i64, i1 }, ptr %183, i32 0, i32 0 + store i64 0, ptr %184, align 4 + %185 = getelementptr inbounds { i64, i1 }, ptr %183, i32 0, i32 1 + store i1 false, ptr %185, align 1 + %186 = load { i64, i1 }, ptr %183, align 4 + %187 = select i1 %176, { i64, i1 } %182, { i64, i1 } %186 + %188 = extractvalue { i64, i1 } %187, 0 + %189 = extractvalue { i64, i1 } %187, 1 + br i1 %189, label %_llgo_22, label %_llgo_23 _llgo_22: ; preds = %_llgo_21 - call void @main.printuint(i64 %56) + call void @main.printuint(i64 %188) br label %_llgo_1 _llgo_23: ; preds = %_llgo_21 - %58 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 12) - %59 = call { i64, i1 } @"github.com/goplus/llgo/internal/runtime.CheckI2Int"(%"github.com/goplus/llgo/internal/runtime.iface" %0, ptr %58) - %60 = extractvalue { i64, i1 } %59, 0 - %61 = extractvalue { i64, i1 } %59, 1 - br i1 %61, label %_llgo_24, label %_llgo_25 + %190 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 0 + %191 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 12) + %192 = icmp eq ptr %190, %191 + %193 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 1 + %194 = ptrtoint ptr %193 to i64 + %195 = alloca { i64, i1 }, align 8 + %196 = getelementptr inbounds { i64, i1 }, ptr %195, i32 0, i32 0 + store i64 %194, ptr %196, align 4 + %197 = getelementptr inbounds { i64, i1 }, ptr %195, i32 0, i32 1 + store i1 true, ptr %197, align 1 + %198 = load { i64, i1 }, ptr %195, align 4 + %199 = alloca { i64, i1 }, align 8 + %200 = getelementptr inbounds { i64, i1 }, ptr %199, i32 0, i32 0 + store i64 0, ptr %200, align 4 + %201 = getelementptr inbounds { i64, i1 }, ptr %199, i32 0, i32 1 + store i1 false, ptr %201, align 1 + %202 = load { i64, i1 }, ptr %199, align 4 + %203 = select i1 %192, { i64, i1 } %198, { i64, i1 } %202 + %204 = extractvalue { i64, i1 } %203, 0 + %205 = extractvalue { i64, i1 } %203, 1 + br i1 %205, label %_llgo_24, label %_llgo_25 _llgo_24: ; preds = %_llgo_23 - call void @main.printuint(i64 %60) + call void @main.printuint(i64 %204) br label %_llgo_1 _llgo_25: ; preds = %_llgo_23 - %62 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 13) - %63 = call { i64, i1 } @"github.com/goplus/llgo/internal/runtime.CheckI2Int"(%"github.com/goplus/llgo/internal/runtime.iface" %0, ptr %62) - %64 = extractvalue { i64, i1 } %63, 0 - %65 = trunc i64 %64 to i32 - %66 = bitcast i32 %65 to float - %67 = extractvalue { i64, i1 } %63, 1 - br i1 %67, label %_llgo_26, label %_llgo_27 + %206 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 0 + %207 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 13) + %208 = icmp eq ptr %206, %207 + %209 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 1 + %210 = ptrtoint ptr %209 to i64 + %211 = bitcast i64 %210 to float + %212 = alloca { float, i1 }, align 8 + %213 = getelementptr inbounds { float, i1 }, ptr %212, i32 0, i32 0 + store float %211, ptr %213, align 4 + %214 = getelementptr inbounds { float, i1 }, ptr %212, i32 0, i32 1 + store i1 true, ptr %214, align 1 + %215 = load { float, i1 }, ptr %212, align 4 + %216 = alloca { float, i1 }, align 8 + %217 = getelementptr inbounds { float, i1 }, ptr %216, i32 0, i32 0 + store double 0.000000e+00, ptr %217, align 8 + %218 = getelementptr inbounds { float, i1 }, ptr %216, i32 0, i32 1 + store i1 false, ptr %218, align 1 + %219 = load { float, i1 }, ptr %216, align 4 + %220 = select i1 %208, { float, i1 } %215, { float, i1 } %219 + %221 = extractvalue { float, i1 } %220, 0 + %222 = extractvalue { float, i1 } %220, 1 + br i1 %222, label %_llgo_26, label %_llgo_27 _llgo_26: ; preds = %_llgo_25 - %68 = fpext float %66 to double - call void @main.printfloat(double %68) + %223 = fpext float %221 to double + call void @main.printfloat(double %223) br label %_llgo_1 _llgo_27: ; preds = %_llgo_25 - %69 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 14) - %70 = call { i64, i1 } @"github.com/goplus/llgo/internal/runtime.CheckI2Int"(%"github.com/goplus/llgo/internal/runtime.iface" %0, ptr %69) - %71 = extractvalue { i64, i1 } %70, 0 - %72 = bitcast i64 %71 to double - %73 = extractvalue { i64, i1 } %70, 1 - br i1 %73, label %_llgo_28, label %_llgo_29 + %224 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 0 + %225 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 14) + %226 = icmp eq ptr %224, %225 + %227 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 1 + %228 = ptrtoint ptr %227 to i64 + %229 = bitcast i64 %228 to double + %230 = alloca { double, i1 }, align 8 + %231 = getelementptr inbounds { double, i1 }, ptr %230, i32 0, i32 0 + store double %229, ptr %231, align 8 + %232 = getelementptr inbounds { double, i1 }, ptr %230, i32 0, i32 1 + store i1 true, ptr %232, align 1 + %233 = load { double, i1 }, ptr %230, align 8 + %234 = alloca { double, i1 }, align 8 + %235 = getelementptr inbounds { double, i1 }, ptr %234, i32 0, i32 0 + store double 0.000000e+00, ptr %235, align 8 + %236 = getelementptr inbounds { double, i1 }, ptr %234, i32 0, i32 1 + store i1 false, ptr %236, align 1 + %237 = load { double, i1 }, ptr %234, align 8 + %238 = select i1 %226, { double, i1 } %233, { double, i1 } %237 + %239 = extractvalue { double, i1 } %238, 0 + %240 = extractvalue { double, i1 } %238, 1 + br i1 %240, label %_llgo_28, label %_llgo_29 _llgo_28: ; preds = %_llgo_27 - call void @main.printfloat(double %72) + call void @main.printfloat(double %239) br label %_llgo_1 _llgo_29: ; preds = %_llgo_27 - %74 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24) - %75 = call { %"github.com/goplus/llgo/internal/runtime.String", i1 } @"github.com/goplus/llgo/internal/runtime.CheckI2String"(%"github.com/goplus/llgo/internal/runtime.iface" %0, ptr %74) - %76 = extractvalue { %"github.com/goplus/llgo/internal/runtime.String", i1 } %75, 0 - %77 = extractvalue { %"github.com/goplus/llgo/internal/runtime.String", i1 } %75, 1 - br i1 %77, label %_llgo_30, label %_llgo_1 + %241 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 0 + %242 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24) + %243 = icmp eq ptr %241, %242 + %244 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 1 + %245 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %244, align 8 + %246 = alloca { %"github.com/goplus/llgo/internal/runtime.String", i1 }, align 8 + %247 = getelementptr inbounds { %"github.com/goplus/llgo/internal/runtime.String", i1 }, ptr %246, i32 0, i32 0 + store %"github.com/goplus/llgo/internal/runtime.String" %245, ptr %247, align 8 + %248 = getelementptr inbounds { %"github.com/goplus/llgo/internal/runtime.String", i1 }, ptr %246, i32 0, i32 1 + store i1 true, ptr %248, align 1 + %249 = load { %"github.com/goplus/llgo/internal/runtime.String", i1 }, ptr %246, align 8 + %250 = alloca { %"github.com/goplus/llgo/internal/runtime.String", i1 }, align 8 + %251 = getelementptr inbounds { %"github.com/goplus/llgo/internal/runtime.String", i1 }, ptr %250, i32 0, i32 0 + store { ptr, i64 } zeroinitializer, ptr %251, align 8 + %252 = getelementptr inbounds { %"github.com/goplus/llgo/internal/runtime.String", i1 }, ptr %250, i32 0, i32 1 + store i1 false, ptr %252, align 1 + %253 = load { %"github.com/goplus/llgo/internal/runtime.String", i1 }, ptr %250, align 8 + %254 = select i1 %243, { %"github.com/goplus/llgo/internal/runtime.String", i1 } %249, { %"github.com/goplus/llgo/internal/runtime.String", i1 } %253 + %255 = extractvalue { %"github.com/goplus/llgo/internal/runtime.String", i1 } %254, 0 + %256 = extractvalue { %"github.com/goplus/llgo/internal/runtime.String", i1 } %254, 1 + br i1 %256, label %_llgo_30, label %_llgo_1 _llgo_30: ; preds = %_llgo_29 - call void @main.printstring(%"github.com/goplus/llgo/internal/runtime.String" %76) + call void @main.printstring(%"github.com/goplus/llgo/internal/runtime.String" %255) br label %_llgo_1 } @@ -756,8 +1119,8 @@ _llgo_2: ; preds = %_llgo_1 %5 = icmp slt i64 %3, 0 call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %5) %6 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %0, 0 - %7 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %6, i64 %3 - %8 = load %"github.com/goplus/llgo/internal/runtime.iface", ptr %7, align 8 + %7 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %6, i64 %3 + %8 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %7, align 8 %9 = icmp ne i64 %3, 0 br i1 %9, label %_llgo_4, label %_llgo_5 @@ -776,7 +1139,7 @@ _llgo_4: ; preds = %_llgo_2 br label %_llgo_5 _llgo_5: ; preds = %_llgo_4, %_llgo_2 - call void @main.printany(%"github.com/goplus/llgo/internal/runtime.iface" %8) + call void @main.printany(%"github.com/goplus/llgo/internal/runtime.eface" %8) br label %_llgo_1 } @@ -869,16 +1232,10 @@ declare i32 @printf(ptr, ...) declare void @"github.com/goplus/llgo/internal/runtime.init"() -declare %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyIntptr"(ptr, i64) - declare ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64) -declare %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyString"(%"github.com/goplus/llgo/internal/runtime.String") +declare ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64) declare %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr, i64, i64, i64, i64, i64) -declare { i64, i1 } @"github.com/goplus/llgo/internal/runtime.CheckI2Int"(%"github.com/goplus/llgo/internal/runtime.iface", ptr) - -declare { %"github.com/goplus/llgo/internal/runtime.String", i1 } @"github.com/goplus/llgo/internal/runtime.CheckI2String"(%"github.com/goplus/llgo/internal/runtime.iface", ptr) - declare void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1) diff --git a/cl/_testdata/vargs/out.ll b/cl/_testdata/vargs/out.ll index 86c098c9..dbb7eda8 100644 --- a/cl/_testdata/vargs/out.ll +++ b/cl/_testdata/vargs/out.ll @@ -1,13 +1,15 @@ ; ModuleID = 'main' source_filename = "main" -%"github.com/goplus/llgo/internal/runtime.iface" = type { ptr, ptr } +%"github.com/goplus/llgo/internal/runtime.eface" = type { ptr, ptr } %"github.com/goplus/llgo/internal/runtime.Slice" = type { ptr, i64, i64 } +%"github.com/goplus/llgo/internal/runtime.String" = type { ptr, i64 } @"main.init$guard" = global ptr null @__llgo_argc = global ptr null @__llgo_argv = global ptr null @0 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 +@1 = private unnamed_addr constant [22 x i8] c"type assertion failed\00", align 1 define void @main.init() { _llgo_0: @@ -29,20 +31,35 @@ _llgo_0: call void @"github.com/goplus/llgo/internal/runtime.init"() call void @main.init() %2 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 48) - %3 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %2, i64 0 + %3 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %2, i64 0 %4 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 2) - %5 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyIntptr"(ptr %4, i64 1) - store %"github.com/goplus/llgo/internal/runtime.iface" %5, ptr %3, align 8 - %6 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %2, i64 1 - %7 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 2) - %8 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyIntptr"(ptr %7, i64 2) - store %"github.com/goplus/llgo/internal/runtime.iface" %8, ptr %6, align 8 - %9 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %2, i64 2 + %5 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %6 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %5, i32 0, i32 0 + store ptr %4, ptr %6, align 8 + %7 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %5, i32 0, i32 1 + store ptr inttoptr (i64 1 to ptr), ptr %7, align 8 + %8 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %5, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %8, ptr %3, align 8 + %9 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %2, i64 1 %10 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 2) - %11 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyIntptr"(ptr %10, i64 3) - store %"github.com/goplus/llgo/internal/runtime.iface" %11, ptr %9, align 8 - %12 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %2, i64 16, i64 3, i64 0, i64 3, i64 3) - call void @main.test(%"github.com/goplus/llgo/internal/runtime.Slice" %12) + %11 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %12 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %11, i32 0, i32 0 + store ptr %10, ptr %12, align 8 + %13 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %11, i32 0, i32 1 + store ptr inttoptr (i64 2 to ptr), ptr %13, align 8 + %14 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %11, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %14, ptr %9, align 8 + %15 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %2, i64 2 + %16 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 2) + %17 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %18 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %17, i32 0, i32 0 + store ptr %16, ptr %18, align 8 + %19 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %17, i32 0, i32 1 + store ptr inttoptr (i64 3 to ptr), ptr %19, align 8 + %20 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %17, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %20, ptr %15, align 8 + %21 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %2, i64 16, i64 3, i64 0, i64 3, i64 3) + call void @main.test(%"github.com/goplus/llgo/internal/runtime.Slice" %21) ret i32 0 } @@ -51,7 +68,7 @@ _llgo_0: %1 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %0, 1 br label %_llgo_1 -_llgo_1: ; preds = %_llgo_2, %_llgo_0 +_llgo_1: ; preds = %_llgo_4, %_llgo_0 %2 = phi i64 [ -1, %_llgo_0 ], [ %3, %_llgo_2 ] %3 = add i64 %2, 1 %4 = icmp slt i64 %3, %1 @@ -61,29 +78,43 @@ _llgo_2: ; preds = %_llgo_1 %5 = icmp slt i64 %3, 0 call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %5) %6 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %0, 0 - %7 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %6, i64 %3 - %8 = load %"github.com/goplus/llgo/internal/runtime.iface", ptr %7, align 8 - %9 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 2) - %10 = call i64 @"github.com/goplus/llgo/internal/runtime.I2Int"(%"github.com/goplus/llgo/internal/runtime.iface" %8, ptr %9) - %11 = call i32 (ptr, ...) @printf(ptr @0, i64 %10) - br label %_llgo_1 + %7 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %6, i64 %3 + %8 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %7, align 8 + %9 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %8, 0 + %10 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 2) + %11 = icmp eq ptr %9, %10 + br i1 %11, label %_llgo_4, label %_llgo_5 _llgo_3: ; preds = %_llgo_1 ret void + +_llgo_4: ; preds = %_llgo_2 + %12 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %8, 1 + %13 = ptrtoint ptr %12 to i64 + %14 = call i32 (ptr, ...) @printf(ptr @0, i64 %13) + br label %_llgo_1 + +_llgo_5: ; preds = %_llgo_2 + %15 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 + %16 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %15, i32 0, i32 0 + store ptr @1, ptr %16, align 8 + %17 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %15, i32 0, i32 1 + store i64 21, ptr %17, align 4 + %18 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %15, align 8 + call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.String" %18) + unreachable } declare void @"github.com/goplus/llgo/internal/runtime.init"() declare ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64) -declare %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyIntptr"(ptr, i64) - declare ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64) declare %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr, i64, i64, i64, i64, i64) declare void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1) -declare i64 @"github.com/goplus/llgo/internal/runtime.I2Int"(%"github.com/goplus/llgo/internal/runtime.iface", ptr) +declare void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.eface") declare i32 @printf(ptr, ...) diff --git a/cl/_testrt/gotypes/in.go b/cl/_testrt/_gotypes/in.go similarity index 100% rename from cl/_testrt/gotypes/in.go rename to cl/_testrt/_gotypes/in.go diff --git a/cl/_testrt/gotypes/out.ll b/cl/_testrt/_gotypes/out.ll similarity index 100% rename from cl/_testrt/gotypes/out.ll rename to cl/_testrt/_gotypes/out.ll diff --git a/cl/_testrt/any/out.ll b/cl/_testrt/any/out.ll index fbf58289..207fc6d3 100644 --- a/cl/_testrt/any/out.ll +++ b/cl/_testrt/any/out.ll @@ -1,19 +1,37 @@ ; ModuleID = 'main' source_filename = "main" -%"github.com/goplus/llgo/internal/runtime.iface" = type { ptr, ptr } +%"github.com/goplus/llgo/internal/runtime.eface" = type { ptr, ptr } +%"github.com/goplus/llgo/internal/runtime.String" = type { ptr, i64 } @"main.init$guard" = global ptr null +@0 = private unnamed_addr constant [22 x i8] c"type assertion failed\00", align 1 @__llgo_argc = global ptr null @__llgo_argv = global ptr null -@0 = private unnamed_addr constant [10 x i8] c"Hello %d\0A\00", align 1 +@1 = private unnamed_addr constant [10 x i8] c"Hello %d\0A\00", align 1 -define i64 @main.incVal(%"github.com/goplus/llgo/internal/runtime.iface" %0) { +define i64 @main.incVal(%"github.com/goplus/llgo/internal/runtime.eface" %0) { _llgo_0: - %1 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 2) - %2 = call i64 @"github.com/goplus/llgo/internal/runtime.I2Int"(%"github.com/goplus/llgo/internal/runtime.iface" %0, ptr %1) - %3 = add i64 %2, 1 - ret i64 %3 + %1 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 0 + %2 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 2) + %3 = icmp eq ptr %1, %2 + br i1 %3, label %_llgo_1, label %_llgo_2 + +_llgo_1: ; preds = %_llgo_0 + %4 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 1 + %5 = ptrtoint ptr %4 to i64 + %6 = add i64 %5, 1 + ret i64 %6 + +_llgo_2: ; preds = %_llgo_0 + %7 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 + %8 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %7, i32 0, i32 0 + store ptr @0, ptr %8, align 8 + %9 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %7, i32 0, i32 1 + store i64 21, ptr %9, align 4 + %10 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %7, align 8 + call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.String" %10) + unreachable } define void @main.init() { @@ -36,18 +54,21 @@ _llgo_0: call void @"github.com/goplus/llgo/internal/runtime.init"() call void @main.init() %2 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 2) - %3 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyIntptr"(ptr %2, i64 100) - %4 = call i64 @main.incVal(%"github.com/goplus/llgo/internal/runtime.iface" %3) - %5 = call i32 (ptr, ...) @printf(ptr @0, i64 %4) + %3 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %4 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %3, i32 0, i32 0 + store ptr %2, ptr %4, align 8 + %5 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %3, i32 0, i32 1 + store ptr inttoptr (i64 100 to ptr), ptr %5, align 8 + %6 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %3, align 8 + %7 = call i64 @main.incVal(%"github.com/goplus/llgo/internal/runtime.eface" %6) + %8 = call i32 (ptr, ...) @printf(ptr @1, i64 %7) ret i32 0 } -declare i64 @"github.com/goplus/llgo/internal/runtime.I2Int"(%"github.com/goplus/llgo/internal/runtime.iface", ptr) - declare ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64) +declare void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.eface") + declare void @"github.com/goplus/llgo/internal/runtime.init"() -declare %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyIntptr"(ptr, i64) - declare i32 @printf(ptr, ...) diff --git a/cl/_testrt/builtin/out.ll b/cl/_testrt/builtin/out.ll index c921f898..9ff25dda 100644 --- a/cl/_testrt/builtin/out.ll +++ b/cl/_testrt/builtin/out.ll @@ -3,7 +3,7 @@ source_filename = "main" %"github.com/goplus/llgo/internal/runtime.Slice" = type { ptr, i64, i64 } %"github.com/goplus/llgo/internal/runtime.String" = type { ptr, i64 } -%"github.com/goplus/llgo/internal/runtime.iface" = type { ptr, ptr } +%"github.com/goplus/llgo/internal/runtime.eface" = type { ptr, ptr } @main.a = global ptr null @main.b = global ptr null @@ -242,10 +242,15 @@ _llgo_0: call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10) %107 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 16) %108 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 2) - %109 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyIntptr"(ptr %108, i64 100) - store %"github.com/goplus/llgo/internal/runtime.iface" %109, ptr %107, align 8 - %110 = load %"github.com/goplus/llgo/internal/runtime.iface", ptr %107, align 8 - %111 = ptrtoint ptr %107 to i64 + %109 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %110 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %109, i32 0, i32 0 + store ptr %108, ptr %110, align 8 + %111 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %109, i32 0, i32 1 + store ptr inttoptr (i64 100 to ptr), ptr %111, align 8 + %112 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %109, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %112, ptr %107, align 8 + %113 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %107, align 8 + %114 = ptrtoint ptr %107 to i64 call void @"github.com/goplus/llgo/internal/runtime.PrintBool"(i1 true) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 0) @@ -262,83 +267,83 @@ _llgo_0: call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) call void @"github.com/goplus/llgo/internal/runtime.PrintFloat"(double 1.005000e+02) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) - call void @"github.com/goplus/llgo/internal/runtime.PrintIface"(%"github.com/goplus/llgo/internal/runtime.iface" %110) + call void @"github.com/goplus/llgo/internal/runtime.PrintEface"(%"github.com/goplus/llgo/internal/runtime.eface" %113) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) call void @"github.com/goplus/llgo/internal/runtime.PrintPointer"(ptr %107) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) - call void @"github.com/goplus/llgo/internal/runtime.PrintUint"(i64 %111) + call void @"github.com/goplus/llgo/internal/runtime.PrintUint"(i64 %114) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10) - %112 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 3) - %113 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 8) - %114 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %112, i64 1, i64 3, i64 0, i64 3, i64 3) - %115 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %106, 0 - %116 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %106, 1 - %117 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCopy"(%"github.com/goplus/llgo/internal/runtime.Slice" %114, ptr %115, i64 %116, i64 1) - store i64 %117, ptr %113, align 4 - %118 = load i64, ptr %113, align 4 - %119 = getelementptr inbounds i8, ptr %112, i64 0 - %120 = load i8, ptr %119, align 1 - %121 = getelementptr inbounds i8, ptr %112, i64 1 - %122 = load i8, ptr %121, align 1 - %123 = getelementptr inbounds i8, ptr %112, i64 2 - %124 = load i8, ptr %123, align 1 - call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %118) + %115 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 3) + %116 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 8) + %117 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %115, i64 1, i64 3, i64 0, i64 3, i64 3) + %118 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %106, 0 + %119 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %106, 1 + %120 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCopy"(%"github.com/goplus/llgo/internal/runtime.Slice" %117, ptr %118, i64 %119, i64 1) + store i64 %120, ptr %116, align 4 + %121 = load i64, ptr %116, align 4 + %122 = getelementptr inbounds i8, ptr %115, i64 0 + %123 = load i8, ptr %122, align 1 + %124 = getelementptr inbounds i8, ptr %115, i64 1 + %125 = load i8, ptr %124, align 1 + %126 = getelementptr inbounds i8, ptr %115, i64 2 + %127 = load i8, ptr %126, align 1 + call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %121) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) - %125 = zext i8 %120 to i64 - call void @"github.com/goplus/llgo/internal/runtime.PrintUint"(i64 %125) + %128 = zext i8 %123 to i64 + call void @"github.com/goplus/llgo/internal/runtime.PrintUint"(i64 %128) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) - %126 = zext i8 %122 to i64 - call void @"github.com/goplus/llgo/internal/runtime.PrintUint"(i64 %126) + %129 = zext i8 %125 to i64 + call void @"github.com/goplus/llgo/internal/runtime.PrintUint"(i64 %129) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) - %127 = zext i8 %124 to i64 - call void @"github.com/goplus/llgo/internal/runtime.PrintUint"(i64 %127) + %130 = zext i8 %127 to i64 + call void @"github.com/goplus/llgo/internal/runtime.PrintUint"(i64 %130) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10) - %128 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %112, i64 1, i64 3, i64 1, i64 3, i64 3) - %129 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %130 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %129, i32 0, i32 0 - store ptr @5, ptr %130, align 8 - %131 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %129, i32 0, i32 1 - store i64 4, ptr %131, align 4 - %132 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %129, align 8 - %133 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %132, 0 - %134 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %132, 1 - %135 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCopy"(%"github.com/goplus/llgo/internal/runtime.Slice" %128, ptr %133, i64 %134, i64 1) - store i64 %135, ptr %113, align 4 - %136 = load i64, ptr %113, align 4 - %137 = getelementptr inbounds i8, ptr %112, i64 0 - %138 = load i8, ptr %137, align 1 - %139 = getelementptr inbounds i8, ptr %112, i64 1 - %140 = load i8, ptr %139, align 1 - %141 = getelementptr inbounds i8, ptr %112, i64 2 - %142 = load i8, ptr %141, align 1 - call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %136) + %131 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %115, i64 1, i64 3, i64 1, i64 3, i64 3) + %132 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 + %133 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %132, i32 0, i32 0 + store ptr @5, ptr %133, align 8 + %134 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %132, i32 0, i32 1 + store i64 4, ptr %134, align 4 + %135 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %132, align 8 + %136 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %135, 0 + %137 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %135, 1 + %138 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCopy"(%"github.com/goplus/llgo/internal/runtime.Slice" %131, ptr %136, i64 %137, i64 1) + store i64 %138, ptr %116, align 4 + %139 = load i64, ptr %116, align 4 + %140 = getelementptr inbounds i8, ptr %115, i64 0 + %141 = load i8, ptr %140, align 1 + %142 = getelementptr inbounds i8, ptr %115, i64 1 + %143 = load i8, ptr %142, align 1 + %144 = getelementptr inbounds i8, ptr %115, i64 2 + %145 = load i8, ptr %144, align 1 + call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %139) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) - %143 = zext i8 %138 to i64 - call void @"github.com/goplus/llgo/internal/runtime.PrintUint"(i64 %143) + %146 = zext i8 %141 to i64 + call void @"github.com/goplus/llgo/internal/runtime.PrintUint"(i64 %146) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) - %144 = zext i8 %140 to i64 - call void @"github.com/goplus/llgo/internal/runtime.PrintUint"(i64 %144) + %147 = zext i8 %143 to i64 + call void @"github.com/goplus/llgo/internal/runtime.PrintUint"(i64 %147) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) - %145 = zext i8 %142 to i64 - call void @"github.com/goplus/llgo/internal/runtime.PrintUint"(i64 %145) + %148 = zext i8 %145 to i64 + call void @"github.com/goplus/llgo/internal/runtime.PrintUint"(i64 %148) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10) - %146 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 8) - %147 = getelementptr inbounds { ptr }, ptr %146, i32 0, i32 0 - store ptr %113, ptr %147, align 8 - %148 = alloca { ptr, ptr }, align 8 - %149 = getelementptr inbounds { ptr, ptr }, ptr %148, i32 0, i32 0 - store ptr @"main.main$2", ptr %149, align 8 - %150 = getelementptr inbounds { ptr, ptr }, ptr %148, i32 0, i32 1 - store ptr %146, ptr %150, align 8 - %151 = load { ptr, ptr }, ptr %148, align 8 + %149 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 8) + %150 = getelementptr inbounds { ptr }, ptr %149, i32 0, i32 0 + store ptr %116, ptr %150, align 8 + %151 = alloca { ptr, ptr }, align 8 + %152 = getelementptr inbounds { ptr, ptr }, ptr %151, i32 0, i32 0 + store ptr @"main.main$2", ptr %152, align 8 + %153 = getelementptr inbounds { ptr, ptr }, ptr %151, i32 0, i32 1 + store ptr %149, ptr %153, align 8 + %154 = load { ptr, ptr }, ptr %151, align 8 call void @"github.com/goplus/llgo/internal/runtime.PrintPointer"(ptr @main.demo) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) call void @"github.com/goplus/llgo/internal/runtime.PrintPointer"(ptr @main.demo) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) call void @"github.com/goplus/llgo/internal/runtime.PrintPointer"(ptr @"main.main$1") call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) - %152 = extractvalue { ptr, ptr } %151, 0 - call void @"github.com/goplus/llgo/internal/runtime.PrintPointer"(ptr %152) + %155 = extractvalue { ptr, ptr } %154, 0 + call void @"github.com/goplus/llgo/internal/runtime.PrintPointer"(ptr %155) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10) ret i32 0 } @@ -361,8 +366,6 @@ declare void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com declare %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.SliceAppend"(%"github.com/goplus/llgo/internal/runtime.Slice", ptr, i64, i64) -declare %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyIntptr"(ptr, i64) - declare ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64) declare void @"github.com/goplus/llgo/internal/runtime.PrintBool"(i1) @@ -371,7 +374,7 @@ declare void @"github.com/goplus/llgo/internal/runtime.PrintUint"(i64) declare void @"github.com/goplus/llgo/internal/runtime.PrintFloat"(double) -declare void @"github.com/goplus/llgo/internal/runtime.PrintIface"(%"github.com/goplus/llgo/internal/runtime.iface") +declare void @"github.com/goplus/llgo/internal/runtime.PrintEface"(%"github.com/goplus/llgo/internal/runtime.eface") declare void @"github.com/goplus/llgo/internal/runtime.PrintPointer"(ptr) diff --git a/cl/_testrt/cast/out.ll b/cl/_testrt/cast/out.ll index b6739dbb..794eea9e 100644 --- a/cl/_testrt/cast/out.ll +++ b/cl/_testrt/cast/out.ll @@ -2,7 +2,7 @@ source_filename = "main" %"github.com/goplus/llgo/internal/runtime.String" = type { ptr, i64 } -%"github.com/goplus/llgo/internal/runtime.iface" = type { ptr, ptr } +%"github.com/goplus/llgo/internal/runtime.eface" = type { ptr, ptr } @"main.init$guard" = global ptr null @0 = private unnamed_addr constant [6 x i8] c"error\00", align 1 @@ -34,8 +34,16 @@ _llgo_1: ; preds = %_llgo_0 %6 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %4, i32 0, i32 1 store i64 5, ptr %6, align 4 %7 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %4, align 8 - %8 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyString"(%"github.com/goplus/llgo/internal/runtime.String" %7) - call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.iface" %8) + %8 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24) + %9 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16) + store %"github.com/goplus/llgo/internal/runtime.String" %7, ptr %9, align 8 + %10 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %11 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, i32 0, i32 0 + store ptr %8, ptr %11, align 8 + %12 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, i32 0, i32 1 + store ptr %9, ptr %12, align 8 + %13 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, align 8 + call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.eface" %13) unreachable _llgo_2: ; preds = %_llgo_0 @@ -55,8 +63,16 @@ _llgo_1: ; preds = %_llgo_0 %6 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %4, i32 0, i32 1 store i64 5, ptr %6, align 4 %7 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %4, align 8 - %8 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyString"(%"github.com/goplus/llgo/internal/runtime.String" %7) - call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.iface" %8) + %8 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24) + %9 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16) + store %"github.com/goplus/llgo/internal/runtime.String" %7, ptr %9, align 8 + %10 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %11 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, i32 0, i32 0 + store ptr %8, ptr %11, align 8 + %12 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, i32 0, i32 1 + store ptr %9, ptr %12, align 8 + %13 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, align 8 + call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.eface" %13) unreachable _llgo_2: ; preds = %_llgo_0 @@ -76,8 +92,16 @@ _llgo_1: ; preds = %_llgo_0 %6 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %4, i32 0, i32 1 store i64 5, ptr %6, align 4 %7 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %4, align 8 - %8 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyString"(%"github.com/goplus/llgo/internal/runtime.String" %7) - call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.iface" %8) + %8 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24) + %9 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16) + store %"github.com/goplus/llgo/internal/runtime.String" %7, ptr %9, align 8 + %10 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %11 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, i32 0, i32 0 + store ptr %8, ptr %11, align 8 + %12 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, i32 0, i32 1 + store ptr %9, ptr %12, align 8 + %13 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, align 8 + call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.eface" %13) unreachable _llgo_2: ; preds = %_llgo_0 @@ -97,8 +121,16 @@ _llgo_1: ; preds = %_llgo_0 %6 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %4, i32 0, i32 1 store i64 5, ptr %6, align 4 %7 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %4, align 8 - %8 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyString"(%"github.com/goplus/llgo/internal/runtime.String" %7) - call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.iface" %8) + %8 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24) + %9 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16) + store %"github.com/goplus/llgo/internal/runtime.String" %7, ptr %9, align 8 + %10 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %11 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, i32 0, i32 0 + store ptr %8, ptr %11, align 8 + %12 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, i32 0, i32 1 + store ptr %9, ptr %12, align 8 + %13 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, align 8 + call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.eface" %13) unreachable _llgo_2: ; preds = %_llgo_0 @@ -118,8 +150,16 @@ _llgo_1: ; preds = %_llgo_0 %6 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %4, i32 0, i32 1 store i64 5, ptr %6, align 4 %7 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %4, align 8 - %8 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyString"(%"github.com/goplus/llgo/internal/runtime.String" %7) - call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.iface" %8) + %8 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24) + %9 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16) + store %"github.com/goplus/llgo/internal/runtime.String" %7, ptr %9, align 8 + %10 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %11 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, i32 0, i32 0 + store ptr %8, ptr %11, align 8 + %12 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, i32 0, i32 1 + store ptr %9, ptr %12, align 8 + %13 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, align 8 + call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.eface" %13) unreachable _llgo_2: ; preds = %_llgo_0 @@ -139,8 +179,16 @@ _llgo_1: ; preds = %_llgo_0 %6 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %4, i32 0, i32 1 store i64 5, ptr %6, align 4 %7 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %4, align 8 - %8 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyString"(%"github.com/goplus/llgo/internal/runtime.String" %7) - call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.iface" %8) + %8 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24) + %9 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16) + store %"github.com/goplus/llgo/internal/runtime.String" %7, ptr %9, align 8 + %10 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %11 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, i32 0, i32 0 + store ptr %8, ptr %11, align 8 + %12 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, i32 0, i32 1 + store ptr %9, ptr %12, align 8 + %13 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, align 8 + call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.eface" %13) unreachable _llgo_2: ; preds = %_llgo_0 @@ -160,8 +208,16 @@ _llgo_1: ; preds = %_llgo_0 %6 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %4, i32 0, i32 1 store i64 5, ptr %6, align 4 %7 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %4, align 8 - %8 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyString"(%"github.com/goplus/llgo/internal/runtime.String" %7) - call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.iface" %8) + %8 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24) + %9 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16) + store %"github.com/goplus/llgo/internal/runtime.String" %7, ptr %9, align 8 + %10 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %11 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, i32 0, i32 0 + store ptr %8, ptr %11, align 8 + %12 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, i32 0, i32 1 + store ptr %9, ptr %12, align 8 + %13 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, align 8 + call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.eface" %13) unreachable _llgo_2: ; preds = %_llgo_0 @@ -181,8 +237,16 @@ _llgo_1: ; preds = %_llgo_0 %6 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %4, i32 0, i32 1 store i64 5, ptr %6, align 4 %7 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %4, align 8 - %8 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyString"(%"github.com/goplus/llgo/internal/runtime.String" %7) - call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.iface" %8) + %8 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24) + %9 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16) + store %"github.com/goplus/llgo/internal/runtime.String" %7, ptr %9, align 8 + %10 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %11 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, i32 0, i32 0 + store ptr %8, ptr %11, align 8 + %12 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, i32 0, i32 1 + store ptr %9, ptr %12, align 8 + %13 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, align 8 + call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.eface" %13) unreachable _llgo_2: ; preds = %_llgo_0 @@ -202,8 +266,16 @@ _llgo_1: ; preds = %_llgo_0 %6 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %4, i32 0, i32 1 store i64 5, ptr %6, align 4 %7 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %4, align 8 - %8 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyString"(%"github.com/goplus/llgo/internal/runtime.String" %7) - call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.iface" %8) + %8 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24) + %9 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16) + store %"github.com/goplus/llgo/internal/runtime.String" %7, ptr %9, align 8 + %10 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %11 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, i32 0, i32 0 + store ptr %8, ptr %11, align 8 + %12 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, i32 0, i32 1 + store ptr %9, ptr %12, align 8 + %13 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, align 8 + call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.eface" %13) unreachable _llgo_2: ; preds = %_llgo_0 @@ -223,8 +295,16 @@ _llgo_1: ; preds = %_llgo_0 %6 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %4, i32 0, i32 1 store i64 5, ptr %6, align 4 %7 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %4, align 8 - %8 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyString"(%"github.com/goplus/llgo/internal/runtime.String" %7) - call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.iface" %8) + %8 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24) + %9 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16) + store %"github.com/goplus/llgo/internal/runtime.String" %7, ptr %9, align 8 + %10 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %11 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, i32 0, i32 0 + store ptr %8, ptr %11, align 8 + %12 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, i32 0, i32 1 + store ptr %9, ptr %12, align 8 + %13 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, align 8 + call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.eface" %13) unreachable _llgo_2: ; preds = %_llgo_0 @@ -244,8 +324,16 @@ _llgo_1: ; preds = %_llgo_0 %6 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %4, i32 0, i32 1 store i64 5, ptr %6, align 4 %7 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %4, align 8 - %8 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyString"(%"github.com/goplus/llgo/internal/runtime.String" %7) - call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.iface" %8) + %8 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24) + %9 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16) + store %"github.com/goplus/llgo/internal/runtime.String" %7, ptr %9, align 8 + %10 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %11 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, i32 0, i32 0 + store ptr %8, ptr %11, align 8 + %12 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, i32 0, i32 1 + store ptr %9, ptr %12, align 8 + %13 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, align 8 + call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.eface" %13) unreachable _llgo_2: ; preds = %_llgo_0 @@ -265,24 +353,40 @@ _llgo_1: ; preds = %_llgo_0 %6 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %4, i32 0, i32 1 store i64 5, ptr %6, align 4 %7 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %4, align 8 - %8 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyString"(%"github.com/goplus/llgo/internal/runtime.String" %7) - call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.iface" %8) + %8 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24) + %9 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16) + store %"github.com/goplus/llgo/internal/runtime.String" %7, ptr %9, align 8 + %10 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %11 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, i32 0, i32 0 + store ptr %8, ptr %11, align 8 + %12 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, i32 0, i32 1 + store ptr %9, ptr %12, align 8 + %13 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, align 8 + call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.eface" %13) unreachable _llgo_2: ; preds = %_llgo_0 - %9 = trunc i64 %1 to i32 - %10 = icmp ne i32 %9, %0 - br i1 %10, label %_llgo_3, label %_llgo_4 + %14 = trunc i64 %1 to i32 + %15 = icmp ne i32 %14, %0 + br i1 %15, label %_llgo_3, label %_llgo_4 _llgo_3: ; preds = %_llgo_2 - %11 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %12 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %11, i32 0, i32 0 - store ptr @12, ptr %12, align 8 - %13 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %11, i32 0, i32 1 - store i64 5, ptr %13, align 4 - %14 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %11, align 8 - %15 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyString"(%"github.com/goplus/llgo/internal/runtime.String" %14) - call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.iface" %15) + %16 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 + %17 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %16, i32 0, i32 0 + store ptr @12, ptr %17, align 8 + %18 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %16, i32 0, i32 1 + store i64 5, ptr %18, align 4 + %19 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %16, align 8 + %20 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24) + %21 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16) + store %"github.com/goplus/llgo/internal/runtime.String" %19, ptr %21, align 8 + %22 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %23 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %22, i32 0, i32 0 + store ptr %20, ptr %23, align 8 + %24 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %22, i32 0, i32 1 + store ptr %21, ptr %24, align 8 + %25 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %22, align 8 + call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.eface" %25) unreachable _llgo_4: ; preds = %_llgo_2 @@ -366,8 +470,10 @@ _llgo_0: ret i32 0 } -declare %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyString"(%"github.com/goplus/llgo/internal/runtime.String") +declare ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64) -declare void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.iface") +declare ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64) + +declare void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.eface") declare void @"github.com/goplus/llgo/internal/runtime.init"() diff --git a/cl/_testrt/panic/out.ll b/cl/_testrt/panic/out.ll index f8923d33..362b3bb2 100644 --- a/cl/_testrt/panic/out.ll +++ b/cl/_testrt/panic/out.ll @@ -2,7 +2,7 @@ source_filename = "main" %"github.com/goplus/llgo/internal/runtime.String" = type { ptr, i64 } -%"github.com/goplus/llgo/internal/runtime.iface" = type { ptr, ptr } +%"github.com/goplus/llgo/internal/runtime.eface" = type { ptr, ptr } @"main.init$guard" = global ptr null @__llgo_argc = global ptr null @@ -34,13 +34,23 @@ _llgo_0: %4 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %2, i32 0, i32 1 store i64 13, ptr %4, align 4 %5 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %2, align 8 - %6 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyString"(%"github.com/goplus/llgo/internal/runtime.String" %5) - call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.iface" %6) + %6 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24) + %7 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16) + store %"github.com/goplus/llgo/internal/runtime.String" %5, ptr %7, align 8 + %8 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %9 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %8, i32 0, i32 0 + store ptr %6, ptr %9, align 8 + %10 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %8, i32 0, i32 1 + store ptr %7, ptr %10, align 8 + %11 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %8, align 8 + call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.eface" %11) unreachable } declare void @"github.com/goplus/llgo/internal/runtime.init"() -declare %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyString"(%"github.com/goplus/llgo/internal/runtime.String") +declare ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64) -declare void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.iface") +declare ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64) + +declare void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.eface") diff --git a/internal/abi/llgo_autogen.lla b/internal/abi/llgo_autogen.lla index 505458a8..def779e5 100644 Binary files a/internal/abi/llgo_autogen.lla and b/internal/abi/llgo_autogen.lla differ diff --git a/internal/runtime/llgo_autogen.lla b/internal/runtime/llgo_autogen.lla index 3bb1386b..d0d0e4d2 100644 Binary files a/internal/runtime/llgo_autogen.lla and b/internal/runtime/llgo_autogen.lla differ diff --git a/ssa/abi/abi.go b/ssa/abi/abi.go index 05b09df6..042755f8 100644 --- a/ssa/abi/abi.go +++ b/ssa/abi/abi.go @@ -22,10 +22,25 @@ import ( "fmt" "go/types" "hash" + + "github.com/goplus/llgo/internal/abi" ) // ----------------------------------------------------------------------------- +func BasicKind(t *types.Basic) abi.Kind { + kind := t.Kind() + switch kind { + case types.String: + return abi.String + case types.UnsafePointer: + return abi.UnsafePointer + } + return abi.Kind(kind) +} + +// ----------------------------------------------------------------------------- + type Kind int const ( diff --git a/ssa/interface.go b/ssa/interface.go index 75958cbb..bc4fb6e2 100644 --- a/ssa/interface.go +++ b/ssa/interface.go @@ -36,7 +36,8 @@ func (b Builder) abiBasic(t *types.Basic) Expr { g := b.Pkg.NewVarFrom(name, b.Prog.AbiTypePtrPtr()) return b.Load(g.Expr) */ - return b.InlineCall(b.Pkg.rtFunc("Basic"), b.Prog.Val(int(t.Kind()))) + kind := int(abi.BasicKind(t)) + return b.InlineCall(b.Pkg.rtFunc("Basic"), b.Prog.Val(kind)) } // abiStruct returns the abi type of the specified struct type.