Skip to content

Instantly share code, notes, and snippets.

@brson
Created April 7, 2011 23:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brson/909023 to your computer and use it in GitHub Desktop.
Save brson/909023 to your computer and use it in GitHub Desktop.
define internal fastcc void @_rust_fn1_id(i8*, %task*, %1*, %tydesc*, i8*) {
allocas:
br label %"function top level3"
"function top level3": ; preds = %allocas
%5 = getelementptr %tydesc* %3, i32 0, i32 0
%6 = load %tydesc*** %5
%7 = getelementptr %tydesc* %3, i32 0, i32 3
%8 = load void (i1*, %task*, i1*, %tydesc**, i8*)** %7
%9 = ptrtoint void (i1*, %task*, i1*, %tydesc**, i8*)* %8 to i32
%10 = ptrtoint %tydesc* %3 to i32
%11 = add i32 %9, %10
%12 = inttoptr i32 %11 to void (i1*, %task*, i1*, %tydesc**, i8*)*
call fastcc void %12(i1* null, %task* %1, i1* null, %tydesc** %6, i8* %4)
%13 = getelementptr %tydesc* %3, i32 0, i32 1
%14 = load i32* %13
call fastcc void @rust_memcpy_glue(i8* %0, i8* %4, i32 %14)
ret void
}
define internal fastcc void @_rust_fn2_main(i1*, %task*, %1*) {
allocas:
%3 = alloca %"@int"
%4 = alloca %"@int"
%5 = alloca %"@int"
br label %"function top level4"
"function top level4": ; preds = %allocas
%6 = ptrtoint %task* %1 to i32
%7 = call fastcc i32 @rust_native_rust_3(i32 ptrtoint (i32 (i32, i32, i32)* @upcall_malloc to i32), i32 %6, i32 trunc (i64 mul nuw (i64 ptrtoint (i32* getelementptr (i32* null, i32 1) to i64), i64 2) to i32), i32 0)
%8 = inttoptr i32 %7 to %"@int"
%9 = getelementptr %"@int" %8, i32 0, i32 0
%10 = getelementptr %"@int" %8, i32 0, i32 1
store i32 1, i32* %9
store i32 100, i32* %10
%11 = bitcast %"@int" %8 to i8*
%12 = load %tydesc*** getelementptr inbounds (%tydesc* @tydesc_boxed_int5, i32 0, i32 0)
%13 = load void (i1*, %task*, i1*, %tydesc**, i8*)** getelementptr inbounds (%tydesc* @tydesc_boxed_int5, i32 0, i32 3)
%14 = ptrtoint void (i1*, %task*, i1*, %tydesc**, i8*)* %13 to i32
%15 = add i32 %14, ptrtoint (%tydesc* @tydesc_boxed_int5 to i32)
%16 = inttoptr i32 %15 to void (i1*, %task*, i1*, %tydesc**, i8*)*
call fastcc void %16(i1* null, %task* %1, i1* null, %tydesc** %12, i8* %11)
store %"@int" %8, %"@int"* %3
%17 = load void (i8*, %task*, %1*, %tydesc*, i8*)** getelementptr inbounds (%0* @_rust_a86fa9c148a989a5_id, i32 0, i32 0)
%18 = load %1** getelementptr inbounds (%0* @_rust_a86fa9c148a989a5_id, i32 0, i32 1)
%19 = bitcast %"@int"* %5 to i8*
%20 = bitcast %"@int"* %3 to i8*
call fastcc void %17(i8* %19, %task* %1, %1* %18, %tydesc* @tydesc_boxed_int5, i8* %20)
%21 = load %"@int"* %5
%22 = bitcast %"@int" %21 to i8*
%23 = load %tydesc*** getelementptr inbounds (%tydesc* @tydesc_boxed_int5, i32 0, i32 0)
%24 = load void (i1*, %task*, i1*, %tydesc**, i8*)** getelementptr inbounds (%tydesc* @tydesc_boxed_int5, i32 0, i32 3)
%25 = ptrtoint void (i1*, %task*, i1*, %tydesc**, i8*)* %24 to i32
%26 = add i32 %25, ptrtoint (%tydesc* @tydesc_boxed_int5 to i32)
%27 = inttoptr i32 %26 to void (i1*, %task*, i1*, %tydesc**, i8*)*
call fastcc void %27(i1* null, %task* %1, i1* null, %tydesc** %23, i8* %22)
store %"@int" %21, %"@int"* %4
%28 = load %"@int"* %4
%29 = getelementptr %"@int" %28, i32 0, i32 1
%30 = load i32* %29
%31 = ptrtoint %task* %1 to i32
%32 = call fastcc i32 @rust_native_rust_2(i32 ptrtoint (i32 (i32, i32)* @upcall_log_int to i32), i32 %31, i32 %30)
%33 = load %"@int"* %3
%34 = getelementptr %"@int" %33, i32 0, i32 1
%35 = load i32* %34
%36 = load %"@int"* %4
%37 = getelementptr %"@int" %36, i32 0, i32 1
%38 = load i32* %37
%39 = icmp eq i32 %35, %38
br i1 %39, label %next17, label %fail14
fail14: ; preds = %"function top level4"
%40 = ptrtoint %task* %1 to i32
%41 = call fastcc i32 @rust_native_rust_4(i32 ptrtoint (i32 (i32, i32, i32, i32)* @upcall_fail to i32), i32 %40, i32 ptrtoint ([21 x i8]* @str15 to i32), i32 ptrtoint ([42 x i8]* @str16 to i32), i32 12)
unreachable
next17: ; preds = %"function top level4"
%42 = bitcast %"@int" %21 to i8*
%43 = load %tydesc*** getelementptr inbounds (%tydesc* @tydesc_boxed_int5, i32 0, i32 0)
%44 = load void (i1*, %task*, i1*, %tydesc**, i8*)** getelementptr inbounds (%tydesc* @tydesc_boxed_int5, i32 0, i32 4)
%45 = ptrtoint void (i1*, %task*, i1*, %tydesc**, i8*)* %44 to i32
%46 = add i32 %45, ptrtoint (%tydesc* @tydesc_boxed_int5 to i32)
%47 = inttoptr i32 %46 to void (i1*, %task*, i1*, %tydesc**, i8*)*
call fastcc void %47(i1* null, %task* %1, i1* null, %tydesc** %43, i8* %42)
%48 = load %"@int"* %4
%49 = bitcast %"@int" %48 to i8*
%50 = load %tydesc*** getelementptr inbounds (%tydesc* @tydesc_boxed_int5, i32 0, i32 0)
%51 = load void (i1*, %task*, i1*, %tydesc**, i8*)** getelementptr inbounds (%tydesc* @tydesc_boxed_int5, i32 0, i32 4)
%52 = ptrtoint void (i1*, %task*, i1*, %tydesc**, i8*)* %51 to i32
%53 = add i32 %52, ptrtoint (%tydesc* @tydesc_boxed_int5 to i32)
%54 = inttoptr i32 %53 to void (i1*, %task*, i1*, %tydesc**, i8*)*
call fastcc void %54(i1* null, %task* %1, i1* null, %tydesc** %50, i8* %49)
store %"@int" null, %"@int"* %4
%55 = bitcast %"@int" %8 to i8*
%56 = load %tydesc*** getelementptr inbounds (%tydesc* @tydesc_boxed_int5, i32 0, i32 0)
%57 = load void (i1*, %task*, i1*, %tydesc**, i8*)** getelementptr inbounds (%tydesc* @tydesc_boxed_int5, i32 0, i32 4)
%58 = ptrtoint void (i1*, %task*, i1*, %tydesc**, i8*)* %57 to i32
%59 = add i32 %58, ptrtoint (%tydesc* @tydesc_boxed_int5 to i32)
%60 = inttoptr i32 %59 to void (i1*, %task*, i1*, %tydesc**, i8*)*
call fastcc void %60(i1* null, %task* %1, i1* null, %tydesc** %56, i8* %55)
%61 = load %"@int"* %3
%62 = bitcast %"@int" %61 to i8*
%63 = load %tydesc*** getelementptr inbounds (%tydesc* @tydesc_boxed_int5, i32 0, i32 0)
%64 = load void (i1*, %task*, i1*, %tydesc**, i8*)** getelementptr inbounds (%tydesc* @tydesc_boxed_int5, i32 0, i32 4)
%65 = ptrtoint void (i1*, %task*, i1*, %tydesc**, i8*)* %64 to i32
%66 = add i32 %65, ptrtoint (%tydesc* @tydesc_boxed_int5 to i32)
%67 = inttoptr i32 %66 to void (i1*, %task*, i1*, %tydesc**, i8*)*
call fastcc void %67(i1* null, %task* %1, i1* null, %tydesc** %63, i8* %62)
store %"@int" null, %"@int"* %3
ret void
}
declare i32 @upcall_malloc(i32, i32, i32)
define internal fastcc void @_rust_f04bf2966a4fb2fe_glue_take(i1*, %task*, i1*, %tydesc**, i8*) {
allocas:
br label %"function top level6"
"function top level6": ; preds = %allocas
%5 = bitcast i8* %4 to %"@int"
%6 = getelementptr %"@int" %5, i32 0, i32 0
%7 = load i32* %6
%8 = icmp eq i32 2074999502, %7
br i1 %8, label %next8, label %"rc++7"
"rc++7": ; preds = %"function top level6"
%9 = add i32 %7, 1
store i32 %9, i32* %6
br label %next8
next8: ; preds = %"rc++7", %"function top level6"
ret void
}
define internal fastcc void @_rust_f04bf2966a4fb2fe_glue_drop(i1*, %task*, i1*, %tydesc**, i8*) {
allocas:
br label %"function top level9"
"function top level9": ; preds = %allocas
%5 = bitcast i8* %4 to %"@int"
%6 = icmp eq %"@int" %5, null
br i1 %6, label %next13, label %"load rc10"
"load rc10": ; preds = %"function top level9"
%7 = getelementptr %"@int" %5, i32 0, i32 0
%8 = load i32* %7
%9 = icmp eq i32 2074999502, %8
br i1 %9, label %next13, label %rc--11
rc--11: ; preds = %"load rc10"
%10 = sub i32 %8, 1
store i32 %10, i32* %7
%11 = icmp eq i32 0, %10
br i1 %11, label %"free box12", label %next13
"free box12": ; preds = %rc--11
%12 = getelementptr %"@int" %5, i32 0, i32 1
%13 = load i32* %12
%14 = ptrtoint %"@int" %5 to i32
%15 = ptrtoint %task* %1 to i32
%16 = call fastcc i32 @rust_native_rust_3(i32 ptrtoint (i32 (i32, i32, i32)* @upcall_free to i32), i32 %15, i32 %14, i32 0)
br label %next13
next13: ; preds = %"free box12", %rc--11, %"load rc10", %"function top level9"
%17 = phi i32 [ 0, %"function top level9" ], [ 0, %"load rc10" ], [ 0, %rc--11 ], [ %16, %"free box12" ]
ret void
}
declare i32 @upcall_free(i32, i32, i32)
declare i32 @upcall_log_int(i32, i32)
declare i32 @upcall_fail(i32, i32, i32, i32)
declare i32 @upcall_vec_grow(i32, i32, i32, i32, i32)
define i32 @main(i32, i32) {
%3 = call i32 @rust_start(i32 ptrtoint (void (i1*, %task*, %1*)* @_rust_fn2_main to i32), i32 ptrtoint (%crate* @rust_crate to i32), i32 %0, i32 %1)
ret i32 %3
}
declare i32 @rust_start(i32, i32, i32, i32)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment