Created
August 21, 2012 21:25
-
-
Save erickt/3419521 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; ModuleID = 'test6.bc' | |
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" | |
target triple = "x86_64-apple-darwin" | |
%shapes = type { [1 x i8]*, {}* } | |
%tydesc = type { i64, i64, void (i1*, i1*, %tydesc**, i8*)*, void (i1*, i1*, %tydesc**, i8*)*, void (i1*, i1*, %tydesc**, i8*)*, void (i1*, i1*, %tydesc**, i8*)*, i8*, i8* } | |
%"enum intrinsic::tydesc[#0]" = type { [24 x i8] } | |
@_rust_crate_map_toplevel = global { i64, [2 x i64] } { i64 ptrtoint ([1 x { i64, i64 }]* @_rust_mod_map to i64), [2 x i64] [i64 ptrtoint (i64* @_rust_crate_map_core_0.3_c3ca5d77d81b46c1 to i64), i64 0] } | |
@shapes = internal constant %shapes { [1 x i8]* @tag_shapes, {}* @resource_shapes } | |
@_ZN9intrinsic6tydesc6tydesc7discrim15_52242a6a0af1de3_00E = constant i64 0 | |
@str1 = internal constant [13 x i8] c"bounds check\00" | |
@str2 = internal constant [9 x i8] c"test6.rs\00" | |
@_rust_crate_map_core_0.3_c3ca5d77d81b46c1 = external global i64 | |
@_rust_mod_map = internal global [1 x { i64, i64 }] zeroinitializer | |
@tag_shapes = internal constant [1 x i8] zeroinitializer | |
@resource_shapes = internal constant {} zeroinitializer | |
@rust_abi_version = constant i64 1 | |
declare void @llvm.gcroot(i8**, i8*) nounwind | |
declare void @llvm.gcread(i8*, i8**) nounwind readonly | |
declare void @llvm.memmove.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind | |
declare void @llvm.memmove.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind | |
declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) nounwind | |
declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) nounwind | |
declare void @llvm.trap() noreturn nounwind | |
declare i8* @llvm.frameaddress(i32) nounwind readnone | |
declare void @upcall_fail(i8*, i8*, i64) | |
declare void @upcall_trace(i8*, i8*, i64) | |
declare i8* @upcall_malloc(%tydesc*, i64) nounwind | |
declare void @upcall_free(i8*) nounwind | |
declare i8* @upcall_exchange_malloc(%tydesc*, i64) nounwind | |
declare void @upcall_exchange_free(i8*) nounwind | |
declare void @upcall_validate_box(i8*) nounwind | |
declare i64 @upcall_mark(i8*) | |
declare i8* @upcall_str_new_uniq(i8*, i64) nounwind | |
declare i8* @upcall_str_new_shared(i8*, i64) nounwind | |
declare void @upcall_cmp_type(i1*, %tydesc*, i8*, i8*, i8) | |
declare void @upcall_log_type(%tydesc*, i8*, i32) | |
declare i64 @upcall_call_shim_on_c_stack(i8*, i8*) | |
declare i64 @upcall_call_shim_on_rust_stack(i8*, i8*) | |
declare i32 @upcall_rust_personality() nounwind | |
declare void @upcall_reset_stack_limit() nounwind | |
define void @_ZN9intrinsic6tydesc6tydesc6tydesc17_db5bfcf25ba552263_00E(%"enum intrinsic::tydesc[#0]"*, { i64, %tydesc*, i8*, i8*, i8 } addrspace(1)*, { i8**, i64, i64 }*) inlinehint { | |
static_allocas: | |
br label %load_env | |
load_env: ; preds = %static_allocas | |
br label %3 | |
return: ; preds = %3 | |
ret void | |
; <label>:3 ; preds = %load_env | |
%4 = bitcast %"enum intrinsic::tydesc[#0]"* %0 to { { i8**, i64, i64 } }* | |
%5 = getelementptr inbounds { { i8**, i64, i64 } }* %4, i32 0, i32 0 | |
%6 = bitcast { i8**, i64, i64 }* %2 to i8* | |
%7 = bitcast { i8**, i64, i64 }* %5 to i8* | |
call void @llvm.memmove.p0i8.p0i8.i64(i8* %7, i8* %6, i64 ptrtoint ({ i8**, i64, i64 }* getelementptr ({ i8**, i64, i64 }* null, i32 1) to i64), i32 1, i1 false) | |
br label %return | |
} | |
define void @_ZN9intrinsic5rusti12visit_tydesc16_519b3b0ac2ac3373_00E(i1*, { i64, %tydesc*, i8*, i8*, i8 } addrspace(1)*, %"enum intrinsic::tydesc[#0]"*, { %tydesc*, { i64, %tydesc*, i8*, i8*, i8 } addrspace(1)* }*) { | |
static_allocas: | |
br label %load_env | |
load_env: ; preds = %static_allocas | |
br label %4 | |
return: ; preds = %4 | |
ret void | |
; <label>:4 ; preds = %load_env | |
%5 = bitcast %"enum intrinsic::tydesc[#0]"* %2 to %tydesc* | |
%6 = bitcast { %tydesc*, { i64, %tydesc*, i8*, i8*, i8 } addrspace(1)* }* %3 to i8* | |
%7 = getelementptr inbounds %tydesc* %5, i32 0, i32 5 | |
%8 = load void (i1*, i1*, %tydesc**, i8*)** %7 | |
call void %8(i1* null, i1* null, %tydesc** null, i8* %6) | |
br label %return | |
} | |
define void @_ZN8function16_3e2459823f1da173_00E({ i64*, i64 }*, { i64, %tydesc*, i8*, i8*, i8 } addrspace(1)*) uwtable { | |
static_allocas: | |
%2 = alloca { i64*, i64 } | |
%3 = alloca i64, i64 3 | |
%4 = alloca { i64*, i64 } | |
br label %load_env | |
load_env: ; preds = %static_allocas | |
br label %5 | |
return: ; preds = %18 | |
ret void | |
; <label>:5 ; preds = %load_env | |
%6 = bitcast i64* %3 to [3 x i64]* | |
%7 = getelementptr inbounds { i64*, i64 }* %4, i32 0, i32 0 | |
store i64* %3, i64** %7 | |
%8 = getelementptr inbounds { i64*, i64 }* %4, i32 0, i32 1 | |
store i64 mul (i64 ptrtoint (i64* getelementptr (i64* null, i32 1) to i64), i64 3), i64* %8 | |
%9 = getelementptr inbounds i64* %3, i64 0 | |
store i64 1, i64* %9 | |
%10 = getelementptr inbounds i64* %3, i64 1 | |
store i64 2, i64* %10 | |
%11 = getelementptr inbounds i64* %3, i64 2 | |
store i64 3, i64* %11 | |
%12 = load { i64*, i64 }* %4 | |
store { i64*, i64 } %12, { i64*, i64 }* %2 | |
%13 = getelementptr inbounds { i64*, i64 }* %2, i32 0, i32 0 | |
%14 = load i64** %13 | |
%15 = getelementptr inbounds { i64*, i64 }* %2, i32 0, i32 1 | |
%16 = load i64* %15 | |
%17 = icmp uge i64 0, %16 | |
br i1 %17, label %22, label %18 | |
; <label>:18 ; preds = %5 | |
%19 = getelementptr inbounds i64* %14, i64 0 | |
store i64 12345, i64* %19 | |
%20 = bitcast { i64*, i64 }* %2 to i8* | |
%21 = bitcast { i64*, i64 }* %0 to i8* | |
call void @llvm.memmove.p0i8.p0i8.i64(i8* %21, i8* %20, i64 ptrtoint ({ i64*, i64 }* getelementptr ({ i64*, i64 }* null, i32 1) to i64), i32 1, i1 false) | |
store { i64*, i64 } zeroinitializer, { i64*, i64 }* %2 | |
br label %return | |
; <label>:22 ; preds = %5 | |
br label %23 | |
; <label>:23 ; preds = %22 | |
call void @_ZN2rt7rt_fail17_96f05ec2f2882f7a3_03E(i1* undef, { i64, %tydesc*, i8*, i8*, i8 } addrspace(1)* undef, i8* getelementptr inbounds ([13 x i8]* @str1, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8]* @str2, i32 0, i32 0), i64 3) | |
br label %24 | |
; <label>:24 ; preds = %23 | |
unreachable | |
} | |
declare void @_ZN2rt7rt_fail17_96f05ec2f2882f7a3_03E(i1*, { i64, %tydesc*, i8*, i8*, i8 } addrspace(1)*, i8*, i8*, i64) | |
define void @_ZN4main16_14b9917e9e75f703_00E(i1*, { i64, %tydesc*, i8*, i8*, i8 } addrspace(1)*) uwtable { | |
static_allocas: | |
%2 = alloca { i64*, i64 } | |
br label %load_env | |
load_env: ; preds = %static_allocas | |
br label %3 | |
return: ; preds = %5 | |
ret void | |
; <label>:3 ; preds = %load_env | |
br label %4 | |
; <label>:4 ; preds = %3 | |
call void @_ZN8function16_3e2459823f1da173_00E({ i64*, i64 }* %2, { i64, %tydesc*, i8*, i8*, i8 } addrspace(1)* undef) | |
br label %5 | |
; <label>:5 ; preds = %4 | |
br label %return | |
} | |
define void @_rust_main(i1*, { i64, %tydesc*, i8*, i8*, i8 } addrspace(1)*, { i64, %tydesc*, i8*, i8*, { i64, i64, [0 x { i64, %tydesc*, i8*, i8*, { i64, i64, [0 x i8] } } addrspace(1)*] } } addrspace(1)*) { | |
static_allocas: | |
br label %load_env | |
load_env: ; preds = %static_allocas | |
br label %3 | |
return: ; preds = %3 | |
ret void | |
; <label>:3 ; preds = %load_env | |
call void @_ZN4main16_14b9917e9e75f703_00E(i1* %0, { i64, %tydesc*, i8*, i8*, i8 } addrspace(1)* %1) | |
br label %return | |
} | |
define i64 @main(i64, i64) { | |
top: | |
%2 = call i64 @rust_start(void (i1*, { i64, %tydesc*, i8*, i8*, i8 } addrspace(1)*, { i64, %tydesc*, i8*, i8*, { i64, i64, [0 x { i64, %tydesc*, i8*, i8*, { i64, i64, [0 x i8] } } addrspace(1)*] } } addrspace(1)*)* @_rust_main, i64 %0, i64 %1, { i64, [2 x i64] }* @_rust_crate_map_toplevel) | |
ret i64 %2 | |
} | |
declare i64 @rust_start(void (i1*, { i64, %tydesc*, i8*, i8*, i8 } addrspace(1)*, { i64, %tydesc*, i8*, i8*, { i64, i64, [0 x { i64, %tydesc*, i8*, i8*, { i64, i64, [0 x i8] } } addrspace(1)*] } } addrspace(1)*)*, i64, i64, { i64, [2 x i64] }*) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn function() -> &[mut int] { | |
let mut x: &static/[mut int] = &[mut 1,2,3]; | |
x[0] = 12345; | |
x | |
} | |
fn main() { | |
let x = function(); | |
error!("%?", x); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment