diff --git a/cl/_testdata/print/out.ll b/cl/_testdata/print/out.ll index 3288ef27..4b2285c6 100644 --- a/cl/_testdata/print/out.ll +++ b/cl/_testdata/print/out.ll @@ -151,204 +151,225 @@ _llgo_1: ; preds = %_llgo_3 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) + %34 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8 + %35 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %34, i32 0, i32 0 + store ptr %16, ptr %35, align 8 + %36 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %34, i32 0, i32 1 + store i64 2, ptr %36, align 4 + %37 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %34, i32 0, i32 2 + store i64 2, ptr %37, align 4 + %38 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %34, align 8 + call void @main.println(%"github.com/goplus/llgo/internal/runtime.Slice" %38) br label %_llgo_2 _llgo_2: ; preds = %_llgo_3, %_llgo_1, %_llgo_0 - %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) + %39 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 48) + %40 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %39, i64 0 + %41 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 + %42 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %41, i32 0, i32 0 + store ptr @3, ptr %42, align 8 + %43 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %41, i32 0, i32 1 + store i64 8, ptr %43, align 4 + %44 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %41, align 8 + %45 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24) + %46 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16) + store %"github.com/goplus/llgo/internal/runtime.String" %44, ptr %46, align 8 + %47 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %48 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %47, i32 0, i32 0 + store ptr %45, ptr %48, align 8 + %49 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %47, i32 0, i32 1 + store ptr %46, ptr %49, align 8 + %50 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %47, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %50, ptr %40, align 8 + %51 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %39, i64 1 + %52 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 1) + %53 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %54 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %53, i32 0, i32 0 + store ptr %52, ptr %54, align 8 + %55 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %53, i32 0, i32 1 + store ptr inttoptr (i64 -1 to ptr), ptr %55, align 8 + %56 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %53, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %56, ptr %51, align 8 + %57 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %39, i64 2 + %58 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 1) + %59 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %60 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %59, i32 0, i32 0 + store ptr %58, ptr %60, align 8 + %61 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %59, i32 0, i32 1 + store ptr inttoptr (i64 -1 to ptr), ptr %61, align 8 + %62 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %59, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %62, ptr %57, align 8 + %63 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8 + %64 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %63, i32 0, i32 0 + store ptr %39, ptr %64, align 8 + %65 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %63, i32 0, i32 1 + store i64 3, ptr %65, align 4 + %66 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %63, i32 0, i32 2 + store i64 3, ptr %66, align 4 + %67 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %63, align 8 + call void @main.println(%"github.com/goplus/llgo/internal/runtime.Slice" %67) + %68 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 256) + %69 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %68, i64 0 + %70 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 1) + %71 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %72 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %71, i32 0, i32 0 + store ptr %70, ptr %72, align 8 + %73 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %71, i32 0, i32 1 + store ptr inttoptr (i64 -1 to ptr), ptr %73, align 8 + %74 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %71, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %74, ptr %69, align 8 + %75 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %68, i64 1 + %76 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 1) + %77 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %78 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %77, i32 0, i32 0 + store ptr %76, ptr %78, align 8 + %79 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %77, i32 0, i32 1 + store ptr null, ptr %79, align 8 + %80 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %77, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %80, ptr %75, align 8 + %81 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %68, i64 2 + %82 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 5) + %83 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %84 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %83, i32 0, i32 0 + store ptr %82, ptr %84, align 8 + %85 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %83, i32 0, i32 1 + store ptr inttoptr (i64 97 to ptr), ptr %85, align 8 + %86 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %83, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %86, ptr %81, align 8 + %87 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %68, i64 3 + %88 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 5) + %89 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %90 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %89, i32 0, i32 0 + store ptr %88, ptr %90, align 8 + %91 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %89, i32 0, i32 1 + store ptr inttoptr (i64 65 to ptr), ptr %91, align 8 + %92 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %89, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %92, ptr %87, align 8 + %93 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %68, i64 4 + %94 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 5) + %95 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %96 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %95, i32 0, i32 0 + store ptr %94, ptr %96, align 8 + %97 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %95, i32 0, i32 1 + store ptr inttoptr (i64 20013 to ptr), ptr %97, align 8 + %98 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %95, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %98, ptr %93, align 8 + %99 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %68, i64 5 + %100 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 3) + %101 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %102 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %101, i32 0, i32 0 + store ptr %100, ptr %102, align 8 + %103 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %101, i32 0, i32 1 + store ptr inttoptr (i64 1 to ptr), ptr %103, align 8 + %104 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %101, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %104, ptr %99, align 8 + %105 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %68, i64 6 + %106 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 4) + %107 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %108 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %107, i32 0, i32 0 + store ptr %106, ptr %108, align 8 + %109 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %107, i32 0, i32 1 + store ptr inttoptr (i64 2 to ptr), ptr %109, align 8 + %110 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %107, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %110, ptr %105, align 8 + %111 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %68, i64 7 + %112 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 5) + %113 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %114 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %113, i32 0, i32 0 + store ptr %112, ptr %114, align 8 + %115 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %113, i32 0, i32 1 + store ptr inttoptr (i64 3 to ptr), ptr %115, align 8 + %116 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %113, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %116, ptr %111, align 8 + %117 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %68, i64 8 + %118 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 6) + %119 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %120 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %119, i32 0, i32 0 + store ptr %118, ptr %120, align 8 + %121 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %119, i32 0, i32 1 + store ptr inttoptr (i64 4 to ptr), ptr %121, align 8 + %122 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %119, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %122, ptr %117, align 8 + %123 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %68, i64 9 + %124 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 2) + %125 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %126 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %125, i32 0, i32 0 + store ptr %124, ptr %126, align 8 + %127 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %125, i32 0, i32 1 + store ptr inttoptr (i64 5 to ptr), ptr %127, align 8 + %128 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %125, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %128, ptr %123, align 8 + %129 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %68, i64 10 + %130 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 8) + %131 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %132 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %131, i32 0, i32 0 + store ptr %130, ptr %132, align 8 + %133 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %131, i32 0, i32 1 + store ptr inttoptr (i64 1 to ptr), ptr %133, align 8 + %134 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %131, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %134, ptr %129, align 8 + %135 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %68, i64 11 + %136 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 9) + %137 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %138 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %137, i32 0, i32 0 + store ptr %136, ptr %138, align 8 + %139 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %137, i32 0, i32 1 + store ptr inttoptr (i64 2 to ptr), ptr %139, align 8 + %140 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %137, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %140, ptr %135, align 8 + %141 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %68, i64 12 + %142 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 10) + %143 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %144 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %143, i32 0, i32 0 + store ptr %142, ptr %144, align 8 + %145 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %143, i32 0, i32 1 + store ptr inttoptr (i64 3 to ptr), ptr %145, align 8 + %146 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %143, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %146, ptr %141, align 8 + %147 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %68, i64 13 + %148 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 11) + %149 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %150 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %149, i32 0, i32 0 + store ptr %148, ptr %150, align 8 + %151 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %149, i32 0, i32 1 + store ptr inttoptr (i64 4 to ptr), ptr %151, align 8 + %152 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %149, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %152, ptr %147, align 8 + %153 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %68, i64 14 + %154 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 12) + %155 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %156 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %155, i32 0, i32 0 + store ptr %154, ptr %156, align 8 + %157 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %155, i32 0, i32 1 + store ptr inttoptr (i64 5 to ptr), ptr %157, align 8 + %158 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %155, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %158, ptr %153, align 8 + %159 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %68, i64 15 + %160 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 + %161 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %160, i32 0, i32 0 + store ptr @4, ptr %161, align 8 + %162 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %160, i32 0, i32 1 + store i64 4, ptr %162, align 4 + %163 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %160, align 8 + %164 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24) + %165 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16) + store %"github.com/goplus/llgo/internal/runtime.String" %163, ptr %165, align 8 + %166 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %167 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %166, i32 0, i32 0 + store ptr %164, ptr %167, align 8 + %168 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %166, i32 0, i32 1 + store ptr %165, ptr %168, align 8 + %169 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %166, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %169, ptr %159, align 8 + %170 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8 + %171 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %170, i32 0, i32 0 + store ptr %68, ptr %171, align 8 + %172 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %170, i32 0, i32 1 + store i64 16, ptr %172, align 4 + %173 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %170, i32 0, i32 2 + store i64 16, ptr %173, align 4 + %174 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %170, align 8 + call void @main.println(%"github.com/goplus/llgo/internal/runtime.Slice" %174) ret i32 0 _llgo_3: ; preds = %_llgo_0 @@ -1021,8 +1042,15 @@ _llgo_29: ; preds = %_llgo_28, %_llgo_26 %86 = add i8 %85, 48 %87 = getelementptr inbounds i8, ptr %20, i64 13 store i8 %86, ptr %87, align 1 - %88 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %20, i64 1, i64 14, i64 0, i64 14, i64 14) - call void @main.gwrite(%"github.com/goplus/llgo/internal/runtime.Slice" %88) + %88 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8 + %89 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %88, i32 0, i32 0 + store ptr %20, ptr %89, align 8 + %90 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %88, i32 0, i32 1 + store i64 14, ptr %90, align 4 + %91 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %88, i32 0, i32 2 + store i64 14, ptr %91, align 4 + %92 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %88, align 8 + call void @main.gwrite(%"github.com/goplus/llgo/internal/runtime.Slice" %92) ret void } @@ -1236,6 +1264,6 @@ declare ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64) 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 void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1) + +declare %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr, i64, i64, i64, i64, i64) diff --git a/cl/_testdata/vargs/out.ll b/cl/_testdata/vargs/out.ll index dbb7eda8..9d9d841e 100644 --- a/cl/_testdata/vargs/out.ll +++ b/cl/_testdata/vargs/out.ll @@ -58,8 +58,15 @@ _llgo_0: 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) + %21 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8 + %22 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %21, i32 0, i32 0 + store ptr %2, ptr %22, align 8 + %23 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %21, i32 0, i32 1 + store i64 3, ptr %23, align 4 + %24 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %21, i32 0, i32 2 + store i64 3, ptr %24, align 4 + %25 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %21, align 8 + call void @main.test(%"github.com/goplus/llgo/internal/runtime.Slice" %25) ret i32 0 } @@ -69,7 +76,7 @@ _llgo_0: br label %_llgo_1 _llgo_1: ; preds = %_llgo_4, %_llgo_0 - %2 = phi i64 [ -1, %_llgo_0 ], [ %3, %_llgo_2 ] + %2 = phi i64 [ -1, %_llgo_0 ], [ %3, %_llgo_4 ] %3 = add i64 %2, 1 %4 = icmp slt i64 %3, %1 br i1 %4, label %_llgo_2, label %_llgo_3 @@ -111,8 +118,6 @@ declare ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(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 void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.eface") diff --git a/cl/_testrt/builtin/out.ll b/cl/_testrt/builtin/out.ll index 9ff25dda..d6c806f3 100644 --- a/cl/_testrt/builtin/out.ll +++ b/cl/_testrt/builtin/out.ll @@ -55,33 +55,40 @@ _llgo_0: store i64 3, ptr %5, align 4 %6 = getelementptr inbounds i64, ptr %2, i64 3 store i64 4, ptr %6, align 4 - %7 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %2, i64 8, i64 4, i64 0, i64 4, i64 4) - %8 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 32) - %9 = getelementptr inbounds i64, ptr %8, i64 0 - %10 = getelementptr inbounds i64, ptr %8, i64 1 - %11 = getelementptr inbounds i64, ptr %8, i64 2 - %12 = getelementptr inbounds i64, ptr %8, i64 3 - store i64 1, ptr %9, align 4 - store i64 2, ptr %10, align 4 - store i64 3, ptr %11, align 4 - store i64 4, ptr %12, align 4 - %13 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 10) - %14 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %13, i64 1, i64 10, i64 0, i64 4, i64 10) - %15 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 1 - %16 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 2 - call void @"github.com/goplus/llgo/internal/runtime.PrintSlice"(%"github.com/goplus/llgo/internal/runtime.Slice" %7) + %7 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8 + %8 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %7, i32 0, i32 0 + store ptr %2, ptr %8, align 8 + %9 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %7, i32 0, i32 1 + store i64 4, ptr %9, align 4 + %10 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %7, i32 0, i32 2 + store i64 4, ptr %10, align 4 + %11 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %7, align 8 + %12 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 32) + %13 = getelementptr inbounds i64, ptr %12, i64 0 + %14 = getelementptr inbounds i64, ptr %12, i64 1 + %15 = getelementptr inbounds i64, ptr %12, i64 2 + %16 = getelementptr inbounds i64, ptr %12, i64 3 + store i64 1, ptr %13, align 4 + store i64 2, ptr %14, align 4 + store i64 3, ptr %15, align 4 + store i64 4, ptr %16, align 4 + %17 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 10) + %18 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %17, i64 1, i64 10, i64 0, i64 4, i64 10) + %19 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %11, 1 + %20 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %11, 2 + call void @"github.com/goplus/llgo/internal/runtime.PrintSlice"(%"github.com/goplus/llgo/internal/runtime.Slice" %11) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) - call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %15) + call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %19) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) - call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %16) + call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %20) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10) - %17 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %14, 1 - %18 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %14, 2 - call void @"github.com/goplus/llgo/internal/runtime.PrintSlice"(%"github.com/goplus/llgo/internal/runtime.Slice" %14) + %21 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %18, 1 + %22 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %18, 2 + call void @"github.com/goplus/llgo/internal/runtime.PrintSlice"(%"github.com/goplus/llgo/internal/runtime.Slice" %18) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) - call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %17) + call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %21) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) - call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %18) + call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %22) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10) call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 4) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) @@ -91,166 +98,187 @@ _llgo_0: call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 4) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10) - %19 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 32) - %20 = getelementptr inbounds i64, ptr %19, i64 0 - store i64 1, ptr %20, align 4 - %21 = getelementptr inbounds i64, ptr %19, i64 1 - store i64 2, ptr %21, align 4 - %22 = getelementptr inbounds i64, ptr %19, i64 2 - store i64 3, ptr %22, align 4 - %23 = getelementptr inbounds i64, ptr %19, i64 3 - store i64 4, ptr %23, align 4 - %24 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %19, i64 8, i64 4, i64 0, i64 4, i64 4) - %25 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %24, 1 - call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %25) + %23 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 32) + %24 = getelementptr inbounds i64, ptr %23, i64 0 + store i64 1, ptr %24, align 4 + %25 = getelementptr inbounds i64, ptr %23, i64 1 + store i64 2, ptr %25, align 4 + %26 = getelementptr inbounds i64, ptr %23, i64 2 + store i64 3, ptr %26, align 4 + %27 = getelementptr inbounds i64, ptr %23, i64 3 + store i64 4, ptr %27, align 4 + %28 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8 + %29 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %28, i32 0, i32 0 + store ptr %23, ptr %29, align 8 + %30 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %28, i32 0, i32 1 + store i64 4, ptr %30, align 4 + %31 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %28, i32 0, i32 2 + store i64 4, ptr %31, align 4 + %32 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %28, align 8 + %33 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %32, 1 + call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %33) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 4) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10) - %26 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 2 - %27 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 2 - %28 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 0 - %29 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %28, i64 8, i64 %26, i64 1, i64 %27, i64 %26) - %30 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %29, 1 - %31 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 2 - %32 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 2 - %33 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 0 - %34 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %33, i64 8, i64 %31, i64 1, i64 %32, i64 %31) - %35 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %34, 2 - %36 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 2 - %37 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 0 - %38 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %37, i64 8, i64 %36, i64 1, i64 2, i64 %36) - %39 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %38, 1 - %40 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 2 - %41 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 0 - %42 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %41, i64 8, i64 %40, i64 1, i64 2, i64 %40) + %34 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %11, 2 + %35 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %11, 2 + %36 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %11, 0 + %37 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %36, i64 32, i64 %34, i64 1, i64 %35, i64 %34) + %38 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %37, 1 + %39 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %11, 2 + %40 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %11, 2 + %41 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %11, 0 + %42 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %41, i64 32, i64 %39, i64 1, i64 %40, i64 %39) %43 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %42, 2 - %44 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 2 - %45 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 0 - %46 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %45, i64 8, i64 %44, i64 1, i64 2, i64 2) + %44 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %11, 2 + %45 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %11, 0 + %46 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %45, i64 32, i64 %44, i64 1, i64 2, i64 %44) %47 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %46, 1 - %48 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 2 - %49 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 0 - %50 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %49, i64 8, i64 %48, i64 1, i64 2, i64 2) + %48 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %11, 2 + %49 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %11, 0 + %50 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %49, i64 32, i64 %48, i64 1, i64 2, i64 %48) %51 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %50, 2 - call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %30) - call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) - call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %35) - call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) - call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %39) + %52 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %11, 2 + %53 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %11, 0 + %54 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %53, i64 32, i64 %52, i64 1, i64 2, i64 2) + %55 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %54, 1 + %56 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %11, 2 + %57 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %11, 0 + %58 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %57, i64 32, i64 %56, i64 1, i64 2, i64 2) + %59 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %58, 2 + call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %38) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %43) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %47) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %51) - call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10) - %52 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %8, i64 8, i64 4, i64 1, i64 4, i64 4) - %53 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %52, 1 - %54 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %8, i64 8, i64 4, i64 1, i64 4, i64 4) - %55 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %54, 2 - %56 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %8, i64 8, i64 4, i64 1, i64 2, i64 4) - %57 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %56, 1 - %58 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %8, i64 8, i64 4, i64 1, i64 2, i64 4) - %59 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %58, 2 - %60 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %8, i64 8, i64 4, i64 1, i64 2, i64 2) - %61 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %60, 1 - %62 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %8, i64 8, i64 4, i64 1, i64 2, i64 2) - %63 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %62, 2 - call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %53) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %55) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) - call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %57) - call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %59) - call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) + call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10) + %60 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %12, i64 8, i64 4, i64 1, i64 4, i64 4) + %61 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %60, 1 + %62 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %12, i64 8, i64 4, i64 1, i64 4, i64 4) + %63 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %62, 2 + %64 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %12, i64 8, i64 4, i64 1, i64 2, i64 4) + %65 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %64, 1 + %66 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %12, i64 8, i64 4, i64 1, i64 2, i64 4) + %67 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %66, 2 + %68 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %12, i64 8, i64 4, i64 1, i64 2, i64 2) + %69 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %68, 1 + %70 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %12, i64 8, i64 4, i64 1, i64 2, i64 2) + %71 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %70, 2 call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %61) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %63) - call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10) - %64 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %65 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %64, i32 0, i32 0 - store ptr @0, ptr %65, align 8 - %66 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %64, i32 0, i32 1 - store i64 5, ptr %66, align 4 - %67 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %64, align 8 - %68 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %67, 1 - %69 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewStringSlice"(%"github.com/goplus/llgo/internal/runtime.String" %67, i64 1, i64 %68) - %70 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %71 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %70, i32 0, i32 0 - store ptr @1, ptr %71, align 8 - %72 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %70, i32 0, i32 1 - store i64 5, ptr %72, align 4 - %73 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %70, align 8 - %74 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewStringSlice"(%"github.com/goplus/llgo/internal/runtime.String" %73, i64 1, i64 2) - %75 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %76 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %75, i32 0, i32 0 - store ptr @2, ptr %76, align 8 - %77 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %75, i32 0, i32 1 - store i64 5, ptr %77, align 4 - %78 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %75, align 8 - %79 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %78, 1 - %80 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewStringSlice"(%"github.com/goplus/llgo/internal/runtime.String" %78, i64 5, i64 %79) - %81 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %80, 1 - %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 @3, ptr %83, align 8 - %84 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %82, i32 0, i32 1 - store i64 5, ptr %84, align 4 - %85 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %82, align 8 - call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %85) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) - call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %69) + call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %65) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) - call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %74) + call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %67) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) - call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %81) + call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %69) + call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) + call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %71) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10) - %86 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 32) - %87 = getelementptr inbounds i64, ptr %86, i64 0 - store i64 5, ptr %87, align 4 - %88 = getelementptr inbounds i64, ptr %86, i64 1 - store i64 6, ptr %88, align 4 - %89 = getelementptr inbounds i64, ptr %86, i64 2 - store i64 7, ptr %89, align 4 - %90 = getelementptr inbounds i64, ptr %86, i64 3 - store i64 8, ptr %90, align 4 - %91 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %86, i64 8, i64 4, i64 0, i64 4, i64 4) - %92 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %91, 0 - %93 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %91, 1 - %94 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.SliceAppend"(%"github.com/goplus/llgo/internal/runtime.Slice" %7, ptr %92, i64 %93, i64 8) - call void @"github.com/goplus/llgo/internal/runtime.PrintSlice"(%"github.com/goplus/llgo/internal/runtime.Slice" %94) + %72 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 + %73 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %72, i32 0, i32 0 + store ptr @0, ptr %73, align 8 + %74 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %72, i32 0, i32 1 + store i64 5, ptr %74, align 4 + %75 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %72, align 8 + %76 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %75, 1 + %77 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewStringSlice"(%"github.com/goplus/llgo/internal/runtime.String" %75, i64 1, i64 %76) + %78 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 + %79 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %78, i32 0, i32 0 + store ptr @1, ptr %79, align 8 + %80 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %78, i32 0, i32 1 + store i64 5, ptr %80, align 4 + %81 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %78, align 8 + %82 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewStringSlice"(%"github.com/goplus/llgo/internal/runtime.String" %81, i64 1, i64 2) + %83 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 + %84 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %83, i32 0, i32 0 + store ptr @2, ptr %84, align 8 + %85 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %83, i32 0, i32 1 + store i64 5, ptr %85, align 4 + %86 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %83, align 8 + %87 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %86, 1 + %88 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewStringSlice"(%"github.com/goplus/llgo/internal/runtime.String" %86, i64 5, i64 %87) + %89 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %88, 1 + %90 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 + %91 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %90, i32 0, i32 0 + store ptr @3, ptr %91, align 8 + %92 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %90, i32 0, i32 1 + store i64 5, ptr %92, align 4 + %93 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %90, align 8 + call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %93) + call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) + call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %77) + call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) + call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %82) + call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) + call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %89) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10) - %95 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 3) - %96 = getelementptr inbounds i8, ptr %95, i64 0 - store i8 97, ptr %96, align 1 - %97 = getelementptr inbounds i8, ptr %95, i64 1 - store i8 98, ptr %97, align 1 - %98 = getelementptr inbounds i8, ptr %95, i64 2 - store i8 99, ptr %98, align 1 - %99 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %95, i64 1, i64 3, i64 0, i64 3, i64 3) - %100 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %101 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %100, i32 0, i32 0 - store ptr @4, ptr %101, align 8 - %102 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %100, i32 0, i32 1 - store i64 3, ptr %102, align 4 - %103 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %100, align 8 - %104 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %103, 0 - %105 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %103, 1 - %106 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.SliceAppend"(%"github.com/goplus/llgo/internal/runtime.Slice" %99, ptr %104, i64 %105, i64 1) + %94 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 32) + %95 = getelementptr inbounds i64, ptr %94, i64 0 + store i64 5, ptr %95, align 4 + %96 = getelementptr inbounds i64, ptr %94, i64 1 + store i64 6, ptr %96, align 4 + %97 = getelementptr inbounds i64, ptr %94, i64 2 + store i64 7, ptr %97, align 4 + %98 = getelementptr inbounds i64, ptr %94, i64 3 + store i64 8, ptr %98, align 4 + %99 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8 + %100 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %99, i32 0, i32 0 + store ptr %94, ptr %100, align 8 + %101 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %99, i32 0, i32 1 + store i64 4, ptr %101, align 4 + %102 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %99, i32 0, i32 2 + store i64 4, ptr %102, align 4 + %103 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %99, align 8 + %104 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %103, 0 + %105 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %103, 1 + %106 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.SliceAppend"(%"github.com/goplus/llgo/internal/runtime.Slice" %11, ptr %104, i64 %105, i64 32) call void @"github.com/goplus/llgo/internal/runtime.PrintSlice"(%"github.com/goplus/llgo/internal/runtime.Slice" %106) 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 = 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 + %107 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 3) + %108 = getelementptr inbounds i8, ptr %107, i64 0 + store i8 97, ptr %108, align 1 + %109 = getelementptr inbounds i8, ptr %107, i64 1 + store i8 98, ptr %109, align 1 + %110 = getelementptr inbounds i8, ptr %107, i64 2 + store i8 99, ptr %110, align 1 + %111 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8 + %112 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %111, i32 0, i32 0 + store ptr %107, ptr %112, align 8 + %113 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %111, i32 0, i32 1 + store i64 3, ptr %113, align 4 + %114 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %111, i32 0, i32 2 + store i64 3, ptr %114, align 4 + %115 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %111, align 8 + %116 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 + %117 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %116, i32 0, i32 0 + store ptr @4, ptr %117, align 8 + %118 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %116, i32 0, i32 1 + store i64 3, ptr %118, align 4 + %119 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %116, align 8 + %120 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %119, 0 + %121 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %119, 1 + %122 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.SliceAppend"(%"github.com/goplus/llgo/internal/runtime.Slice" %115, ptr %120, i64 %121, i64 1) + call void @"github.com/goplus/llgo/internal/runtime.PrintSlice"(%"github.com/goplus/llgo/internal/runtime.Slice" %122) + call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10) + %123 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 16) + %124 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 2) + %125 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %126 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %125, i32 0, i32 0 + store ptr %124, ptr %126, align 8 + %127 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %125, i32 0, i32 1 + store ptr inttoptr (i64 100 to ptr), ptr %127, align 8 + %128 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %125, align 8 + store %"github.com/goplus/llgo/internal/runtime.eface" %128, ptr %123, align 8 + %129 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %123, align 8 + %130 = ptrtoint ptr %123 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) @@ -267,83 +295,90 @@ _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.PrintEface"(%"github.com/goplus/llgo/internal/runtime.eface" %113) + call void @"github.com/goplus/llgo/internal/runtime.PrintEface"(%"github.com/goplus/llgo/internal/runtime.eface" %129) 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.PrintPointer"(ptr %123) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) - call void @"github.com/goplus/llgo/internal/runtime.PrintUint"(i64 %114) - call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10) - %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) - %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) - %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) - %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) - %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 + %131 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 3) + %132 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 8) + %133 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8 + %134 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %133, i32 0, i32 0 + store ptr %131, ptr %134, align 8 + %135 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %133, i32 0, i32 1 + store i64 3, ptr %135, align 4 + %136 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %133, i32 0, i32 2 + store i64 3, ptr %136, align 4 + %137 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %133, align 8 + %138 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %122, 0 + %139 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %122, 1 + %140 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCopy"(%"github.com/goplus/llgo/internal/runtime.Slice" %137, ptr %138, i64 %139, i64 3) + store i64 %140, ptr %132, align 4 + %141 = load i64, ptr %132, align 4 + %142 = getelementptr inbounds i8, ptr %131, i64 0 %143 = load i8, ptr %142, align 1 - %144 = getelementptr inbounds i8, ptr %115, i64 2 + %144 = getelementptr inbounds i8, ptr %131, i64 1 %145 = load i8, ptr %144, align 1 - call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %139) + %146 = getelementptr inbounds i8, ptr %131, i64 2 + %147 = load i8, ptr %146, align 1 + call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %141) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) - %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) - %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) - %148 = zext i8 %145 to i64 + %148 = zext i8 %143 to i64 call void @"github.com/goplus/llgo/internal/runtime.PrintUint"(i64 %148) + call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) + %149 = zext i8 %145 to i64 + call void @"github.com/goplus/llgo/internal/runtime.PrintUint"(i64 %149) + call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) + %150 = zext i8 %147 to i64 + call void @"github.com/goplus/llgo/internal/runtime.PrintUint"(i64 %150) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10) - %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 + %151 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %131, i64 1, i64 3, i64 1, i64 3, i64 3) + %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 @5, 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 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %155, 0 + %157 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %155, 1 + %158 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCopy"(%"github.com/goplus/llgo/internal/runtime.Slice" %151, ptr %156, i64 %157, i64 1) + store i64 %158, ptr %132, align 4 + %159 = load i64, ptr %132, align 4 + %160 = getelementptr inbounds i8, ptr %131, i64 0 + %161 = load i8, ptr %160, align 1 + %162 = getelementptr inbounds i8, ptr %131, i64 1 + %163 = load i8, ptr %162, align 1 + %164 = getelementptr inbounds i8, ptr %131, i64 2 + %165 = load i8, ptr %164, align 1 + call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %159) + call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) + %166 = zext i8 %161 to i64 + call void @"github.com/goplus/llgo/internal/runtime.PrintUint"(i64 %166) + call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) + %167 = zext i8 %163 to i64 + call void @"github.com/goplus/llgo/internal/runtime.PrintUint"(i64 %167) + call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32) + %168 = zext i8 %165 to i64 + call void @"github.com/goplus/llgo/internal/runtime.PrintUint"(i64 %168) + call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10) + %169 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 8) + %170 = getelementptr inbounds { ptr }, ptr %169, i32 0, i32 0 + store ptr %132, ptr %170, align 8 + %171 = alloca { ptr, ptr }, align 8 + %172 = getelementptr inbounds { ptr, ptr }, ptr %171, i32 0, i32 0 + store ptr @"main.main$2", ptr %172, align 8 + %173 = getelementptr inbounds { ptr, ptr }, ptr %171, i32 0, i32 1 + store ptr %169, ptr %173, align 8 + %174 = load { ptr, ptr }, ptr %171, 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) - %155 = extractvalue { ptr, ptr } %154, 0 - call void @"github.com/goplus/llgo/internal/runtime.PrintPointer"(ptr %155) + %175 = extractvalue { ptr, ptr } %174, 0 + call void @"github.com/goplus/llgo/internal/runtime.PrintPointer"(ptr %175) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10) ret i32 0 } diff --git a/cl/_testrt/concat/out.ll b/cl/_testrt/concat/out.ll index 845d1d0c..f850807f 100644 --- a/cl/_testrt/concat/out.ll +++ b/cl/_testrt/concat/out.ll @@ -121,14 +121,21 @@ _llgo_0: store i64 5, ptr %16, align 4 %17 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %14, align 8 store %"github.com/goplus/llgo/internal/runtime.String" %17, ptr %13, align 8 - %18 = 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) - %19 = call %"github.com/goplus/llgo/internal/runtime.String" @main.concat(%"github.com/goplus/llgo/internal/runtime.Slice" %18) - %20 = load ptr, ptr @__stderrp, align 8 - %21 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %19, 1 - %22 = add i64 %21, 1 - %23 = alloca i8, i64 %22, align 1 - %24 = call ptr @"github.com/goplus/llgo/internal/runtime.CStrCopy"(ptr %23, %"github.com/goplus/llgo/internal/runtime.String" %19) - %25 = call i32 (ptr, ptr, ...) @fprintf(ptr %20, ptr @6, ptr %24) + %18 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8 + %19 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %18, i32 0, i32 0 + store ptr %2, ptr %19, align 8 + %20 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %18, i32 0, i32 1 + store i64 3, ptr %20, align 4 + %21 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %18, i32 0, i32 2 + store i64 3, ptr %21, align 4 + %22 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %18, align 8 + %23 = call %"github.com/goplus/llgo/internal/runtime.String" @main.concat(%"github.com/goplus/llgo/internal/runtime.Slice" %22) + %24 = load ptr, ptr @__stderrp, align 8 + %25 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %23, 1 + %26 = add i64 %25, 1 + %27 = alloca i8, i64 %26, align 1 + %28 = call ptr @"github.com/goplus/llgo/internal/runtime.CStrCopy"(ptr %27, %"github.com/goplus/llgo/internal/runtime.String" %23) + %29 = call i32 (ptr, ptr, ...) @fprintf(ptr %24, ptr @6, ptr %28) ret i32 0 } @@ -140,8 +147,6 @@ 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.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr, i64, i64, i64, i64, i64) - declare ptr @"github.com/goplus/llgo/internal/runtime.CStrCopy"(ptr, %"github.com/goplus/llgo/internal/runtime.String") declare i32 @fprintf(ptr, ptr, ...) diff --git a/cl/_testrt/sum/out.ll b/cl/_testrt/sum/out.ll index e13b24a2..c36f08d1 100644 --- a/cl/_testrt/sum/out.ll +++ b/cl/_testrt/sum/out.ll @@ -36,9 +36,16 @@ _llgo_0: store i64 3, ptr %5, align 4 %6 = getelementptr inbounds i64, ptr %2, i64 3 store i64 4, ptr %6, align 4 - %7 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %2, i64 8, i64 4, i64 0, i64 4, i64 4) - %8 = call i64 @main.sum(%"github.com/goplus/llgo/internal/runtime.Slice" %7) - %9 = call i32 (ptr, ...) @printf(ptr @0, i64 %8) + %7 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8 + %8 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %7, i32 0, i32 0 + store ptr %2, ptr %8, align 8 + %9 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %7, i32 0, i32 1 + store i64 4, ptr %9, align 4 + %10 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %7, i32 0, i32 2 + store i64 4, ptr %10, align 4 + %11 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %7, align 8 + %12 = call i64 @main.sum(%"github.com/goplus/llgo/internal/runtime.Slice" %11) + %13 = call i32 (ptr, ...) @printf(ptr @0, i64 %12) ret i32 0 } @@ -71,8 +78,6 @@ 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.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr, i64, i64, i64, i64, i64) - declare i32 @printf(ptr, ...) declare void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1) diff --git a/cl/compile.go b/cl/compile.go index d4ce3aa0..1b23d3b8 100644 --- a/cl/compile.go +++ b/cl/compile.go @@ -381,7 +381,7 @@ func (p *context) compileBlock(b llssa.Builder, block *ssa.BasicBlock, n int, do cond := b.BinOp(token.NEQ, mod, prog.Null(mod.Type)) newBlk := p.fn.MakeBlock() b.If(cond, jumpTo, newBlk) - b.SetBlock(newBlk) + b.SetBlockEx(newBlk, llssa.AtEnd, false) b.Store(modPtr, b.PyImportMod(modPath)) b.Jump(jumpTo) } @@ -508,7 +508,7 @@ func isPhi(i ssa.Instruction) bool { func (p *context) compilePhis(b llssa.Builder, block *ssa.BasicBlock) int { ret := p.fn.Block(block.Index) - b.SetBlockEx(ret, llssa.AtEnd) + b.SetBlockEx(ret, llssa.AtEnd, false) if ninstr := len(block.Instrs); ninstr > 0 { if isPhi(block.Instrs[0]) { n := 1 diff --git a/ssa/decl.go b/ssa/decl.go index 2243e975..a4b64db1 100644 --- a/ssa/decl.go +++ b/ssa/decl.go @@ -274,7 +274,7 @@ func (p Function) NewBuilder() Builder { b := prog.ctx.NewBuilder() // TODO(xsw): Finalize may cause panic, so comment it. // b.Finalize() - return &aBuilder{b, p, p.Pkg, prog} + return &aBuilder{b, nil, p, p.Pkg, prog} } // HasBody reports whether the function has a body. @@ -287,7 +287,7 @@ func (p Function) HasBody() bool { func (p Function) MakeBody(nblk int) Builder { p.MakeBlocks(nblk) b := p.NewBuilder() - b.impl.SetInsertPointAtEnd(p.blks[0].impl) + b.impl.SetInsertPointAtEnd(p.blks[0].last) return b } @@ -306,7 +306,7 @@ func (p Function) MakeBlocks(nblk int) []BasicBlock { func (p Function) addBlock(idx int) BasicBlock { label := "_llgo_" + strconv.Itoa(idx) blk := llvm.AddBasicBlock(p.impl, label) - ret := &aBasicBlock{blk, p, idx} + ret := &aBasicBlock{blk, blk, p, idx} p.blks = append(p.blks, ret) return ret } diff --git a/ssa/expr.go b/ssa/expr.go index 2c5c7770..6fce4fbe 100644 --- a/ssa/expr.go +++ b/ssa/expr.go @@ -517,10 +517,10 @@ func llvmDelayValues(f func(i int) Expr, n int) []llvm.Value { return ret } -func llvmBlocks(bblks []BasicBlock) []llvm.BasicBlock { - ret := make([]llvm.BasicBlock, len(bblks)) - for i, v := range bblks { - ret[i] = v.impl +func llvmPredBlocks(preds []BasicBlock) []llvm.BasicBlock { + ret := make([]llvm.BasicBlock, len(preds)) + for i, v := range preds { + ret[i] = v.last } return ret } @@ -531,24 +531,24 @@ type Phi struct { } // AddIncoming adds incoming values to a phi node. -func (p Phi) AddIncoming(b Builder, bblks []BasicBlock, f func(i int) Expr) { - bs := llvmBlocks(bblks) +func (p Phi) AddIncoming(b Builder, preds []BasicBlock, f func(i int) Expr) { + bs := llvmPredBlocks(preds) if p.kind != vkPhisExpr { // normal phi node - vs := llvmDelayValues(f, len(bblks)) + vs := llvmDelayValues(f, len(preds)) p.impl.AddIncoming(vs, bs) return } e := p.raw.Type.(*phisExprTy) phis := e.phis vals := make([][]llvm.Value, len(phis)) - for iblk, blk := range bblks { - last := blk.impl.LastInstruction() + for iblk, blk := range preds { + last := blk.last.LastInstruction() b.impl.SetInsertPointBefore(last) impl := b.impl val := f(iblk).impl for i := range phis { if iblk == 0 { - vals[i] = make([]llvm.Value, len(bblks)) + vals[i] = make([]llvm.Value, len(preds)) } vals[i][iblk] = llvm.CreateExtractValue(impl, val, i) } diff --git a/ssa/interface.go b/ssa/interface.go index bc4fb6e2..c336dfe8 100644 --- a/ssa/interface.go +++ b/ssa/interface.go @@ -61,13 +61,14 @@ func (b Builder) abiStruct(t *types.Struct) Expr { eq := b.BinOp(token.EQL, b.Load(expr), b.Prog.Null(expr.Type)) blks = b.Func.MakeBlocks(2) b.If(eq, blks[0], blks[1]) - b.SetBlock(blks[0]) + b.SetBlockEx(blks[0], AtEnd, false) } tabi := b.structOf(t) b.Store(expr, tabi) if pub { b.Jump(blks[1]) - b.SetBlock(blks[1]) + b.SetBlockEx(blks[1], AtEnd, false) + b.blk.last = blks[1].last } }) } @@ -279,9 +280,10 @@ func (b Builder) TypeAssert(x Expr, assertedTyp Type, commaOk bool) Expr { } blks := b.Func.MakeBlocks(2) b.If(eq, blks[0], blks[1]) - b.SetBlock(blks[1]) + b.SetBlockEx(blks[1], AtEnd, false) b.Panic(b.Str("type assertion failed")) - b.SetBlock(blks[0]) + b.SetBlockEx(blks[0], AtEnd, false) + b.blk.last = blks[0].last return b.valFromData(assertedTyp, b.faceData(x.impl)) } diff --git a/ssa/package.go b/ssa/package.go index 25900f92..da180b66 100644 --- a/ssa/package.go +++ b/ssa/package.go @@ -559,7 +559,7 @@ func (p Package) AfterInit(b Builder, ret BasicBlock) { doAbiInit := len(p.abiini) > 0 doPyLoadModSyms := p.pyHasModSyms() if doAbiInit || doPyLoadModSyms { - b.SetBlockEx(ret, afterInit) + b.SetBlockEx(ret, afterInit, false) if doAbiInit { sigAbiInit := types.NewSignatureType(nil, nil, nil, nil, nil, false) fn := p.NewFunc(p.abi.Pkg+".init$abi", sigAbiInit, InC) @@ -743,7 +743,7 @@ func (p Program) tyGetAttrString() *types.Signature { func (p Package) PyInit() bool { if fn := p.FuncOf("main"); fn != nil { b := fn.NewBuilder() - b.SetBlockEx(fn.Block(0), AtStart).callPyInit() + b.SetBlockEx(fn.Block(0), AtStart, false).callPyInit() b.Dispose() return true } diff --git a/ssa/ssa_test.go b/ssa/ssa_test.go index 103ee79e..cd686c7b 100644 --- a/ssa/ssa_test.go +++ b/ssa/ssa_test.go @@ -52,7 +52,7 @@ func TestSetBlockEx(t *testing.T) { }() fn := &aFunction{} b := &aBuilder{Func: fn} - b.SetBlockEx(&aBasicBlock{fn: fn}, -1) + b.SetBlockEx(&aBasicBlock{fn: fn}, -1, false) } func TestSetPython(t *testing.T) { diff --git a/ssa/stmt_builder.go b/ssa/stmt_builder.go index 4ef42c9a..93c462a4 100644 --- a/ssa/stmt_builder.go +++ b/ssa/stmt_builder.go @@ -29,9 +29,10 @@ import ( // ----------------------------------------------------------------------------- type aBasicBlock struct { - impl llvm.BasicBlock - fn Function - idx int + first llvm.BasicBlock + last llvm.BasicBlock + fn Function + idx int } // BasicBlock represents a basic block in a function. @@ -51,6 +52,7 @@ func (p BasicBlock) Index() int { type aBuilder struct { impl llvm.Builder + blk BasicBlock Func Function Pkg Package Prog Program @@ -64,12 +66,12 @@ func (b Builder) Dispose() { b.impl.Dispose() } -// SetBlock means SetBlockEx(blk, AtEnd). +// SetBlock means SetBlockEx(blk, AtEnd, true). func (b Builder) SetBlock(blk BasicBlock) Builder { if debugInstr { log.Printf("Block _llgo_%v:\n", blk.idx) } - b.SetBlockEx(blk, AtEnd) + b.SetBlockEx(blk, AtEnd, true) return b } @@ -82,20 +84,23 @@ const ( ) // SetBlockEx sets blk as current basic block and pos as its insert point. -func (b Builder) SetBlockEx(blk BasicBlock, pos InsertPoint) Builder { +func (b Builder) SetBlockEx(blk BasicBlock, pos InsertPoint, setBlk bool) Builder { if b.Func != blk.fn { panic("mismatched function") } switch pos { case AtEnd: - b.impl.SetInsertPointAtEnd(blk.impl) + b.impl.SetInsertPointAtEnd(blk.last) case AtStart: - b.impl.SetInsertPointBefore(blk.impl.FirstInstruction()) + b.impl.SetInsertPointBefore(blk.first.FirstInstruction()) case afterInit: - b.impl.SetInsertPointBefore(instrAfterInit(blk.impl)) + b.impl.SetInsertPointBefore(instrAfterInit(blk.first)) default: panic("SetBlockEx: invalid pos") } + if setBlk { + b.blk = blk + } return b } @@ -184,7 +189,7 @@ func (b Builder) Jump(jmpb BasicBlock) { if debugInstr { log.Printf("Jump _llgo_%v\n", jmpb.idx) } - b.impl.CreateBr(jmpb.impl) + b.impl.CreateBr(jmpb.first) } // If emits an if instruction. @@ -195,7 +200,7 @@ func (b Builder) If(cond Expr, thenb, elseb BasicBlock) { if debugInstr { log.Printf("If %v, _llgo_%v, _llgo_%v\n", cond.impl, thenb.idx, elseb.idx) } - b.impl.CreateCondBr(cond.impl, thenb.impl, elseb.impl) + b.impl.CreateCondBr(cond.impl, thenb.first, elseb.first) } // The MapUpdate instruction updates the association of Map[Key] to