ssa: index/indexAddr check max
This commit is contained in:
@@ -1215,73 +1215,75 @@ _llgo_24: ; preds = %_llgo_22
|
|||||||
br label %_llgo_12
|
br label %_llgo_12
|
||||||
|
|
||||||
_llgo_25: ; preds = %_llgo_27
|
_llgo_25: ; preds = %_llgo_27
|
||||||
%52 = fptosi double %69 to i64
|
%52 = fptosi double %71 to i64
|
||||||
%53 = add i64 %70, 2
|
%53 = add i64 %72, 2
|
||||||
%54 = add i64 %52, 48
|
%54 = add i64 %52, 48
|
||||||
%55 = trunc i64 %54 to i8
|
%55 = trunc i64 %54 to i8
|
||||||
%56 = icmp slt i64 %53, 0
|
%56 = icmp slt i64 %53, 0
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %56)
|
%57 = icmp sge i64 %53, 14
|
||||||
%57 = getelementptr inbounds i8, ptr %20, i64 %53
|
%58 = or i1 %57, %56
|
||||||
store i8 %55, ptr %57, align 1
|
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %58)
|
||||||
%58 = sitofp i64 %52 to double
|
%59 = getelementptr inbounds i8, ptr %20, i64 %53
|
||||||
%59 = fsub double %69, %58
|
store i8 %55, ptr %59, align 1
|
||||||
%60 = fmul double %59, 1.000000e+01
|
%60 = sitofp i64 %52 to double
|
||||||
%61 = add i64 %70, 1
|
%61 = fsub double %71, %60
|
||||||
|
%62 = fmul double %61, 1.000000e+01
|
||||||
|
%63 = add i64 %72, 1
|
||||||
br label %_llgo_27
|
br label %_llgo_27
|
||||||
|
|
||||||
_llgo_26: ; preds = %_llgo_27
|
_llgo_26: ; preds = %_llgo_27
|
||||||
%62 = getelementptr inbounds i8, ptr %20, i64 2
|
%64 = getelementptr inbounds i8, ptr %20, i64 2
|
||||||
%63 = load i8, ptr %62, align 1
|
%65 = load i8, ptr %64, align 1
|
||||||
%64 = getelementptr inbounds i8, ptr %20, i64 1
|
%66 = getelementptr inbounds i8, ptr %20, i64 1
|
||||||
store i8 %63, ptr %64, align 1
|
store i8 %65, ptr %66, align 1
|
||||||
%65 = getelementptr inbounds i8, ptr %20, i64 2
|
%67 = getelementptr inbounds i8, ptr %20, i64 2
|
||||||
store i8 46, ptr %65, align 1
|
store i8 46, ptr %67, align 1
|
||||||
%66 = getelementptr inbounds i8, ptr %20, i64 9
|
%68 = getelementptr inbounds i8, ptr %20, i64 9
|
||||||
store i8 101, ptr %66, align 1
|
store i8 101, ptr %68, align 1
|
||||||
%67 = getelementptr inbounds i8, ptr %20, i64 10
|
%69 = getelementptr inbounds i8, ptr %20, i64 10
|
||||||
store i8 43, ptr %67, align 1
|
store i8 43, ptr %69, align 1
|
||||||
%68 = icmp slt i64 %28, 0
|
%70 = icmp slt i64 %28, 0
|
||||||
br i1 %68, label %_llgo_28, label %_llgo_29
|
br i1 %70, label %_llgo_28, label %_llgo_29
|
||||||
|
|
||||||
_llgo_27: ; preds = %_llgo_25, %_llgo_12
|
_llgo_27: ; preds = %_llgo_25, %_llgo_12
|
||||||
%69 = phi double [ %27, %_llgo_12 ], [ %60, %_llgo_25 ]
|
%71 = phi double [ %27, %_llgo_12 ], [ %62, %_llgo_25 ]
|
||||||
%70 = phi i64 [ 0, %_llgo_12 ], [ %61, %_llgo_25 ]
|
%72 = phi i64 [ 0, %_llgo_12 ], [ %63, %_llgo_25 ]
|
||||||
%71 = icmp slt i64 %70, 7
|
%73 = icmp slt i64 %72, 7
|
||||||
br i1 %71, label %_llgo_25, label %_llgo_26
|
br i1 %73, label %_llgo_25, label %_llgo_26
|
||||||
|
|
||||||
_llgo_28: ; preds = %_llgo_26
|
_llgo_28: ; preds = %_llgo_26
|
||||||
%72 = sub i64 0, %28
|
%74 = sub i64 0, %28
|
||||||
%73 = getelementptr inbounds i8, ptr %20, i64 10
|
%75 = getelementptr inbounds i8, ptr %20, i64 10
|
||||||
store i8 45, ptr %73, align 1
|
store i8 45, ptr %75, align 1
|
||||||
br label %_llgo_29
|
br label %_llgo_29
|
||||||
|
|
||||||
_llgo_29: ; preds = %_llgo_28, %_llgo_26
|
_llgo_29: ; preds = %_llgo_28, %_llgo_26
|
||||||
%74 = phi i64 [ %28, %_llgo_26 ], [ %72, %_llgo_28 ]
|
%76 = phi i64 [ %28, %_llgo_26 ], [ %74, %_llgo_28 ]
|
||||||
%75 = sdiv i64 %74, 100
|
%77 = sdiv i64 %76, 100
|
||||||
%76 = trunc i64 %75 to i8
|
%78 = trunc i64 %77 to i8
|
||||||
%77 = add i8 %76, 48
|
%79 = add i8 %78, 48
|
||||||
%78 = getelementptr inbounds i8, ptr %20, i64 11
|
%80 = getelementptr inbounds i8, ptr %20, i64 11
|
||||||
store i8 %77, ptr %78, align 1
|
store i8 %79, ptr %80, align 1
|
||||||
%79 = sdiv i64 %74, 10
|
%81 = sdiv i64 %76, 10
|
||||||
%80 = trunc i64 %79 to i8
|
%82 = trunc i64 %81 to i8
|
||||||
%81 = urem i8 %80, 10
|
%83 = urem i8 %82, 10
|
||||||
%82 = add i8 %81, 48
|
%84 = add i8 %83, 48
|
||||||
%83 = getelementptr inbounds i8, ptr %20, i64 12
|
%85 = getelementptr inbounds i8, ptr %20, i64 12
|
||||||
store i8 %82, ptr %83, align 1
|
store i8 %84, ptr %85, align 1
|
||||||
%84 = srem i64 %74, 10
|
%86 = srem i64 %76, 10
|
||||||
%85 = trunc i64 %84 to i8
|
%87 = trunc i64 %86 to i8
|
||||||
%86 = add i8 %85, 48
|
%88 = add i8 %87, 48
|
||||||
%87 = getelementptr inbounds i8, ptr %20, i64 13
|
%89 = getelementptr inbounds i8, ptr %20, i64 13
|
||||||
store i8 %86, ptr %87, align 1
|
store i8 %88, ptr %89, align 1
|
||||||
%88 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8
|
%90 = 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
|
%91 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %90, i32 0, i32 0
|
||||||
store ptr %20, ptr %89, align 8
|
store ptr %20, ptr %91, align 8
|
||||||
%90 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %88, i32 0, i32 1
|
%92 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %90, i32 0, i32 1
|
||||||
store i64 14, ptr %90, align 4
|
store i64 14, ptr %92, align 4
|
||||||
%91 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %88, i32 0, i32 2
|
%93 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %90, i32 0, i32 2
|
||||||
store i64 14, ptr %91, align 4
|
store i64 14, ptr %93, align 4
|
||||||
%92 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %88, align 8
|
%94 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %90, align 8
|
||||||
call void @main.gwrite(%"github.com/goplus/llgo/internal/runtime.Slice" %92)
|
call void @main.gwrite(%"github.com/goplus/llgo/internal/runtime.Slice" %94)
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1291,7 +1293,7 @@ _llgo_0:
|
|||||||
br label %_llgo_3
|
br label %_llgo_3
|
||||||
|
|
||||||
_llgo_1: ; preds = %_llgo_3
|
_llgo_1: ; preds = %_llgo_3
|
||||||
%2 = urem i64 %20, 16
|
%2 = urem i64 %28, 16
|
||||||
%3 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
%3 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||||
%4 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %3, i32 0, i32 0
|
%4 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %3, i32 0, i32 0
|
||||||
store ptr @9, ptr %4, align 8
|
store ptr @9, ptr %4, align 8
|
||||||
@@ -1299,46 +1301,55 @@ _llgo_1: ; preds = %_llgo_3
|
|||||||
store i64 16, ptr %5, align 4
|
store i64 16, ptr %5, align 4
|
||||||
%6 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %3, align 8
|
%6 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %3, align 8
|
||||||
%7 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %6, 0
|
%7 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %6, 0
|
||||||
%8 = getelementptr inbounds i8, ptr %7, i64 %2
|
%8 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %6, 1
|
||||||
%9 = load i8, ptr %8, align 1
|
%9 = icmp sge i64 %2, %8
|
||||||
%10 = icmp slt i64 %21, 0
|
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %9)
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %10)
|
%10 = getelementptr inbounds i8, ptr %7, i64 %2
|
||||||
%11 = getelementptr inbounds i8, ptr %1, i64 %21
|
%11 = load i8, ptr %10, align 1
|
||||||
store i8 %9, ptr %11, align 1
|
%12 = icmp slt i64 %29, 0
|
||||||
%12 = icmp ult i64 %20, 16
|
%13 = icmp sge i64 %29, 100
|
||||||
br i1 %12, label %_llgo_5, label %_llgo_4
|
%14 = or i1 %13, %12
|
||||||
|
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %14)
|
||||||
|
%15 = getelementptr inbounds i8, ptr %1, i64 %29
|
||||||
|
store i8 %11, ptr %15, align 1
|
||||||
|
%16 = icmp ult i64 %28, 16
|
||||||
|
br i1 %16, label %_llgo_5, label %_llgo_4
|
||||||
|
|
||||||
_llgo_2: ; preds = %_llgo_5, %_llgo_3
|
_llgo_2: ; preds = %_llgo_5, %_llgo_3
|
||||||
%13 = sub i64 %21, 1
|
%17 = sub i64 %29, 1
|
||||||
%14 = icmp slt i64 %13, 0
|
%18 = icmp slt i64 %17, 0
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %14)
|
%19 = icmp sge i64 %17, 100
|
||||||
%15 = getelementptr inbounds i8, ptr %1, i64 %13
|
%20 = or i1 %19, %18
|
||||||
store i8 120, ptr %15, align 1
|
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %20)
|
||||||
%16 = sub i64 %13, 1
|
%21 = getelementptr inbounds i8, ptr %1, i64 %17
|
||||||
%17 = icmp slt i64 %16, 0
|
store i8 120, ptr %21, align 1
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %17)
|
%22 = sub i64 %17, 1
|
||||||
%18 = getelementptr inbounds i8, ptr %1, i64 %16
|
%23 = icmp slt i64 %22, 0
|
||||||
store i8 48, ptr %18, align 1
|
%24 = icmp sge i64 %22, 100
|
||||||
%19 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %1, i64 1, i64 100, i64 %16, i64 100, i64 100)
|
%25 = or i1 %24, %23
|
||||||
call void @main.gwrite(%"github.com/goplus/llgo/internal/runtime.Slice" %19)
|
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %25)
|
||||||
|
%26 = getelementptr inbounds i8, ptr %1, i64 %22
|
||||||
|
store i8 48, ptr %26, align 1
|
||||||
|
%27 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %1, i64 1, i64 100, i64 %22, i64 100, i64 100)
|
||||||
|
call void @main.gwrite(%"github.com/goplus/llgo/internal/runtime.Slice" %27)
|
||||||
ret void
|
ret void
|
||||||
|
|
||||||
_llgo_3: ; preds = %_llgo_4, %_llgo_0
|
_llgo_3: ; preds = %_llgo_4, %_llgo_0
|
||||||
%20 = phi i64 [ %0, %_llgo_0 ], [ %23, %_llgo_4 ]
|
%28 = phi i64 [ %0, %_llgo_0 ], [ %31, %_llgo_4 ]
|
||||||
%21 = phi i64 [ 99, %_llgo_0 ], [ %24, %_llgo_4 ]
|
%29 = phi i64 [ 99, %_llgo_0 ], [ %32, %_llgo_4 ]
|
||||||
%22 = icmp sgt i64 %21, 0
|
%30 = icmp sgt i64 %29, 0
|
||||||
br i1 %22, label %_llgo_1, label %_llgo_2
|
br i1 %30, label %_llgo_1, label %_llgo_2
|
||||||
|
|
||||||
_llgo_4: ; preds = %_llgo_5, %_llgo_1
|
_llgo_4: ; preds = %_llgo_5, %_llgo_1
|
||||||
%23 = udiv i64 %20, 16
|
%31 = udiv i64 %28, 16
|
||||||
%24 = sub i64 %21, 1
|
%32 = sub i64 %29, 1
|
||||||
br label %_llgo_3
|
br label %_llgo_3
|
||||||
|
|
||||||
_llgo_5: ; preds = %_llgo_1
|
_llgo_5: ; preds = %_llgo_1
|
||||||
%25 = sub i64 100, %21
|
%33 = sub i64 100, %29
|
||||||
%26 = load i64, ptr @main.minhexdigits, align 4
|
%34 = load i64, ptr @main.minhexdigits, align 4
|
||||||
%27 = icmp sge i64 %25, %26
|
%35 = icmp sge i64 %33, %34
|
||||||
br i1 %27, label %_llgo_2, label %_llgo_4
|
br i1 %35, label %_llgo_2, label %_llgo_4
|
||||||
}
|
}
|
||||||
|
|
||||||
define void @main.printint(i64 %0) {
|
define void @main.printint(i64 %0) {
|
||||||
@@ -1375,30 +1386,33 @@ _llgo_1: ; preds = %_llgo_5, %_llgo_0
|
|||||||
br i1 %4, label %_llgo_2, label %_llgo_3
|
br i1 %4, label %_llgo_2, label %_llgo_3
|
||||||
|
|
||||||
_llgo_2: ; preds = %_llgo_1
|
_llgo_2: ; preds = %_llgo_1
|
||||||
%5 = icmp slt i64 %3, 0
|
%5 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %0, 0
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %5)
|
%6 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %0, 1
|
||||||
%6 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %0, 0
|
%7 = icmp slt i64 %3, 0
|
||||||
%7 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %6, i64 %3
|
%8 = icmp sge i64 %3, %6
|
||||||
%8 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %7, align 8
|
%9 = or i1 %8, %7
|
||||||
%9 = icmp ne i64 %3, 0
|
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %9)
|
||||||
br i1 %9, label %_llgo_4, label %_llgo_5
|
%10 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %5, i64 %3
|
||||||
|
%11 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, align 8
|
||||||
|
%12 = icmp ne i64 %3, 0
|
||||||
|
br i1 %12, label %_llgo_4, label %_llgo_5
|
||||||
|
|
||||||
_llgo_3: ; preds = %_llgo_1
|
_llgo_3: ; preds = %_llgo_1
|
||||||
call void @main.printnl()
|
call void @main.printnl()
|
||||||
ret void
|
ret void
|
||||||
|
|
||||||
_llgo_4: ; preds = %_llgo_2
|
_llgo_4: ; preds = %_llgo_2
|
||||||
%10 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
%13 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||||
%11 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %10, i32 0, i32 0
|
%14 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %13, i32 0, i32 0
|
||||||
store ptr @11, ptr %11, align 8
|
store ptr @11, ptr %14, align 8
|
||||||
%12 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %10, i32 0, i32 1
|
%15 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %13, i32 0, i32 1
|
||||||
store i64 1, ptr %12, align 4
|
store i64 1, ptr %15, align 4
|
||||||
%13 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %10, align 8
|
%16 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %13, align 8
|
||||||
call void @main.printstring(%"github.com/goplus/llgo/internal/runtime.String" %13)
|
call void @main.printstring(%"github.com/goplus/llgo/internal/runtime.String" %16)
|
||||||
br label %_llgo_5
|
br label %_llgo_5
|
||||||
|
|
||||||
_llgo_5: ; preds = %_llgo_4, %_llgo_2
|
_llgo_5: ; preds = %_llgo_4, %_llgo_2
|
||||||
call void @main.printany(%"github.com/goplus/llgo/internal/runtime.eface" %8)
|
call void @main.printany(%"github.com/goplus/llgo/internal/runtime.eface" %11)
|
||||||
br label %_llgo_1
|
br label %_llgo_1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1439,30 +1453,32 @@ _llgo_0:
|
|||||||
br label %_llgo_3
|
br label %_llgo_3
|
||||||
|
|
||||||
_llgo_1: ; preds = %_llgo_3
|
_llgo_1: ; preds = %_llgo_3
|
||||||
%2 = urem i64 %9, 10
|
%2 = urem i64 %11, 10
|
||||||
%3 = add i64 %2, 48
|
%3 = add i64 %2, 48
|
||||||
%4 = trunc i64 %3 to i8
|
%4 = trunc i64 %3 to i8
|
||||||
%5 = icmp slt i64 %10, 0
|
%5 = icmp slt i64 %12, 0
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %5)
|
%6 = icmp sge i64 %12, 100
|
||||||
%6 = getelementptr inbounds i8, ptr %1, i64 %10
|
%7 = or i1 %6, %5
|
||||||
store i8 %4, ptr %6, align 1
|
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %7)
|
||||||
%7 = icmp ult i64 %9, 10
|
%8 = getelementptr inbounds i8, ptr %1, i64 %12
|
||||||
br i1 %7, label %_llgo_2, label %_llgo_4
|
store i8 %4, ptr %8, align 1
|
||||||
|
%9 = icmp ult i64 %11, 10
|
||||||
|
br i1 %9, label %_llgo_2, label %_llgo_4
|
||||||
|
|
||||||
_llgo_2: ; preds = %_llgo_1, %_llgo_3
|
_llgo_2: ; preds = %_llgo_1, %_llgo_3
|
||||||
%8 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %1, i64 1, i64 100, i64 %10, i64 100, i64 100)
|
%10 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %1, i64 1, i64 100, i64 %12, i64 100, i64 100)
|
||||||
call void @main.gwrite(%"github.com/goplus/llgo/internal/runtime.Slice" %8)
|
call void @main.gwrite(%"github.com/goplus/llgo/internal/runtime.Slice" %10)
|
||||||
ret void
|
ret void
|
||||||
|
|
||||||
_llgo_3: ; preds = %_llgo_4, %_llgo_0
|
_llgo_3: ; preds = %_llgo_4, %_llgo_0
|
||||||
%9 = phi i64 [ %0, %_llgo_0 ], [ %12, %_llgo_4 ]
|
%11 = phi i64 [ %0, %_llgo_0 ], [ %14, %_llgo_4 ]
|
||||||
%10 = phi i64 [ 99, %_llgo_0 ], [ %13, %_llgo_4 ]
|
%12 = phi i64 [ 99, %_llgo_0 ], [ %15, %_llgo_4 ]
|
||||||
%11 = icmp sgt i64 %10, 0
|
%13 = icmp sgt i64 %12, 0
|
||||||
br i1 %11, label %_llgo_1, label %_llgo_2
|
br i1 %13, label %_llgo_1, label %_llgo_2
|
||||||
|
|
||||||
_llgo_4: ; preds = %_llgo_1
|
_llgo_4: ; preds = %_llgo_1
|
||||||
%12 = udiv i64 %9, 10
|
%14 = udiv i64 %11, 10
|
||||||
%13 = sub i64 %10, 1
|
%15 = sub i64 %12, 1
|
||||||
br label %_llgo_3
|
br label %_llgo_3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,12 +11,14 @@ source_filename = "main"
|
|||||||
|
|
||||||
define i8 @main.index(i8 %0) {
|
define i8 @main.index(i8 %0) {
|
||||||
_llgo_0:
|
_llgo_0:
|
||||||
%1 = icmp slt i8 %0, 0
|
%1 = sext i8 %0 to i64
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %1)
|
%2 = icmp slt i64 %1, 0
|
||||||
%2 = zext i8 %0 to i64
|
%3 = icmp sge i64 %1, 8
|
||||||
%3 = getelementptr inbounds i8, ptr @main.array, i64 %2
|
%4 = or i1 %3, %2
|
||||||
%4 = load i8, ptr %3, align 1
|
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %4)
|
||||||
ret i8 %4
|
%5 = getelementptr inbounds i8, ptr @main.array, i64 %1
|
||||||
|
%6 = load i8, ptr %5, align 1
|
||||||
|
ret i8 %6
|
||||||
}
|
}
|
||||||
|
|
||||||
define void @main.init() {
|
define void @main.init() {
|
||||||
|
|||||||
@@ -98,42 +98,45 @@ _llgo_1: ; preds = %_llgo_4, %_llgo_0
|
|||||||
br i1 %4, label %_llgo_2, label %_llgo_3
|
br i1 %4, label %_llgo_2, label %_llgo_3
|
||||||
|
|
||||||
_llgo_2: ; preds = %_llgo_1
|
_llgo_2: ; preds = %_llgo_1
|
||||||
%5 = icmp slt i64 %3, 0
|
%5 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %0, 0
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %5)
|
%6 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %0, 1
|
||||||
%6 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %0, 0
|
%7 = icmp slt i64 %3, 0
|
||||||
%7 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %6, i64 %3
|
%8 = icmp sge i64 %3, %6
|
||||||
%8 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %7, align 8
|
%9 = or i1 %8, %7
|
||||||
%9 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %8, 0
|
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %9)
|
||||||
%10 = load ptr, ptr @_llgo_int, align 8
|
%10 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %5, i64 %3
|
||||||
%11 = icmp eq ptr %9, %10
|
%11 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %10, align 8
|
||||||
br i1 %11, label %_llgo_4, label %_llgo_5
|
%12 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %11, 0
|
||||||
|
%13 = load ptr, ptr @_llgo_int, align 8
|
||||||
|
%14 = icmp eq ptr %12, %13
|
||||||
|
br i1 %14, label %_llgo_4, label %_llgo_5
|
||||||
|
|
||||||
_llgo_3: ; preds = %_llgo_1
|
_llgo_3: ; preds = %_llgo_1
|
||||||
ret void
|
ret void
|
||||||
|
|
||||||
_llgo_4: ; preds = %_llgo_2
|
_llgo_4: ; preds = %_llgo_2
|
||||||
%12 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %8, 1
|
%15 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %11, 1
|
||||||
%13 = ptrtoint ptr %12 to i64
|
%16 = ptrtoint ptr %15 to i64
|
||||||
%14 = call i32 (ptr, ...) @printf(ptr @0, i64 %13)
|
%17 = call i32 (ptr, ...) @printf(ptr @0, i64 %16)
|
||||||
br label %_llgo_1
|
br label %_llgo_1
|
||||||
|
|
||||||
_llgo_5: ; preds = %_llgo_2
|
_llgo_5: ; preds = %_llgo_2
|
||||||
%15 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
%18 = 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
|
%19 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %18, i32 0, i32 0
|
||||||
store ptr @1, ptr %16, align 8
|
store ptr @1, ptr %19, align 8
|
||||||
%17 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %15, i32 0, i32 1
|
%20 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %18, i32 0, i32 1
|
||||||
store i64 21, ptr %17, align 4
|
store i64 21, ptr %20, align 4
|
||||||
%18 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %15, align 8
|
%21 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %18, align 8
|
||||||
%19 = load ptr, ptr @_llgo_string, align 8
|
%22 = load ptr, ptr @_llgo_string, align 8
|
||||||
%20 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16)
|
%23 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16)
|
||||||
store %"github.com/goplus/llgo/internal/runtime.String" %18, ptr %20, align 8
|
store %"github.com/goplus/llgo/internal/runtime.String" %21, ptr %23, align 8
|
||||||
%21 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
|
%24 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
|
||||||
%22 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %21, i32 0, i32 0
|
%25 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %24, i32 0, i32 0
|
||||||
store ptr %19, ptr %22, align 8
|
store ptr %22, ptr %25, align 8
|
||||||
%23 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %21, i32 0, i32 1
|
%26 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %24, i32 0, i32 1
|
||||||
store ptr %20, ptr %23, align 8
|
store ptr %23, ptr %26, align 8
|
||||||
%24 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %21, align 8
|
%27 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %24, align 8
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.Panic"(%"github.com/goplus/llgo/internal/runtime.eface" %24)
|
call void @"github.com/goplus/llgo/internal/runtime.Panic"(%"github.com/goplus/llgo/internal/runtime.eface" %27)
|
||||||
unreachable
|
unreachable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
140
cl/_testgo/indexerr/in.go
Normal file
140
cl/_testgo/indexerr/in.go
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r == nil {
|
||||||
|
panic("array -1 must error")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
array(-1)
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r == nil {
|
||||||
|
panic("array 2 must error")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
array(2)
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r == nil {
|
||||||
|
panic("array2 must error")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
array2(2)
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r == nil {
|
||||||
|
panic("slice -1 must error")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
slice(-1)
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r == nil {
|
||||||
|
panic("slice 2 must error")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
slice(2)
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r == nil {
|
||||||
|
panic("slice2 2 must error")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
slice2(2)
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r == nil {
|
||||||
|
panic("2 must error")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
a := [...]int{1, 2}
|
||||||
|
var n = -1
|
||||||
|
println(a[n])
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r == nil {
|
||||||
|
panic("-1 must error")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
a := [...]int{1, 2}
|
||||||
|
var n = 2
|
||||||
|
println(a[n])
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r == nil {
|
||||||
|
panic("2 must error")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
a := [...]int{1, 2}
|
||||||
|
var n uint = 2
|
||||||
|
println(a[n])
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r == nil {
|
||||||
|
panic("2 must error")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
a := []int{1, 2}
|
||||||
|
var n = -1
|
||||||
|
println(a[n])
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r == nil {
|
||||||
|
panic("-1 must error")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
a := []int{1, 2}
|
||||||
|
var n = 2
|
||||||
|
println(a[n])
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r == nil {
|
||||||
|
panic("2 must error")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
a := []int{1, 2}
|
||||||
|
var n uint = 2
|
||||||
|
println(a[n])
|
||||||
|
}
|
||||||
|
|
||||||
|
func array(n int) {
|
||||||
|
println([...]int{1, 2}[n])
|
||||||
|
}
|
||||||
|
|
||||||
|
func array2(n uint) {
|
||||||
|
println([...]int{1, 2}[n])
|
||||||
|
}
|
||||||
|
|
||||||
|
func slice(n int) {
|
||||||
|
println([]int{1, 2}[n])
|
||||||
|
}
|
||||||
|
|
||||||
|
func slice2(n int) {
|
||||||
|
println([]int{1, 2}[n])
|
||||||
|
}
|
||||||
1
cl/_testgo/indexerr/out.ll
Normal file
1
cl/_testgo/indexerr/out.ll
Normal file
@@ -0,0 +1 @@
|
|||||||
|
;
|
||||||
@@ -788,16 +788,19 @@ _llgo_2: ; preds = %_llgo_0
|
|||||||
%11 = getelementptr inbounds %main.stringReader, ptr %0, i32 0, i32 0
|
%11 = getelementptr inbounds %main.stringReader, ptr %0, i32 0, i32 0
|
||||||
%12 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %11, align 8
|
%12 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %11, align 8
|
||||||
%13 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %12, 0
|
%13 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %12, 0
|
||||||
%14 = icmp slt i64 %10, 0
|
%14 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %12, 1
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %14)
|
%15 = icmp slt i64 %10, 0
|
||||||
%15 = getelementptr inbounds i8, ptr %13, i64 %10
|
%16 = icmp sge i64 %10, %14
|
||||||
%16 = load i8, ptr %15, align 1
|
%17 = or i1 %16, %15
|
||||||
%17 = getelementptr inbounds %main.stringReader, ptr %0, i32 0, i32 1
|
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %17)
|
||||||
%18 = load i64, ptr %17, align 4
|
%18 = getelementptr inbounds i8, ptr %13, i64 %10
|
||||||
%19 = add i64 %18, 1
|
%19 = load i8, ptr %18, align 1
|
||||||
%20 = getelementptr inbounds %main.stringReader, ptr %0, i32 0, i32 1
|
%20 = getelementptr inbounds %main.stringReader, ptr %0, i32 0, i32 1
|
||||||
store i64 %19, ptr %20, align 4
|
%21 = load i64, ptr %20, align 4
|
||||||
%mrv1 = insertvalue { i8, %"github.com/goplus/llgo/internal/runtime.iface" } poison, i8 %16, 0
|
%22 = add i64 %21, 1
|
||||||
|
%23 = getelementptr inbounds %main.stringReader, ptr %0, i32 0, i32 1
|
||||||
|
store i64 %22, ptr %23, align 4
|
||||||
|
%mrv1 = insertvalue { i8, %"github.com/goplus/llgo/internal/runtime.iface" } poison, i8 %19, 0
|
||||||
%mrv2 = insertvalue { i8, %"github.com/goplus/llgo/internal/runtime.iface" } %mrv1, %"github.com/goplus/llgo/internal/runtime.iface" zeroinitializer, 1
|
%mrv2 = insertvalue { i8, %"github.com/goplus/llgo/internal/runtime.iface" } %mrv1, %"github.com/goplus/llgo/internal/runtime.iface" zeroinitializer, 1
|
||||||
ret { i8, %"github.com/goplus/llgo/internal/runtime.iface" } %mrv2
|
ret { i8, %"github.com/goplus/llgo/internal/runtime.iface" } %mrv2
|
||||||
}
|
}
|
||||||
@@ -829,42 +832,45 @@ _llgo_2: ; preds = %_llgo_0
|
|||||||
%14 = getelementptr inbounds %main.stringReader, ptr %0, i32 0, i32 0
|
%14 = getelementptr inbounds %main.stringReader, ptr %0, i32 0, i32 0
|
||||||
%15 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %14, align 8
|
%15 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %14, align 8
|
||||||
%16 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %15, 0
|
%16 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %15, 0
|
||||||
%17 = icmp slt i64 %13, 0
|
%17 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %15, 1
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %17)
|
%18 = icmp slt i64 %13, 0
|
||||||
%18 = getelementptr inbounds i8, ptr %16, i64 %13
|
%19 = icmp sge i64 %13, %17
|
||||||
%19 = load i8, ptr %18, align 1
|
%20 = or i1 %19, %18
|
||||||
%20 = icmp ult i8 %19, -128
|
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %20)
|
||||||
br i1 %20, label %_llgo_3, label %_llgo_4
|
%21 = getelementptr inbounds i8, ptr %16, i64 %13
|
||||||
|
%22 = load i8, ptr %21, align 1
|
||||||
|
%23 = icmp ult i8 %22, -128
|
||||||
|
br i1 %23, label %_llgo_3, label %_llgo_4
|
||||||
|
|
||||||
_llgo_3: ; preds = %_llgo_2
|
_llgo_3: ; preds = %_llgo_2
|
||||||
%21 = getelementptr inbounds %main.stringReader, ptr %0, i32 0, i32 1
|
|
||||||
%22 = load i64, ptr %21, align 4
|
|
||||||
%23 = add i64 %22, 1
|
|
||||||
%24 = getelementptr inbounds %main.stringReader, ptr %0, i32 0, i32 1
|
%24 = getelementptr inbounds %main.stringReader, ptr %0, i32 0, i32 1
|
||||||
store i64 %23, ptr %24, align 4
|
%25 = load i64, ptr %24, align 4
|
||||||
%25 = sext i8 %19 to i32
|
%26 = add i64 %25, 1
|
||||||
%mrv1 = insertvalue { i32, i64, %"github.com/goplus/llgo/internal/runtime.iface" } poison, i32 %25, 0
|
%27 = getelementptr inbounds %main.stringReader, ptr %0, i32 0, i32 1
|
||||||
|
store i64 %26, ptr %27, align 4
|
||||||
|
%28 = sext i8 %22 to i32
|
||||||
|
%mrv1 = insertvalue { i32, i64, %"github.com/goplus/llgo/internal/runtime.iface" } poison, i32 %28, 0
|
||||||
%mrv2 = insertvalue { i32, i64, %"github.com/goplus/llgo/internal/runtime.iface" } %mrv1, i64 1, 1
|
%mrv2 = insertvalue { i32, i64, %"github.com/goplus/llgo/internal/runtime.iface" } %mrv1, i64 1, 1
|
||||||
%mrv3 = insertvalue { i32, i64, %"github.com/goplus/llgo/internal/runtime.iface" } %mrv2, %"github.com/goplus/llgo/internal/runtime.iface" zeroinitializer, 2
|
%mrv3 = insertvalue { i32, i64, %"github.com/goplus/llgo/internal/runtime.iface" } %mrv2, %"github.com/goplus/llgo/internal/runtime.iface" zeroinitializer, 2
|
||||||
ret { i32, i64, %"github.com/goplus/llgo/internal/runtime.iface" } %mrv3
|
ret { i32, i64, %"github.com/goplus/llgo/internal/runtime.iface" } %mrv3
|
||||||
|
|
||||||
_llgo_4: ; preds = %_llgo_2
|
_llgo_4: ; preds = %_llgo_2
|
||||||
%26 = getelementptr inbounds %main.stringReader, ptr %0, i32 0, i32 0
|
%29 = getelementptr inbounds %main.stringReader, ptr %0, i32 0, i32 0
|
||||||
%27 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %26, align 8
|
%30 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %29, align 8
|
||||||
%28 = getelementptr inbounds %main.stringReader, ptr %0, i32 0, i32 1
|
%31 = getelementptr inbounds %main.stringReader, ptr %0, i32 0, i32 1
|
||||||
%29 = load i64, ptr %28, align 4
|
%32 = load i64, ptr %31, align 4
|
||||||
%30 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %27, 1
|
%33 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %30, 1
|
||||||
%31 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewStringSlice"(%"github.com/goplus/llgo/internal/runtime.String" %27, i64 %29, i64 %30)
|
%34 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewStringSlice"(%"github.com/goplus/llgo/internal/runtime.String" %30, i64 %32, i64 %33)
|
||||||
%32 = call { i32, i64 } @"unicode/utf8.DecodeRuneInString"(%"github.com/goplus/llgo/internal/runtime.String" %31)
|
%35 = call { i32, i64 } @"unicode/utf8.DecodeRuneInString"(%"github.com/goplus/llgo/internal/runtime.String" %34)
|
||||||
%33 = extractvalue { i32, i64 } %32, 0
|
%36 = extractvalue { i32, i64 } %35, 0
|
||||||
%34 = extractvalue { i32, i64 } %32, 1
|
%37 = extractvalue { i32, i64 } %35, 1
|
||||||
%35 = getelementptr inbounds %main.stringReader, ptr %0, i32 0, i32 1
|
|
||||||
%36 = load i64, ptr %35, align 4
|
|
||||||
%37 = add i64 %36, %34
|
|
||||||
%38 = getelementptr inbounds %main.stringReader, ptr %0, i32 0, i32 1
|
%38 = getelementptr inbounds %main.stringReader, ptr %0, i32 0, i32 1
|
||||||
store i64 %37, ptr %38, align 4
|
%39 = load i64, ptr %38, align 4
|
||||||
%mrv4 = insertvalue { i32, i64, %"github.com/goplus/llgo/internal/runtime.iface" } poison, i32 %33, 0
|
%40 = add i64 %39, %37
|
||||||
%mrv5 = insertvalue { i32, i64, %"github.com/goplus/llgo/internal/runtime.iface" } %mrv4, i64 %34, 1
|
%41 = getelementptr inbounds %main.stringReader, ptr %0, i32 0, i32 1
|
||||||
|
store i64 %40, ptr %41, align 4
|
||||||
|
%mrv4 = insertvalue { i32, i64, %"github.com/goplus/llgo/internal/runtime.iface" } poison, i32 %36, 0
|
||||||
|
%mrv5 = insertvalue { i32, i64, %"github.com/goplus/llgo/internal/runtime.iface" } %mrv4, i64 %37, 1
|
||||||
%mrv6 = insertvalue { i32, i64, %"github.com/goplus/llgo/internal/runtime.iface" } %mrv5, %"github.com/goplus/llgo/internal/runtime.iface" zeroinitializer, 2
|
%mrv6 = insertvalue { i32, i64, %"github.com/goplus/llgo/internal/runtime.iface" } %mrv5, %"github.com/goplus/llgo/internal/runtime.iface" zeroinitializer, 2
|
||||||
ret { i32, i64, %"github.com/goplus/llgo/internal/runtime.iface" } %mrv6
|
ret { i32, i64, %"github.com/goplus/llgo/internal/runtime.iface" } %mrv6
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -486,129 +486,135 @@ _llgo_3: ; preds = %_llgo_1
|
|||||||
%205 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.StringFromBytes"(%"github.com/goplus/llgo/internal/runtime.Slice" %199)
|
%205 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.StringFromBytes"(%"github.com/goplus/llgo/internal/runtime.Slice" %199)
|
||||||
%206 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.StringFromRunes"(%"github.com/goplus/llgo/internal/runtime.Slice" %204)
|
%206 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.StringFromRunes"(%"github.com/goplus/llgo/internal/runtime.Slice" %204)
|
||||||
%207 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %199, 0
|
%207 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %199, 0
|
||||||
%208 = getelementptr inbounds i8, ptr %207, i64 3
|
%208 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %199, 1
|
||||||
%209 = load i8, ptr %208, align 1
|
%209 = icmp sge i64 3, %208
|
||||||
%210 = sext i8 %209 to i32
|
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %209)
|
||||||
%211 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.StringFromRune"(i32 %210)
|
%210 = getelementptr inbounds i8, ptr %207, i64 3
|
||||||
%212 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %204, 0
|
%211 = load i8, ptr %210, align 1
|
||||||
%213 = getelementptr inbounds i32, ptr %212, i64 0
|
%212 = sext i8 %211 to i32
|
||||||
%214 = load i32, ptr %213, align 4
|
%213 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.StringFromRune"(i32 %212)
|
||||||
%215 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.StringFromRune"(i32 %214)
|
%214 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %204, 0
|
||||||
|
%215 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %204, 1
|
||||||
|
%216 = icmp sge i64 0, %215
|
||||||
|
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %216)
|
||||||
|
%217 = getelementptr inbounds i32, ptr %214, i64 0
|
||||||
|
%218 = load i32, ptr %217, align 4
|
||||||
|
%219 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.StringFromRune"(i32 %218)
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %205)
|
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %205)
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32)
|
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" %206)
|
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %206)
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32)
|
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" %211)
|
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %213)
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32)
|
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" %215)
|
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %219)
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
|
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
|
||||||
%216 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
|
||||||
%217 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %216, i32 0, i32 0
|
|
||||||
store ptr @4, ptr %217, align 8
|
|
||||||
%218 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %216, i32 0, i32 1
|
|
||||||
store i64 3, ptr %218, align 4
|
|
||||||
%219 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %216, align 8
|
|
||||||
%220 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
%220 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||||
%221 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %220, i32 0, i32 0
|
%221 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %220, i32 0, i32 0
|
||||||
store ptr @4, ptr %221, align 8
|
store ptr @4, ptr %221, align 8
|
||||||
%222 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %220, i32 0, i32 1
|
%222 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %220, i32 0, i32 1
|
||||||
store i64 3, ptr %222, align 4
|
store i64 3, ptr %222, align 4
|
||||||
%223 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %220, align 8
|
%223 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %220, align 8
|
||||||
%224 = call i1 @"github.com/goplus/llgo/internal/runtime.StringEqual"(%"github.com/goplus/llgo/internal/runtime.String" %219, %"github.com/goplus/llgo/internal/runtime.String" %223)
|
%224 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||||
%225 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
%225 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %224, i32 0, i32 0
|
||||||
%226 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %225, i32 0, i32 0
|
store ptr @4, ptr %225, align 8
|
||||||
store ptr @4, ptr %226, align 8
|
%226 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %224, i32 0, i32 1
|
||||||
%227 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %225, i32 0, i32 1
|
store i64 3, ptr %226, align 4
|
||||||
store i64 3, ptr %227, align 4
|
%227 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %224, align 8
|
||||||
%228 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %225, align 8
|
%228 = call i1 @"github.com/goplus/llgo/internal/runtime.StringEqual"(%"github.com/goplus/llgo/internal/runtime.String" %223, %"github.com/goplus/llgo/internal/runtime.String" %227)
|
||||||
%229 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
%229 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||||
%230 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %229, i32 0, i32 0
|
%230 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %229, i32 0, i32 0
|
||||||
store ptr @5, ptr %230, align 8
|
store ptr @4, ptr %230, align 8
|
||||||
%231 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %229, i32 0, i32 1
|
%231 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %229, i32 0, i32 1
|
||||||
store i64 3, ptr %231, align 4
|
store i64 3, ptr %231, align 4
|
||||||
%232 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %229, align 8
|
%232 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %229, align 8
|
||||||
%233 = call i1 @"github.com/goplus/llgo/internal/runtime.StringEqual"(%"github.com/goplus/llgo/internal/runtime.String" %228, %"github.com/goplus/llgo/internal/runtime.String" %232)
|
%233 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||||
%234 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
%234 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %233, i32 0, i32 0
|
||||||
%235 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %234, i32 0, i32 0
|
store ptr @5, ptr %234, align 8
|
||||||
store ptr @4, ptr %235, align 8
|
%235 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %233, i32 0, i32 1
|
||||||
%236 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %234, i32 0, i32 1
|
store i64 3, ptr %235, align 4
|
||||||
store i64 3, ptr %236, align 4
|
%236 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %233, align 8
|
||||||
%237 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %234, align 8
|
%237 = call i1 @"github.com/goplus/llgo/internal/runtime.StringEqual"(%"github.com/goplus/llgo/internal/runtime.String" %232, %"github.com/goplus/llgo/internal/runtime.String" %236)
|
||||||
%238 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
%238 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||||
%239 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %238, i32 0, i32 0
|
%239 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %238, i32 0, i32 0
|
||||||
store ptr @5, ptr %239, align 8
|
store ptr @4, ptr %239, align 8
|
||||||
%240 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %238, i32 0, i32 1
|
%240 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %238, i32 0, i32 1
|
||||||
store i64 3, ptr %240, align 4
|
store i64 3, ptr %240, align 4
|
||||||
%241 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %238, align 8
|
%241 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %238, align 8
|
||||||
%242 = call i1 @"github.com/goplus/llgo/internal/runtime.StringEqual"(%"github.com/goplus/llgo/internal/runtime.String" %237, %"github.com/goplus/llgo/internal/runtime.String" %241)
|
%242 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||||
%243 = xor i1 %242, true
|
%243 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %242, i32 0, i32 0
|
||||||
%244 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
store ptr @5, ptr %243, align 8
|
||||||
%245 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %244, i32 0, i32 0
|
%244 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %242, i32 0, i32 1
|
||||||
store ptr @4, ptr %245, align 8
|
store i64 3, ptr %244, align 4
|
||||||
%246 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %244, i32 0, i32 1
|
%245 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %242, align 8
|
||||||
store i64 3, ptr %246, align 4
|
%246 = call i1 @"github.com/goplus/llgo/internal/runtime.StringEqual"(%"github.com/goplus/llgo/internal/runtime.String" %241, %"github.com/goplus/llgo/internal/runtime.String" %245)
|
||||||
%247 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %244, align 8
|
%247 = xor i1 %246, true
|
||||||
%248 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
%248 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||||
%249 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %248, i32 0, i32 0
|
%249 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %248, i32 0, i32 0
|
||||||
store ptr @5, ptr %249, align 8
|
store ptr @4, ptr %249, align 8
|
||||||
%250 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %248, i32 0, i32 1
|
%250 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %248, i32 0, i32 1
|
||||||
store i64 3, ptr %250, align 4
|
store i64 3, ptr %250, align 4
|
||||||
%251 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %248, align 8
|
%251 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %248, align 8
|
||||||
%252 = call i1 @"github.com/goplus/llgo/internal/runtime.StringLess"(%"github.com/goplus/llgo/internal/runtime.String" %247, %"github.com/goplus/llgo/internal/runtime.String" %251)
|
%252 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||||
%253 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
%253 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %252, i32 0, i32 0
|
||||||
%254 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %253, i32 0, i32 0
|
store ptr @5, ptr %253, align 8
|
||||||
store ptr @4, ptr %254, align 8
|
%254 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %252, i32 0, i32 1
|
||||||
%255 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %253, i32 0, i32 1
|
store i64 3, ptr %254, align 4
|
||||||
store i64 3, ptr %255, align 4
|
%255 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %252, align 8
|
||||||
%256 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %253, align 8
|
%256 = call i1 @"github.com/goplus/llgo/internal/runtime.StringLess"(%"github.com/goplus/llgo/internal/runtime.String" %251, %"github.com/goplus/llgo/internal/runtime.String" %255)
|
||||||
%257 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
%257 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||||
%258 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %257, i32 0, i32 0
|
%258 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %257, i32 0, i32 0
|
||||||
store ptr @5, ptr %258, align 8
|
store ptr @4, ptr %258, align 8
|
||||||
%259 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %257, i32 0, i32 1
|
%259 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %257, i32 0, i32 1
|
||||||
store i64 3, ptr %259, align 4
|
store i64 3, ptr %259, align 4
|
||||||
%260 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %257, align 8
|
%260 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %257, align 8
|
||||||
%261 = call i1 @"github.com/goplus/llgo/internal/runtime.StringLess"(%"github.com/goplus/llgo/internal/runtime.String" %260, %"github.com/goplus/llgo/internal/runtime.String" %256)
|
%261 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||||
%262 = xor i1 %261, true
|
%262 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %261, i32 0, i32 0
|
||||||
%263 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
store ptr @5, ptr %262, align 8
|
||||||
%264 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %263, i32 0, i32 0
|
%263 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %261, i32 0, i32 1
|
||||||
store ptr @4, ptr %264, align 8
|
store i64 3, ptr %263, align 4
|
||||||
%265 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %263, i32 0, i32 1
|
%264 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %261, align 8
|
||||||
store i64 3, ptr %265, align 4
|
%265 = call i1 @"github.com/goplus/llgo/internal/runtime.StringLess"(%"github.com/goplus/llgo/internal/runtime.String" %264, %"github.com/goplus/llgo/internal/runtime.String" %260)
|
||||||
%266 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %263, align 8
|
%266 = xor i1 %265, true
|
||||||
%267 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
%267 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||||
%268 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %267, i32 0, i32 0
|
%268 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %267, i32 0, i32 0
|
||||||
store ptr @5, ptr %268, align 8
|
store ptr @4, ptr %268, align 8
|
||||||
%269 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %267, i32 0, i32 1
|
%269 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %267, i32 0, i32 1
|
||||||
store i64 3, ptr %269, align 4
|
store i64 3, ptr %269, align 4
|
||||||
%270 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %267, align 8
|
%270 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %267, align 8
|
||||||
%271 = call i1 @"github.com/goplus/llgo/internal/runtime.StringLess"(%"github.com/goplus/llgo/internal/runtime.String" %270, %"github.com/goplus/llgo/internal/runtime.String" %266)
|
%271 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||||
%272 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
%272 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %271, i32 0, i32 0
|
||||||
%273 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %272, i32 0, i32 0
|
store ptr @5, ptr %272, align 8
|
||||||
store ptr @4, ptr %273, align 8
|
%273 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %271, i32 0, i32 1
|
||||||
%274 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %272, i32 0, i32 1
|
store i64 3, ptr %273, align 4
|
||||||
store i64 3, ptr %274, align 4
|
%274 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %271, align 8
|
||||||
%275 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %272, align 8
|
%275 = call i1 @"github.com/goplus/llgo/internal/runtime.StringLess"(%"github.com/goplus/llgo/internal/runtime.String" %274, %"github.com/goplus/llgo/internal/runtime.String" %270)
|
||||||
%276 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
%276 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||||
%277 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %276, i32 0, i32 0
|
%277 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %276, i32 0, i32 0
|
||||||
store ptr @5, ptr %277, align 8
|
store ptr @4, ptr %277, align 8
|
||||||
%278 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %276, i32 0, i32 1
|
%278 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %276, i32 0, i32 1
|
||||||
store i64 3, ptr %278, align 4
|
store i64 3, ptr %278, align 4
|
||||||
%279 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %276, align 8
|
%279 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %276, align 8
|
||||||
%280 = call i1 @"github.com/goplus/llgo/internal/runtime.StringLess"(%"github.com/goplus/llgo/internal/runtime.String" %275, %"github.com/goplus/llgo/internal/runtime.String" %279)
|
%280 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||||
%281 = xor i1 %280, true
|
%281 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %280, i32 0, i32 0
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.PrintBool"(i1 %224)
|
store ptr @5, ptr %281, align 8
|
||||||
|
%282 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %280, i32 0, i32 1
|
||||||
|
store i64 3, ptr %282, align 4
|
||||||
|
%283 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %280, align 8
|
||||||
|
%284 = call i1 @"github.com/goplus/llgo/internal/runtime.StringLess"(%"github.com/goplus/llgo/internal/runtime.String" %279, %"github.com/goplus/llgo/internal/runtime.String" %283)
|
||||||
|
%285 = xor i1 %284, true
|
||||||
|
call void @"github.com/goplus/llgo/internal/runtime.PrintBool"(i1 %228)
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32)
|
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32)
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.PrintBool"(i1 %233)
|
call void @"github.com/goplus/llgo/internal/runtime.PrintBool"(i1 %237)
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32)
|
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32)
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.PrintBool"(i1 %243)
|
call void @"github.com/goplus/llgo/internal/runtime.PrintBool"(i1 %247)
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32)
|
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32)
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.PrintBool"(i1 %252)
|
call void @"github.com/goplus/llgo/internal/runtime.PrintBool"(i1 %256)
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32)
|
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32)
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.PrintBool"(i1 %262)
|
call void @"github.com/goplus/llgo/internal/runtime.PrintBool"(i1 %266)
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32)
|
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32)
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.PrintBool"(i1 %271)
|
call void @"github.com/goplus/llgo/internal/runtime.PrintBool"(i1 %275)
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32)
|
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32)
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.PrintBool"(i1 %281)
|
call void @"github.com/goplus/llgo/internal/runtime.PrintBool"(i1 %285)
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
|
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
|
||||||
ret i32 0
|
ret i32 0
|
||||||
}
|
}
|
||||||
@@ -701,6 +707,8 @@ declare %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/ll
|
|||||||
|
|
||||||
declare %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.StringFromRunes"(%"github.com/goplus/llgo/internal/runtime.Slice")
|
declare %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.StringFromRunes"(%"github.com/goplus/llgo/internal/runtime.Slice")
|
||||||
|
|
||||||
|
declare void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1)
|
||||||
|
|
||||||
declare %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.StringFromRune"(i32)
|
declare %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.StringFromRune"(i32)
|
||||||
|
|
||||||
declare i1 @"github.com/goplus/llgo/internal/runtime.StringEqual"(%"github.com/goplus/llgo/internal/runtime.String", %"github.com/goplus/llgo/internal/runtime.String")
|
declare i1 @"github.com/goplus/llgo/internal/runtime.StringEqual"(%"github.com/goplus/llgo/internal/runtime.String", %"github.com/goplus/llgo/internal/runtime.String")
|
||||||
|
|||||||
@@ -24,19 +24,22 @@ _llgo_0:
|
|||||||
br label %_llgo_1
|
br label %_llgo_1
|
||||||
|
|
||||||
_llgo_1: ; preds = %_llgo_2, %_llgo_0
|
_llgo_1: ; preds = %_llgo_2, %_llgo_0
|
||||||
%6 = phi %"github.com/goplus/llgo/internal/runtime.String" [ %5, %_llgo_0 ], [ %14, %_llgo_2 ]
|
%6 = phi %"github.com/goplus/llgo/internal/runtime.String" [ %5, %_llgo_0 ], [ %17, %_llgo_2 ]
|
||||||
%7 = phi i64 [ -1, %_llgo_0 ], [ %8, %_llgo_2 ]
|
%7 = phi i64 [ -1, %_llgo_0 ], [ %8, %_llgo_2 ]
|
||||||
%8 = add i64 %7, 1
|
%8 = add i64 %7, 1
|
||||||
%9 = icmp slt i64 %8, %1
|
%9 = icmp slt i64 %8, %1
|
||||||
br i1 %9, label %_llgo_2, label %_llgo_3
|
br i1 %9, label %_llgo_2, label %_llgo_3
|
||||||
|
|
||||||
_llgo_2: ; preds = %_llgo_1
|
_llgo_2: ; preds = %_llgo_1
|
||||||
%10 = icmp slt i64 %8, 0
|
%10 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %0, 0
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %10)
|
%11 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %0, 1
|
||||||
%11 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %0, 0
|
%12 = icmp slt i64 %8, 0
|
||||||
%12 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %11, i64 %8
|
%13 = icmp sge i64 %8, %11
|
||||||
%13 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %12, align 8
|
%14 = or i1 %13, %12
|
||||||
%14 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.StringCat"(%"github.com/goplus/llgo/internal/runtime.String" %6, %"github.com/goplus/llgo/internal/runtime.String" %13)
|
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %14)
|
||||||
|
%15 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %10, i64 %8
|
||||||
|
%16 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %15, align 8
|
||||||
|
%17 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.StringCat"(%"github.com/goplus/llgo/internal/runtime.String" %6, %"github.com/goplus/llgo/internal/runtime.String" %16)
|
||||||
br label %_llgo_1
|
br label %_llgo_1
|
||||||
|
|
||||||
_llgo_3: ; preds = %_llgo_1
|
_llgo_3: ; preds = %_llgo_1
|
||||||
|
|||||||
@@ -13,24 +13,28 @@ source_filename = "main"
|
|||||||
|
|
||||||
define ptr @main.Basic(i64 %0) {
|
define ptr @main.Basic(i64 %0) {
|
||||||
_llgo_0:
|
_llgo_0:
|
||||||
%1 = getelementptr inbounds ptr, ptr @main.basicTypes, i64 %0
|
%1 = icmp sge i64 %0, 25
|
||||||
%2 = load ptr, ptr %1, align 8
|
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %1)
|
||||||
ret ptr %2
|
%2 = getelementptr inbounds ptr, ptr @main.basicTypes, i64 %0
|
||||||
|
%3 = load ptr, ptr %2, align 8
|
||||||
|
ret ptr %3
|
||||||
}
|
}
|
||||||
|
|
||||||
define ptr @main.basicType(i64 %0) {
|
define ptr @main.basicType(i64 %0) {
|
||||||
_llgo_0:
|
_llgo_0:
|
||||||
%1 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 72)
|
%1 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 72)
|
||||||
%2 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Type", ptr %1, i32 0, i32 0
|
%2 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Type", ptr %1, i32 0, i32 0
|
||||||
%3 = getelementptr inbounds i64, ptr @main.sizeBasicTypes, i64 %0
|
%3 = icmp sge i64 %0, 25
|
||||||
%4 = load i64, ptr %3, align 4
|
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %3)
|
||||||
%5 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Type", ptr %1, i32 0, i32 2
|
%4 = getelementptr inbounds i64, ptr @main.sizeBasicTypes, i64 %0
|
||||||
%6 = trunc i64 %0 to i32
|
%5 = load i64, ptr %4, align 4
|
||||||
%7 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Type", ptr %1, i32 0, i32 6
|
%6 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Type", ptr %1, i32 0, i32 2
|
||||||
%8 = trunc i64 %0 to i8
|
%7 = trunc i64 %0 to i32
|
||||||
store i64 %4, ptr %2, align 4
|
%8 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Type", ptr %1, i32 0, i32 6
|
||||||
store i32 %6, ptr %5, align 4
|
%9 = trunc i64 %0 to i8
|
||||||
store i8 %8, ptr %7, align 1
|
store i64 %5, ptr %2, align 4
|
||||||
|
store i32 %7, ptr %6, align 4
|
||||||
|
store i8 %9, ptr %8, align 1
|
||||||
ret ptr %1
|
ret ptr %1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,6 +71,8 @@ _llgo_0:
|
|||||||
ret i32 0
|
ret i32 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1)
|
||||||
|
|
||||||
declare ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64)
|
declare ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64)
|
||||||
|
|
||||||
declare void @"github.com/goplus/llgo/internal/abi.init"()
|
declare void @"github.com/goplus/llgo/internal/abi.init"()
|
||||||
|
|||||||
@@ -110,55 +110,64 @@ _llgo_0:
|
|||||||
store i64 6, ptr %51, align 4
|
store i64 6, ptr %51, align 4
|
||||||
%52 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %49, align 8
|
%52 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %49, align 8
|
||||||
%53 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %52, 0
|
%53 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %52, 0
|
||||||
%54 = getelementptr inbounds i8, ptr %53, i64 2
|
%54 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %52, 1
|
||||||
%55 = load i8, ptr %54, align 1
|
%55 = icmp sge i64 2, %54
|
||||||
%56 = sext i8 %55 to i32
|
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %55)
|
||||||
%57 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.StringFromRune"(i32 %56)
|
%56 = getelementptr inbounds i8, ptr %53, i64 2
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %57)
|
%57 = load i8, ptr %56, align 1
|
||||||
|
%58 = sext i8 %57 to i32
|
||||||
|
%59 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.StringFromRune"(i32 %58)
|
||||||
|
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %59)
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
|
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
|
||||||
%58 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
%60 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||||
%59 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %58, i32 0, i32 0
|
%61 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %60, i32 0, i32 0
|
||||||
store ptr @0, ptr %59, align 8
|
store ptr @0, ptr %61, align 8
|
||||||
%60 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %58, i32 0, i32 1
|
%62 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %60, i32 0, i32 1
|
||||||
store i64 6, ptr %60, align 4
|
store i64 6, ptr %62, align 4
|
||||||
%61 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %58, align 8
|
%63 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %60, align 8
|
||||||
%62 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %61, 0
|
%64 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %63, 0
|
||||||
%63 = getelementptr inbounds i8, ptr %62, i64 1
|
%65 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %63, 1
|
||||||
%64 = load i8, ptr %63, align 1
|
%66 = icmp sge i64 1, %65
|
||||||
%65 = sext i8 %64 to i32
|
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %66)
|
||||||
%66 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.StringFromRune"(i32 %65)
|
%67 = getelementptr inbounds i8, ptr %64, i64 1
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %66)
|
%68 = load i8, ptr %67, align 1
|
||||||
|
%69 = sext i8 %68 to i32
|
||||||
|
%70 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.StringFromRune"(i32 %69)
|
||||||
|
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %70)
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
|
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
|
||||||
%67 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 16)
|
%71 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 16)
|
||||||
%68 = getelementptr inbounds i64, ptr %67, i64 0
|
%72 = getelementptr inbounds i64, ptr %71, i64 0
|
||||||
%69 = getelementptr inbounds i64, ptr %67, i64 1
|
%73 = getelementptr inbounds i64, ptr %71, i64 1
|
||||||
store i64 1, ptr %68, align 4
|
store i64 1, ptr %72, align 4
|
||||||
store i64 2, ptr %69, align 4
|
store i64 2, ptr %73, align 4
|
||||||
%70 = getelementptr inbounds i64, ptr %67, i64 1
|
%74 = getelementptr inbounds i64, ptr %71, i64 1
|
||||||
%71 = load i64, ptr %70, align 4
|
%75 = load i64, ptr %74, align 4
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %71)
|
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %75)
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
|
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
|
||||||
%72 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 32)
|
%76 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 32)
|
||||||
%73 = getelementptr inbounds i64, ptr %72, i64 0
|
%77 = getelementptr inbounds i64, ptr %76, i64 0
|
||||||
store i64 1, ptr %73, align 4
|
store i64 1, ptr %77, align 4
|
||||||
%74 = getelementptr inbounds i64, ptr %72, i64 1
|
%78 = getelementptr inbounds i64, ptr %76, i64 1
|
||||||
store i64 2, ptr %74, align 4
|
store i64 2, ptr %78, align 4
|
||||||
%75 = getelementptr inbounds i64, ptr %72, i64 2
|
%79 = getelementptr inbounds i64, ptr %76, i64 2
|
||||||
store i64 3, ptr %75, align 4
|
store i64 3, ptr %79, align 4
|
||||||
%76 = getelementptr inbounds i64, ptr %72, i64 3
|
%80 = getelementptr inbounds i64, ptr %76, i64 3
|
||||||
store i64 4, ptr %76, align 4
|
|
||||||
%77 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8
|
|
||||||
%78 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %77, i32 0, i32 0
|
|
||||||
store ptr %72, ptr %78, align 8
|
|
||||||
%79 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %77, i32 0, i32 1
|
|
||||||
store i64 4, ptr %79, align 4
|
|
||||||
%80 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %77, i32 0, i32 2
|
|
||||||
store i64 4, ptr %80, align 4
|
store i64 4, ptr %80, align 4
|
||||||
%81 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %77, align 8
|
%81 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8
|
||||||
%82 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %81, 0
|
%82 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %81, i32 0, i32 0
|
||||||
%83 = getelementptr inbounds i64, ptr %82, i64 1
|
store ptr %76, ptr %82, align 8
|
||||||
%84 = load i64, ptr %83, align 4
|
%83 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %81, i32 0, i32 1
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %84)
|
store i64 4, ptr %83, align 4
|
||||||
|
%84 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %81, i32 0, i32 2
|
||||||
|
store i64 4, ptr %84, align 4
|
||||||
|
%85 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %81, align 8
|
||||||
|
%86 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %85, 0
|
||||||
|
%87 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %85, 1
|
||||||
|
%88 = icmp sge i64 1, %87
|
||||||
|
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %88)
|
||||||
|
%89 = getelementptr inbounds i64, ptr %86, i64 1
|
||||||
|
%90 = load i64, ptr %89, align 4
|
||||||
|
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %90)
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
|
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 0)
|
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 0)
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
|
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
|
||||||
@@ -173,6 +182,8 @@ declare void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64)
|
|||||||
|
|
||||||
declare void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8)
|
declare void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8)
|
||||||
|
|
||||||
|
declare void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1)
|
||||||
|
|
||||||
declare %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.StringFromRune"(i32)
|
declare %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.StringFromRune"(i32)
|
||||||
|
|
||||||
declare void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String")
|
declare void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String")
|
||||||
|
|||||||
@@ -36,11 +36,14 @@ _llgo_2: ; preds = %_llgo_1
|
|||||||
%13 = extractvalue { ptr, ptr } %1, 1
|
%13 = extractvalue { ptr, ptr } %1, 1
|
||||||
%14 = extractvalue { ptr, ptr } %1, 0
|
%14 = extractvalue { ptr, ptr } %1, 0
|
||||||
%15 = call i32 %14(ptr %13)
|
%15 = call i32 %14(ptr %13)
|
||||||
%16 = icmp slt i64 %11, 0
|
%16 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %8, 0
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %16)
|
%17 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %8, 1
|
||||||
%17 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %8, 0
|
%18 = icmp slt i64 %11, 0
|
||||||
%18 = getelementptr inbounds i32, ptr %17, i64 %11
|
%19 = icmp sge i64 %11, %17
|
||||||
store i32 %15, ptr %18, align 4
|
%20 = or i1 %19, %18
|
||||||
|
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %20)
|
||||||
|
%21 = getelementptr inbounds i32, ptr %16, i64 %11
|
||||||
|
store i32 %15, ptr %21, align 4
|
||||||
br label %_llgo_1
|
br label %_llgo_1
|
||||||
|
|
||||||
_llgo_3: ; preds = %_llgo_1
|
_llgo_3: ; preds = %_llgo_1
|
||||||
@@ -95,75 +98,84 @@ _llgo_1: ; preds = %_llgo_2, %_llgo_0
|
|||||||
br i1 %10, label %_llgo_2, label %_llgo_3
|
br i1 %10, label %_llgo_2, label %_llgo_3
|
||||||
|
|
||||||
_llgo_2: ; preds = %_llgo_1
|
_llgo_2: ; preds = %_llgo_1
|
||||||
%11 = icmp slt i64 %9, 0
|
%11 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %6, 0
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %11)
|
%12 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %6, 1
|
||||||
%12 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %6, 0
|
%13 = icmp slt i64 %9, 0
|
||||||
%13 = getelementptr inbounds i32, ptr %12, i64 %9
|
%14 = icmp sge i64 %9, %12
|
||||||
%14 = load i32, ptr %13, align 4
|
%15 = or i1 %14, %13
|
||||||
%15 = call i32 (ptr, ...) @printf(ptr @0, i32 %14)
|
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %15)
|
||||||
|
%16 = getelementptr inbounds i32, ptr %11, i64 %9
|
||||||
|
%17 = load i32, ptr %16, align 4
|
||||||
|
%18 = call i32 (ptr, ...) @printf(ptr @0, i32 %17)
|
||||||
br label %_llgo_1
|
br label %_llgo_1
|
||||||
|
|
||||||
_llgo_3: ; preds = %_llgo_1
|
_llgo_3: ; preds = %_llgo_1
|
||||||
%16 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 4)
|
%19 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 4)
|
||||||
store i32 1, ptr %16, align 4
|
store i32 1, ptr %19, align 4
|
||||||
%17 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 8)
|
%20 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 8)
|
||||||
%18 = getelementptr inbounds { ptr }, ptr %17, i32 0, i32 0
|
%21 = getelementptr inbounds { ptr }, ptr %20, i32 0, i32 0
|
||||||
store ptr %16, ptr %18, align 8
|
store ptr %19, ptr %21, align 8
|
||||||
%19 = alloca { ptr, ptr }, align 8
|
%22 = alloca { ptr, ptr }, align 8
|
||||||
%20 = getelementptr inbounds { ptr, ptr }, ptr %19, i32 0, i32 0
|
%23 = getelementptr inbounds { ptr, ptr }, ptr %22, i32 0, i32 0
|
||||||
store ptr @"main.main$1", ptr %20, align 8
|
store ptr @"main.main$1", ptr %23, align 8
|
||||||
%21 = getelementptr inbounds { ptr, ptr }, ptr %19, i32 0, i32 1
|
%24 = getelementptr inbounds { ptr, ptr }, ptr %22, i32 0, i32 1
|
||||||
store ptr %17, ptr %21, align 8
|
store ptr %20, ptr %24, align 8
|
||||||
%22 = load { ptr, ptr }, ptr %19, align 8
|
%25 = load { ptr, ptr }, ptr %22, align 8
|
||||||
%23 = call %"github.com/goplus/llgo/internal/runtime.Slice" @main.genInts(i64 5, { ptr, ptr } %22)
|
%26 = call %"github.com/goplus/llgo/internal/runtime.Slice" @main.genInts(i64 5, { ptr, ptr } %25)
|
||||||
%24 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %23, 1
|
%27 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %26, 1
|
||||||
br label %_llgo_4
|
br label %_llgo_4
|
||||||
|
|
||||||
_llgo_4: ; preds = %_llgo_5, %_llgo_3
|
_llgo_4: ; preds = %_llgo_5, %_llgo_3
|
||||||
%25 = phi i64 [ -1, %_llgo_3 ], [ %26, %_llgo_5 ]
|
%28 = phi i64 [ -1, %_llgo_3 ], [ %29, %_llgo_5 ]
|
||||||
%26 = add i64 %25, 1
|
%29 = add i64 %28, 1
|
||||||
%27 = icmp slt i64 %26, %24
|
%30 = icmp slt i64 %29, %27
|
||||||
br i1 %27, label %_llgo_5, label %_llgo_6
|
br i1 %30, label %_llgo_5, label %_llgo_6
|
||||||
|
|
||||||
_llgo_5: ; preds = %_llgo_4
|
_llgo_5: ; preds = %_llgo_4
|
||||||
%28 = icmp slt i64 %26, 0
|
%31 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %26, 0
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %28)
|
%32 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %26, 1
|
||||||
%29 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %23, 0
|
%33 = icmp slt i64 %29, 0
|
||||||
%30 = getelementptr inbounds i32, ptr %29, i64 %26
|
%34 = icmp sge i64 %29, %32
|
||||||
%31 = load i32, ptr %30, align 4
|
%35 = or i1 %34, %33
|
||||||
%32 = call i32 (ptr, ...) @printf(ptr @1, i32 %31)
|
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %35)
|
||||||
|
%36 = getelementptr inbounds i32, ptr %31, i64 %29
|
||||||
|
%37 = load i32, ptr %36, align 4
|
||||||
|
%38 = call i32 (ptr, ...) @printf(ptr @1, i32 %37)
|
||||||
br label %_llgo_4
|
br label %_llgo_4
|
||||||
|
|
||||||
_llgo_6: ; preds = %_llgo_4
|
_llgo_6: ; preds = %_llgo_4
|
||||||
%33 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 4)
|
%39 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 4)
|
||||||
%34 = getelementptr inbounds %main.generator, ptr %33, i32 0, i32 0
|
%40 = getelementptr inbounds %main.generator, ptr %39, i32 0, i32 0
|
||||||
store i32 1, ptr %34, align 4
|
store i32 1, ptr %40, align 4
|
||||||
%35 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 8)
|
%41 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 8)
|
||||||
%36 = getelementptr inbounds { ptr }, ptr %35, i32 0, i32 0
|
%42 = getelementptr inbounds { ptr }, ptr %41, i32 0, i32 0
|
||||||
store ptr %33, ptr %36, align 8
|
store ptr %39, ptr %42, align 8
|
||||||
%37 = alloca { ptr, ptr }, align 8
|
%43 = alloca { ptr, ptr }, align 8
|
||||||
%38 = getelementptr inbounds { ptr, ptr }, ptr %37, i32 0, i32 0
|
%44 = getelementptr inbounds { ptr, ptr }, ptr %43, i32 0, i32 0
|
||||||
store ptr @"main.next$bound", ptr %38, align 8
|
store ptr @"main.next$bound", ptr %44, align 8
|
||||||
%39 = getelementptr inbounds { ptr, ptr }, ptr %37, i32 0, i32 1
|
%45 = getelementptr inbounds { ptr, ptr }, ptr %43, i32 0, i32 1
|
||||||
store ptr %35, ptr %39, align 8
|
store ptr %41, ptr %45, align 8
|
||||||
%40 = load { ptr, ptr }, ptr %37, align 8
|
%46 = load { ptr, ptr }, ptr %43, align 8
|
||||||
%41 = call %"github.com/goplus/llgo/internal/runtime.Slice" @main.genInts(i64 5, { ptr, ptr } %40)
|
%47 = call %"github.com/goplus/llgo/internal/runtime.Slice" @main.genInts(i64 5, { ptr, ptr } %46)
|
||||||
%42 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %41, 1
|
%48 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %47, 1
|
||||||
br label %_llgo_7
|
br label %_llgo_7
|
||||||
|
|
||||||
_llgo_7: ; preds = %_llgo_8, %_llgo_6
|
_llgo_7: ; preds = %_llgo_8, %_llgo_6
|
||||||
%43 = phi i64 [ -1, %_llgo_6 ], [ %44, %_llgo_8 ]
|
%49 = phi i64 [ -1, %_llgo_6 ], [ %50, %_llgo_8 ]
|
||||||
%44 = add i64 %43, 1
|
%50 = add i64 %49, 1
|
||||||
%45 = icmp slt i64 %44, %42
|
%51 = icmp slt i64 %50, %48
|
||||||
br i1 %45, label %_llgo_8, label %_llgo_9
|
br i1 %51, label %_llgo_8, label %_llgo_9
|
||||||
|
|
||||||
_llgo_8: ; preds = %_llgo_7
|
_llgo_8: ; preds = %_llgo_7
|
||||||
%46 = icmp slt i64 %44, 0
|
%52 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %47, 0
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %46)
|
%53 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %47, 1
|
||||||
%47 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %41, 0
|
%54 = icmp slt i64 %50, 0
|
||||||
%48 = getelementptr inbounds i32, ptr %47, i64 %44
|
%55 = icmp sge i64 %50, %53
|
||||||
%49 = load i32, ptr %48, align 4
|
%56 = or i1 %55, %54
|
||||||
%50 = call i32 (ptr, ...) @printf(ptr @2, i32 %49)
|
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %56)
|
||||||
|
%57 = getelementptr inbounds i32, ptr %52, i64 %50
|
||||||
|
%58 = load i32, ptr %57, align 4
|
||||||
|
%59 = call i32 (ptr, ...) @printf(ptr @2, i32 %58)
|
||||||
br label %_llgo_7
|
br label %_llgo_7
|
||||||
|
|
||||||
_llgo_9: ; preds = %_llgo_7
|
_llgo_9: ; preds = %_llgo_7
|
||||||
|
|||||||
@@ -49,10 +49,12 @@ _llgo_1: ; preds = %_llgo_2, %_llgo_0
|
|||||||
|
|
||||||
_llgo_2: ; preds = %_llgo_1
|
_llgo_2: ; preds = %_llgo_1
|
||||||
%13 = icmp slt i64 %11, 0
|
%13 = icmp slt i64 %11, 0
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %13)
|
%14 = icmp sge i64 %11, 5
|
||||||
%14 = getelementptr inbounds i64, ptr %2, i64 %11
|
%15 = or i1 %14, %13
|
||||||
%15 = load i64, ptr %14, align 4
|
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %15)
|
||||||
%16 = call i32 (ptr, ...) @printf(ptr @0, i64 %15)
|
%16 = getelementptr inbounds i64, ptr %2, i64 %11
|
||||||
|
%17 = load i64, ptr %16, align 4
|
||||||
|
%18 = call i32 (ptr, ...) @printf(ptr @0, i64 %17)
|
||||||
br label %_llgo_1
|
br label %_llgo_1
|
||||||
|
|
||||||
_llgo_3: ; preds = %_llgo_1
|
_llgo_3: ; preds = %_llgo_1
|
||||||
|
|||||||
@@ -55,19 +55,22 @@ _llgo_0:
|
|||||||
br label %_llgo_1
|
br label %_llgo_1
|
||||||
|
|
||||||
_llgo_1: ; preds = %_llgo_2, %_llgo_0
|
_llgo_1: ; preds = %_llgo_2, %_llgo_0
|
||||||
%2 = phi i64 [ 0, %_llgo_0 ], [ %10, %_llgo_2 ]
|
%2 = phi i64 [ 0, %_llgo_0 ], [ %13, %_llgo_2 ]
|
||||||
%3 = phi i64 [ -1, %_llgo_0 ], [ %4, %_llgo_2 ]
|
%3 = phi i64 [ -1, %_llgo_0 ], [ %4, %_llgo_2 ]
|
||||||
%4 = add i64 %3, 1
|
%4 = add i64 %3, 1
|
||||||
%5 = icmp slt i64 %4, %1
|
%5 = icmp slt i64 %4, %1
|
||||||
br i1 %5, label %_llgo_2, label %_llgo_3
|
br i1 %5, label %_llgo_2, label %_llgo_3
|
||||||
|
|
||||||
_llgo_2: ; preds = %_llgo_1
|
_llgo_2: ; preds = %_llgo_1
|
||||||
%6 = icmp slt i64 %4, 0
|
%6 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %0, 0
|
||||||
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %6)
|
%7 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %0, 1
|
||||||
%7 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %0, 0
|
%8 = icmp slt i64 %4, 0
|
||||||
%8 = getelementptr inbounds i64, ptr %7, i64 %4
|
%9 = icmp sge i64 %4, %7
|
||||||
%9 = load i64, ptr %8, align 4
|
%10 = or i1 %9, %8
|
||||||
%10 = add i64 %2, %9
|
call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %10)
|
||||||
|
%11 = getelementptr inbounds i64, ptr %6, i64 %4
|
||||||
|
%12 = load i64, ptr %11, align 4
|
||||||
|
%13 = add i64 %2, %12
|
||||||
br label %_llgo_1
|
br label %_llgo_1
|
||||||
|
|
||||||
_llgo_3: ; preds = %_llgo_1
|
_llgo_3: ; preds = %_llgo_1
|
||||||
|
|||||||
@@ -125,34 +125,107 @@ func (b Builder) IndexAddr(x, idx Expr) Expr {
|
|||||||
if debugInstr {
|
if debugInstr {
|
||||||
log.Printf("IndexAddr %v, %v\n", x.impl, idx.impl)
|
log.Printf("IndexAddr %v, %v\n", x.impl, idx.impl)
|
||||||
}
|
}
|
||||||
idx = b.checkIndex(idx)
|
|
||||||
prog := b.Prog
|
prog := b.Prog
|
||||||
telem := prog.Index(x.Type)
|
telem := prog.Index(x.Type)
|
||||||
pt := prog.Pointer(telem)
|
pt := prog.Pointer(telem)
|
||||||
switch x.raw.Type.Underlying().(type) {
|
switch t := x.raw.Type.Underlying().(type) {
|
||||||
case *types.Slice:
|
case *types.Slice:
|
||||||
ptr := b.SliceData(x)
|
ptr := b.SliceData(x)
|
||||||
|
max := b.SliceLen(x)
|
||||||
|
idx = b.checkIndex(idx, max)
|
||||||
indices := []llvm.Value{idx.impl}
|
indices := []llvm.Value{idx.impl}
|
||||||
return Expr{llvm.CreateInBoundsGEP(b.impl, telem.ll, ptr.impl, indices), pt}
|
return Expr{llvm.CreateInBoundsGEP(b.impl, telem.ll, ptr.impl, indices), pt}
|
||||||
|
case *types.Pointer:
|
||||||
|
ar := t.Elem().Underlying().(*types.Array)
|
||||||
|
max := prog.IntVal(uint64(ar.Len()), prog.Int())
|
||||||
|
idx = b.checkIndex(idx, max)
|
||||||
}
|
}
|
||||||
// case *types.Pointer:
|
|
||||||
indices := []llvm.Value{idx.impl}
|
indices := []llvm.Value{idx.impl}
|
||||||
return Expr{llvm.CreateInBoundsGEP(b.impl, telem.ll, x.impl, indices), pt}
|
return Expr{llvm.CreateInBoundsGEP(b.impl, telem.ll, x.impl, indices), pt}
|
||||||
}
|
}
|
||||||
|
|
||||||
// check index >= 0 and size to uint
|
func isConstantInt(x Expr) (v int64, ok bool) {
|
||||||
func (b Builder) checkIndex(idx Expr) Expr {
|
if rv := x.impl.IsAConstantInt(); !rv.IsNil() {
|
||||||
prog := b.Prog
|
v = rv.SExtValue()
|
||||||
if needsNegativeCheck(idx) {
|
ok = true
|
||||||
zero := llvm.ConstInt(idx.ll, 0, false)
|
}
|
||||||
check := Expr{llvm.CreateICmp(b.impl, llvm.IntSLT, idx.impl, zero), prog.Bool()}
|
return
|
||||||
b.InlineCall(b.Pkg.rtFunc("AssertIndexRange"), check)
|
}
|
||||||
|
|
||||||
|
func isConstantUint(x Expr) (v uint64, ok bool) {
|
||||||
|
if rv := x.impl.IsAConstantInt(); !rv.IsNil() {
|
||||||
|
v = rv.ZExtValue()
|
||||||
|
ok = true
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func checkRange(idx Expr, max Expr) (checkMin, checkMax bool) {
|
||||||
|
if idx.kind == vkSigned {
|
||||||
|
if v, ok := isConstantInt(idx); ok {
|
||||||
|
if v < 0 {
|
||||||
|
checkMin = true
|
||||||
|
}
|
||||||
|
if m, ok := isConstantInt(max); ok {
|
||||||
|
if v >= m {
|
||||||
|
checkMax = true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
checkMax = true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
checkMin = true
|
||||||
|
checkMax = true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if v, ok := isConstantUint(idx); ok {
|
||||||
|
if m, ok := isConstantUint(max); ok {
|
||||||
|
if v >= m {
|
||||||
|
checkMax = true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
checkMax = true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
checkMax = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// check index >= 0 && index < max and size to uint
|
||||||
|
func (b Builder) checkIndex(idx Expr, max Expr) Expr {
|
||||||
|
prog := b.Prog
|
||||||
|
// check range
|
||||||
|
checkMin, checkMax := checkRange(idx, max)
|
||||||
|
// fit size
|
||||||
|
var typ Type
|
||||||
|
if idx.kind == vkSigned {
|
||||||
|
typ = prog.Int()
|
||||||
|
} else {
|
||||||
|
typ = prog.Uint()
|
||||||
}
|
}
|
||||||
typ := prog.Uint()
|
|
||||||
if prog.SizeOf(idx.Type) < prog.SizeOf(typ) {
|
if prog.SizeOf(idx.Type) < prog.SizeOf(typ) {
|
||||||
idx.Type = typ
|
idx.Type = typ
|
||||||
idx.impl = castUintptr(b, idx.impl, typ)
|
idx.impl = castUintptr(b, idx.impl, typ)
|
||||||
}
|
}
|
||||||
|
// check range expr
|
||||||
|
var check Expr
|
||||||
|
if checkMin {
|
||||||
|
zero := llvm.ConstInt(idx.ll, 0, false)
|
||||||
|
check = Expr{llvm.CreateICmp(b.impl, llvm.IntSLT, idx.impl, zero), prog.Bool()}
|
||||||
|
}
|
||||||
|
if checkMax {
|
||||||
|
r := Expr{llvm.CreateICmp(b.impl, llvm.IntSGE, idx.impl, max.impl), prog.Bool()}
|
||||||
|
if check.IsNil() {
|
||||||
|
check = r
|
||||||
|
} else {
|
||||||
|
check = Expr{b.impl.CreateOr(r.impl, check.impl, ""), prog.Bool()}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !check.IsNil() {
|
||||||
|
b.InlineCall(b.Pkg.rtFunc("AssertIndexRange"), check)
|
||||||
|
}
|
||||||
return idx
|
return idx
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,6 +243,7 @@ func (b Builder) Index(x, idx Expr, addr func(Expr) (Expr, bool)) Expr {
|
|||||||
prog := b.Prog
|
prog := b.Prog
|
||||||
var telem Type
|
var telem Type
|
||||||
var ptr Expr
|
var ptr Expr
|
||||||
|
var max Expr
|
||||||
var zero bool
|
var zero bool
|
||||||
switch t := x.raw.Type.Underlying().(type) {
|
switch t := x.raw.Type.Underlying().(type) {
|
||||||
case *types.Basic:
|
case *types.Basic:
|
||||||
@@ -178,6 +252,7 @@ func (b Builder) Index(x, idx Expr, addr func(Expr) (Expr, bool)) Expr {
|
|||||||
}
|
}
|
||||||
telem = prog.rawType(types.Typ[types.Byte])
|
telem = prog.rawType(types.Typ[types.Byte])
|
||||||
ptr = b.StringData(x)
|
ptr = b.StringData(x)
|
||||||
|
max = b.StringLen(x)
|
||||||
case *types.Array:
|
case *types.Array:
|
||||||
telem = prog.Index(x.Type)
|
telem = prog.Index(x.Type)
|
||||||
if addr != nil {
|
if addr != nil {
|
||||||
@@ -190,9 +265,9 @@ func (b Builder) Index(x, idx Expr, addr func(Expr) (Expr, bool)) Expr {
|
|||||||
*/
|
*/
|
||||||
panic("unreachable")
|
panic("unreachable")
|
||||||
}
|
}
|
||||||
|
max = prog.IntVal(uint64(t.Len()), prog.Int())
|
||||||
}
|
}
|
||||||
// TODO check range
|
idx = b.checkIndex(idx, max)
|
||||||
idx = b.checkIndex(idx)
|
|
||||||
if zero {
|
if zero {
|
||||||
return Expr{llvm.ConstNull(telem.ll), telem}
|
return Expr{llvm.ConstNull(telem.ll), telem}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user