retool inline encoding to handle methods, fix tests
This commit is contained in:
parent
12c68bcd6d
commit
def72bda47
@ -31,6 +31,8 @@ import syntax::print::pprust;
|
||||
|
||||
export encode_inlined_item;
|
||||
export decode_inlined_item;
|
||||
export encode_inlined_method;
|
||||
export decode_inlined_method;
|
||||
|
||||
type decode_ctxt = @{
|
||||
cdata: cstore::crate_metadata,
|
||||
@ -49,25 +51,36 @@ iface tr {
|
||||
}
|
||||
|
||||
// ______________________________________________________________________
|
||||
// Enumerating the IDs which appear in an AST
|
||||
// Top-level methods.
|
||||
|
||||
// The type inline_fn should be a type that can represent both methods
|
||||
// and top-level items. As it happens, the type ast::method is perfect
|
||||
// for this purpose, but I use this typedef just to keep clear when
|
||||
// the thing may not, in fact, be an actual method in the AST but
|
||||
// rather some sort of function.
|
||||
enum inline_fn = @ast::method;
|
||||
|
||||
fn encode_inlined_item(ecx: @e::encode_ctxt,
|
||||
ebml_w: ebml::writer,
|
||||
path: ast_map::path,
|
||||
item: @ast::item) {
|
||||
#debug["> Encoding inlined item: %s::%s (%u)",
|
||||
ast_map::path_to_str(path),
|
||||
item.ident,
|
||||
ebml_w.writer.tell()];
|
||||
let id_range = compute_id_range(item);
|
||||
ebml_w.wr_tag(c::tag_ast as uint) {||
|
||||
encode_id_range(ebml_w, id_range);
|
||||
encode_ast(ebml_w, item);
|
||||
encode_side_tables_for_item(ecx, ebml_w, item);
|
||||
}
|
||||
#debug["< Encoded inlined item: %s (%u)",
|
||||
ast_map::path_to_str(path),
|
||||
ebml_w.writer.tell()];
|
||||
let ifn = inline_fn(alt item.node {
|
||||
ast::item_fn(decl, tps, body) {
|
||||
@{ident: item.ident,
|
||||
attrs: item.attrs,
|
||||
tps: tps,
|
||||
decl: decl,
|
||||
body: body,
|
||||
id: item.id,
|
||||
span: item.span}
|
||||
}
|
||||
|
||||
_ {
|
||||
ecx.ccx.sess.span_bug(item.span, "Cannot inline non-function")
|
||||
}
|
||||
});
|
||||
|
||||
encode_inlined_fn(ecx, ebml_w, path, ifn);
|
||||
}
|
||||
|
||||
fn decode_inlined_item(cdata: cstore::crate_metadata,
|
||||
@ -75,23 +88,88 @@ fn decode_inlined_item(cdata: cstore::crate_metadata,
|
||||
maps: maps,
|
||||
path: ast_map::path,
|
||||
par_doc: ebml::doc) -> option<@ast::item> {
|
||||
let oifn = decode_inlined_fn(cdata, tcx, maps, path, par_doc);
|
||||
option::map(oifn) {|ifn|
|
||||
let item = @{ident: ifn.ident,
|
||||
attrs: ifn.attrs,
|
||||
id: ifn.id,
|
||||
node: ast::item_fn(ifn.decl, ifn.tps, ifn.body),
|
||||
span: ifn.span};
|
||||
ast_map::map_decoded_item(tcx.items, path, item);
|
||||
item
|
||||
}
|
||||
}
|
||||
|
||||
fn encode_inlined_method(ecx: @e::encode_ctxt,
|
||||
ebml_w: ebml::writer,
|
||||
path: ast_map::path,
|
||||
mthd: @ast::method) {
|
||||
encode_inlined_fn(ecx, ebml_w, path, inline_fn(mthd))
|
||||
}
|
||||
|
||||
fn decode_inlined_method(cdata: cstore::crate_metadata,
|
||||
tcx: ty::ctxt,
|
||||
maps: maps,
|
||||
path: ast_map::path,
|
||||
par_doc: ebml::doc) -> option<@ast::method> {
|
||||
let oifn = decode_inlined_fn(cdata, tcx, maps, path, par_doc);
|
||||
option::map(oifn) {|ifn|
|
||||
ast_map::map_decoded_method(tcx.items, path, *ifn);
|
||||
*ifn
|
||||
}
|
||||
}
|
||||
|
||||
fn encode_inlined_fn(ecx: @e::encode_ctxt,
|
||||
ebml_w: ebml::writer,
|
||||
path: ast_map::path,
|
||||
ifn: inline_fn) {
|
||||
|
||||
#debug["> Encoding inlined item: %s::%s (%u)",
|
||||
ast_map::path_to_str(path),
|
||||
ifn.ident,
|
||||
ebml_w.writer.tell()];
|
||||
|
||||
let id_range = compute_id_range(ifn);
|
||||
ebml_w.wr_tag(c::tag_ast as uint) {||
|
||||
encode_id_range(ebml_w, id_range);
|
||||
encode_ast(ebml_w, ifn);
|
||||
encode_side_tables_for_ifn(ecx, ebml_w, ifn);
|
||||
}
|
||||
|
||||
#debug["< Encoded inlined fn: %s::%s (%u)",
|
||||
ast_map::path_to_str(path),
|
||||
ifn.ident,
|
||||
ebml_w.writer.tell()];
|
||||
}
|
||||
|
||||
// Decodes the inlined function and associated side tables. Does
|
||||
// *not* insert the function into the ast_map, since the correct way
|
||||
// to do this depends on whether this is an inlined item or method;
|
||||
// therefore, you ought to be invoking decode_inlined_item() or
|
||||
// decode_inlined_method() and not this helper function.
|
||||
fn decode_inlined_fn(cdata: cstore::crate_metadata,
|
||||
tcx: ty::ctxt,
|
||||
maps: maps,
|
||||
path: ast_map::path,
|
||||
par_doc: ebml::doc) -> option<inline_fn> {
|
||||
let dcx = @{cdata: cdata, tcx: tcx, maps: maps};
|
||||
alt par_doc.opt_child(c::tag_ast) {
|
||||
none { none }
|
||||
some(ast_doc) {
|
||||
#debug["> Decoding inlined item: %s", ast_map::path_to_str(path)];
|
||||
#debug["> Decoding inlined fn: %s", ast_map::path_to_str(path)];
|
||||
let from_id_range = decode_id_range(ast_doc);
|
||||
let to_id_range = reserve_id_range(dcx.tcx.sess, from_id_range);
|
||||
let xcx = @{dcx: dcx,
|
||||
from_id_range: from_id_range,
|
||||
to_id_range: to_id_range};
|
||||
let raw_item = decode_ast(ast_doc);
|
||||
let item = renumber_ast(xcx, raw_item);
|
||||
#debug[">> Item named: %s", item.ident];
|
||||
ast_map::map_decoded_item(dcx.tcx.items, path, item);
|
||||
let raw_ifn = decode_ast(ast_doc);
|
||||
let ifn = renumber_ast(xcx, raw_ifn);
|
||||
#debug["Fn named: %s", ifn.ident];
|
||||
decode_side_tables(xcx, ast_doc);
|
||||
#debug["< Decoded inlined item: %s", ast_map::path_to_str(path)];
|
||||
some(item)
|
||||
#debug["< Decoded inlined fn: %s::%s",
|
||||
ast_map::path_to_str(path),
|
||||
ifn.ident];
|
||||
some(ifn)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -105,7 +183,7 @@ fn empty(range: id_range) -> bool {
|
||||
range.min >= range.max
|
||||
}
|
||||
|
||||
fn visit_ids(item: @ast::item, vfn: fn@(ast::node_id)) {
|
||||
fn visit_ids(ifn: inline_fn, vfn: fn@(ast::node_id)) {
|
||||
let visitor = visit::mk_simple_visitor(@{
|
||||
visit_mod: fn@(_m: ast::_mod, _sp: span, id: ast::node_id) {
|
||||
vfn(id)
|
||||
@ -214,13 +292,13 @@ fn visit_ids(item: @ast::item, vfn: fn@(ast::node_id)) {
|
||||
}
|
||||
});
|
||||
|
||||
visitor.visit_item(item, (), visitor);
|
||||
visit::visit_method_helper(*ifn, (), visitor);
|
||||
}
|
||||
|
||||
fn compute_id_range(item: @ast::item) -> id_range {
|
||||
fn compute_id_range(ifn: inline_fn) -> id_range {
|
||||
let min = @mutable int::max_value;
|
||||
let max = @mutable int::min_value;
|
||||
visit_ids(item) {|id|
|
||||
visit_ids(ifn) {|id|
|
||||
*min = int::min(*min, id);
|
||||
*max = int::max(*max, id + 1);
|
||||
}
|
||||
@ -317,25 +395,25 @@ impl deserializer_helpers<D: serialization::deserializer> for D {
|
||||
// We also have to adjust the spans: for now we just insert a dummy span,
|
||||
// but eventually we should add entries to the local codemap as required.
|
||||
|
||||
fn encode_ast(ebml_w: ebml::writer, item: @ast::item) {
|
||||
fn encode_ast(ebml_w: ebml::writer, ifn: inline_fn) {
|
||||
ebml_w.wr_tag(c::tag_tree as uint) {||
|
||||
astencode_gen::serialize_syntax_ast_item(ebml_w, *item);
|
||||
astencode_gen::serialize_syntax_ast_method(ebml_w, **ifn)
|
||||
}
|
||||
}
|
||||
|
||||
fn decode_ast(par_doc: ebml::doc) -> @ast::item {
|
||||
fn decode_ast(par_doc: ebml::doc) -> inline_fn {
|
||||
let chi_doc = par_doc[c::tag_tree];
|
||||
let d = serialization::mk_ebml_deserializer(chi_doc);
|
||||
@astencode_gen::deserialize_syntax_ast_item(d)
|
||||
inline_fn(@astencode_gen::deserialize_syntax_ast_method(d))
|
||||
}
|
||||
|
||||
fn renumber_ast(xcx: extended_decode_ctxt, item: @ast::item) -> @ast::item {
|
||||
fn renumber_ast(xcx: extended_decode_ctxt, ifn: inline_fn) -> inline_fn {
|
||||
let fld = fold::make_fold({
|
||||
new_id: xcx.tr_id(_),
|
||||
new_span: xcx.tr_span(_)
|
||||
with *fold::default_ast_fold()
|
||||
});
|
||||
fld.fold_item(item)
|
||||
inline_fn(fld.fold_method(*ifn))
|
||||
}
|
||||
|
||||
// ______________________________________________________________________
|
||||
@ -586,11 +664,11 @@ impl writer for ebml::writer {
|
||||
}
|
||||
}
|
||||
|
||||
fn encode_side_tables_for_item(ecx: @e::encode_ctxt,
|
||||
ebml_w: ebml::writer,
|
||||
item: @ast::item) {
|
||||
fn encode_side_tables_for_ifn(ecx: @e::encode_ctxt,
|
||||
ebml_w: ebml::writer,
|
||||
ifn: inline_fn) {
|
||||
ebml_w.wr_tag(c::tag_table as uint) {||
|
||||
visit_ids(item, fn@(id: ast::node_id) {
|
||||
visit_ids(ifn, fn@(id: ast::node_id) {
|
||||
// Note: this will cause a copy of ebml_w, which is bad as
|
||||
// it has mutable fields. But I believe it's harmless since
|
||||
// we generate balanced EBML.
|
||||
@ -820,7 +898,21 @@ fn decode_side_tables(xcx: extended_decode_ctxt,
|
||||
}
|
||||
|
||||
// ______________________________________________________________________
|
||||
// Testing
|
||||
// Testing of astencode_gen
|
||||
|
||||
#[cfg(test)]
|
||||
fn encode_item_ast(ebml_w: ebml::writer, item: @ast::item) {
|
||||
ebml_w.wr_tag(c::tag_tree as uint) {||
|
||||
astencode_gen::serialize_syntax_ast_item(ebml_w, *item);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn decode_item_ast(par_doc: ebml::doc) -> @ast::item {
|
||||
let chi_doc = par_doc[c::tag_tree];
|
||||
let d = serialization::mk_ebml_deserializer(chi_doc);
|
||||
@astencode_gen::deserialize_syntax_ast_item(d)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn new_parse_sess() -> parser::parse_sess {
|
||||
@ -864,9 +956,9 @@ fn roundtrip(in_item: @ast::item) {
|
||||
#debug["in_item = %s", pprust::item_to_str(in_item)];
|
||||
let mbuf = io::mk_mem_buffer();
|
||||
let ebml_w = ebml::mk_writer(io::mem_buffer_writer(mbuf));
|
||||
encode_ast(ebml_w, in_item);
|
||||
encode_item_ast(ebml_w, in_item);
|
||||
let ebml_doc = ebml::new_doc(@io::mem_buffer_buf(mbuf));
|
||||
let out_item = decode_ast(ebml_doc);
|
||||
let out_item = decode_item_ast(ebml_doc);
|
||||
#debug["out_item = %s", pprust::item_to_str(out_item)];
|
||||
assert in_item == out_item;
|
||||
}
|
||||
|
@ -8748,3 +8748,12 @@ fn deserialize_syntax_ast_def_id<S: std::serialization::deserializer>(s: S) ->
|
||||
syntax::ast::def_id {
|
||||
deserialize_162(s)
|
||||
}
|
||||
fn serialize_syntax_ast_method<S: std::serialization::serializer>(s: S,
|
||||
v:
|
||||
syntax::ast::method) {
|
||||
serialize_160(s, v);
|
||||
}
|
||||
fn deserialize_syntax_ast_method<S: std::serialization::deserializer>(s: S) ->
|
||||
syntax::ast::method {
|
||||
deserialize_160(s)
|
||||
}
|
||||
|
@ -73,6 +73,15 @@ fn map_decoded_item(map: map, path: path, i: @item) {
|
||||
v.visit_item(i, cx, v);
|
||||
}
|
||||
|
||||
fn map_decoded_method(map: map, path: path, m: @method) {
|
||||
// As above.
|
||||
let cx = {map: map,
|
||||
mutable path: path,
|
||||
mutable local_id: 0u};
|
||||
let v = mk_ast_map_visitor();
|
||||
visit::visit_method_helper(m, cx, v);
|
||||
}
|
||||
|
||||
fn map_fn(fk: visit::fn_kind, decl: fn_decl, body: blk,
|
||||
sp: codemap::span, id: node_id, cx: ctx, v: vt) {
|
||||
for a in decl.inputs {
|
||||
|
@ -130,8 +130,7 @@ fn visit_item<E>(i: @item, e: E, v: vt<E>) {
|
||||
alt ifce { some(ty) { v.visit_ty(ty, e, v); } _ {} }
|
||||
v.visit_ty(ty, e, v);
|
||||
for m in methods {
|
||||
v.visit_fn(fk_method(m.ident, m.tps), m.decl, m.body, m.span,
|
||||
m.id, e, v);
|
||||
visit_method_helper(m, e, v)
|
||||
}
|
||||
}
|
||||
item_class(tps, members, _, ctor_decl, ctor_blk) {
|
||||
@ -252,6 +251,15 @@ fn visit_fn_decl<E>(fd: fn_decl, e: E, v: vt<E>) {
|
||||
v.visit_ty(fd.output, e, v);
|
||||
}
|
||||
|
||||
// Note: there is no visit_method() method in the visitor, instead override
|
||||
// visit_fn() and check for fk_method(). I named this visit_method_helper()
|
||||
// because it is not a default impl of any method, though I doubt that really
|
||||
// clarifies anything. - Niko
|
||||
fn visit_method_helper<E>(m: @method, e: E, v: vt<E>) {
|
||||
v.visit_fn(fk_method(m.ident, m.tps), m.decl, m.body, m.span,
|
||||
m.id, e, v);
|
||||
}
|
||||
|
||||
fn visit_fn<E>(fk: fn_kind, decl: fn_decl, body: blk, _sp: span,
|
||||
_id: node_id, e: E, v: vt<E>) {
|
||||
visit_fn_decl(decl, e, v);
|
||||
|
@ -289,10 +289,15 @@ fn compile_test(config: config, props: test_props,
|
||||
testfile: str) -> procres {
|
||||
vec::iter(props.aux_builds) {|rel_ab|
|
||||
let abs_ab = fs::connect(config.aux_base, rel_ab);
|
||||
compose_and_run(config, abs_ab,
|
||||
make_compile_args(_, props, ["--lib"],
|
||||
make_lib_name, _),
|
||||
config.compile_lib_path, option::none);
|
||||
let auxres = compose_and_run(config, abs_ab,
|
||||
make_compile_args(_, props, ["--lib"],
|
||||
make_lib_name, _),
|
||||
config.compile_lib_path, option::none);
|
||||
if auxres.status != 0 {
|
||||
fatal_procres(
|
||||
#fmt["auxiliary build of %s failed to compile: ", abs_ab],
|
||||
auxres);
|
||||
}
|
||||
}
|
||||
|
||||
compose_and_run(config, testfile,
|
||||
|
@ -16,7 +16,8 @@ function msg {
|
||||
|
||||
M=src/comp/metadata
|
||||
GEN_TYPES="syntax::ast::item syntax::ast::def middle::typeck::method_origin \
|
||||
middle::freevars::freevar_entry syntax::ast::def_id"
|
||||
middle::freevars::freevar_entry syntax::ast::def_id
|
||||
syntax::ast::method"
|
||||
|
||||
# Find serializer tool:
|
||||
for S in build/*/stage1/bin/serializer; do
|
||||
|
@ -20,12 +20,15 @@ native mod rustrt {
|
||||
fn unsupervise();
|
||||
fn shape_log_str<T>(t: *sys::type_desc, data: T) -> str;
|
||||
fn rust_set_exit_status(code: ctypes::intptr_t);
|
||||
fn rust_frame_address() -> ctypes::uintptr_t;
|
||||
}
|
||||
|
||||
#[abi = "rust-intrinsic"]
|
||||
native mod rusti {
|
||||
fn get_type_desc<T>() -> *type_desc;
|
||||
|
||||
// Invokes __builtin_frame_address().
|
||||
// See <http://gcc.gnu.org/onlinedocs/gcc/Return-Address.html>.
|
||||
fn frame_address(n: ctypes::c_uint) -> ctypes::uintptr_t;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -78,10 +81,6 @@ fn log_str<T>(t: T) -> str {
|
||||
rustrt::shape_log_str(get_type_desc::<T>(), t)
|
||||
}
|
||||
|
||||
fn frame_address() -> uint {
|
||||
rustrt::rust_frame_address()
|
||||
}
|
||||
|
||||
#[doc(
|
||||
brief = "Sets the process exit code",
|
||||
desc = "Sets the exit code returned by the process if all supervised \
|
||||
|
@ -166,3 +166,9 @@ upcall_vec_push(rust_vec** vp,
|
||||
type_desc* elt_ty, void* elt) {
|
||||
upcall_intrinsic_vec_push(vp, elt_ty, elt);
|
||||
}
|
||||
|
||||
extern "C" CDECL void
|
||||
rust_intrinsic_frame_address(void **p, unsigned n) {
|
||||
*p = __builtin_frame_address(n);
|
||||
}
|
||||
|
||||
|
@ -1,125 +1,114 @@
|
||||
; ModuleID = 'src/rt/intrinsics/intrinsics.cpp'
|
||||
; target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S128"
|
||||
; target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32"
|
||||
target triple = "@CFG_TARGET_TRIPLE@"
|
||||
|
||||
%struct.type_desc = type { %struct.type_desc**, i32, i32, void (i8*, i8*, %struct.type_desc**, i8*)*, void (i8*, i8*, %struct.type_desc**, i8*)*, void (i8*, i8*, %struct.type_desc**, i8*)*, i8*, void (i8*, i8*, %struct.type_desc**, i8*)*, void (i8*, i8*, %struct.type_desc**, i8*)*, i32, i8*, i8*, %struct.rust_shape_tables*, i32, i32, %struct.UT_hash_handle, i32, [0 x %struct.type_desc*] }
|
||||
%struct.rust_shape_tables = type { i8*, i8* }
|
||||
%0 = type { i32, %struct.rust_task**, i32 }
|
||||
%1 = type { %"struct.hash_map<long, rust_task *>::map_entry"* }
|
||||
%class.array_list = type { i32, %"struct.memory_region::alloc_header"**, i32 }
|
||||
%class.boxed_region = type { %class.memory_region*, %struct.rust_opaque_box* }
|
||||
%class.circular_buffer = type { %class.rust_kernel*, i32, i32, i32, i32, i8* }
|
||||
%class.context = type { %struct.registers_t, %class.context*, [12 x i8] }
|
||||
%"class.debug::task_debug_info" = type { %"class.std::map" }
|
||||
%class.hash_map = type { %"struct.hash_map<long, rust_port *>::map_entry"* }
|
||||
%class.indexed_list = type { i32 (...)**, %0 }
|
||||
%class.lock_and_signal = type { i32 (...)**, %struct._opaque_pthread_cond_t, %struct._opaque_pthread_mutex_t, %struct._opaque_pthread_t* }
|
||||
%class.memory_region = type { i32 (...)**, %class.rust_srv*, %class.memory_region*, i32, %class.array_list, i8, i8, %class.lock_and_signal }
|
||||
%class.rust_crate_cache = type { %struct.type_desc*, %struct.rust_hashable_dict*, %struct.rust_task_thread*, i32 }
|
||||
%class.rust_kernel = type { %class.memory_region, %class.rust_log, %class.rust_srv*, %class.lock_and_signal, i32, i32, %1, %class.lock_and_signal, i32, %class.lock_and_signal, i32, %"class.std::map", %"class.std::vector", %struct.rust_env* }
|
||||
%class.rust_log = type { i32 (...)**, %class.rust_srv*, %struct.rust_task_thread*, i8 }
|
||||
%class.rust_obstack = type { %struct.rust_obstack_chunk*, %struct.rust_task* }
|
||||
%class.rust_port = type { i32, i32, %class.rust_kernel*, %struct.rust_task*, i32, %class.circular_buffer, %class.lock_and_signal }
|
||||
%class.rust_port_selector = type { %class.rust_port**, i32, %class.lock_and_signal }
|
||||
%class.rust_scheduler = type opaque
|
||||
%class.rust_srv = type { i32 (...)**, %struct.rust_env*, %class.memory_region }
|
||||
%class.rust_task_list = type { %class.indexed_list, %struct.rust_task_thread*, i8* }
|
||||
%class.rust_thread = type { i32 (...)**, %struct._opaque_pthread_t*, i32 }
|
||||
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long, std::pair<const long, rust_scheduler *>, std::_Select1st<std::pair<const long, rust_scheduler *> >, std::less<long>, std::allocator<std::pair<const long, rust_scheduler *> > >::_Rb_tree_impl" }
|
||||
%"class.std::map" = type { %"class.std::_Rb_tree" }
|
||||
%"class.std::vector" = type { %"struct.std::_Vector_base" }
|
||||
%struct.UT_hash_bucket = type { %struct.UT_hash_handle*, i32, i32 }
|
||||
%struct.UT_hash_handle = type { %struct.UT_hash_table*, i8*, i8*, %struct.UT_hash_handle*, %struct.UT_hash_handle*, i8*, i32, i32 }
|
||||
%struct.UT_hash_table = type { %struct.UT_hash_bucket*, i32, i32, i32, %struct.UT_hash_handle*, i32, i32, i32, i32, i32 }
|
||||
%struct.UT_hash_bucket = type { %struct.UT_hash_handle*, i32, i32 }
|
||||
%struct.rust_vec = type { i32, i32, [0 x i8] }
|
||||
%struct.rust_fn = type { i32*, %struct.rust_box* }
|
||||
%struct.rust_box = type opaque
|
||||
%struct.rust_task = type { i32, i32, i8, %struct.chan_handle, [12 x i8], %class.context, %struct.stk_seg*, i32, %class.rust_scheduler*, %struct.rust_task_thread*, %class.rust_crate_cache*, %class.rust_kernel*, i8*, %class.rust_task_list*, %struct.rust_cond*, i8*, %struct.rust_task*, i32, i32, i32*, %class.memory_region, %class.boxed_region, i8, i8, %class.lock_and_signal, %class.hash_map.3, %class.rust_obstack, i32, %"class.debug::task_debug_info", i32, i8, i8, %struct.stk_seg*, i32, i32, %class.rust_port_selector, [8 x i8] }
|
||||
%struct.__darwin_pthread_handler_rec = type { void (i8*)*, i8*, %struct.__darwin_pthread_handler_rec* }
|
||||
%struct._opaque_pthread_attr_t = type { i32, [36 x i8] }
|
||||
%struct._opaque_pthread_cond_t = type { i32, [24 x i8] }
|
||||
%struct._opaque_pthread_mutex_t = type { i32, [40 x i8] }
|
||||
%struct._opaque_pthread_t = type { i32, %struct.__darwin_pthread_handler_rec*, [596 x i8] }
|
||||
%struct.chan_handle = type { i32, i32 }
|
||||
%class.context = type { %struct.registers_t, %class.context*, [12 x i8] }
|
||||
%struct.registers_t = type { i32, i32, i32, i32, i32, i32, i32, i32, i16, i16, i16, i16, i16, i16, i32, i32, [12 x i8] }
|
||||
%struct.stk_seg = type { %struct.stk_seg*, %struct.stk_seg*, i32, i32, i32, i32, [0 x i8] }
|
||||
%class.rust_scheduler = type opaque
|
||||
%struct.rust_task_thread = type { %class.rust_thread, i32, %class.rust_log, i32, %class.rust_srv*, i8*, %class.rust_task_list, %class.rust_task_list, %class.rust_task_list, %class.rust_task_list, %class.rust_crate_cache, %struct.randctx, %class.rust_kernel*, %class.rust_scheduler*, i32, i32, %class.lock_and_signal, i32, %union.pthread_attr_t, %struct.rust_env*, [8 x i8], %class.context, i8, %struct.stk_seg*, %struct.stk_seg*, [4 x i8] }
|
||||
%class.rust_thread = type { i32 (...)**, i32, i32 }
|
||||
%class.rust_log = type { i32 (...)**, %class.rust_srv*, %struct.rust_task_thread*, i8 }
|
||||
%class.rust_srv = type { i32 (...)**, %struct.rust_env*, %class.memory_region }
|
||||
%struct.rust_env = type { i32, i32, i32, i8*, i8, i8, i8* }
|
||||
%class.memory_region = type { i32 (...)**, %class.rust_srv*, %class.memory_region*, i32, %class.array_list, i8, i8, %class.lock_and_signal }
|
||||
%class.array_list = type { i32, %"struct.memory_region::alloc_header"**, i32 }
|
||||
%"struct.hash_map<long, rust_port *>::map_entry" = type opaque
|
||||
%"struct.hash_map<long, rust_task *>::map_entry" = type opaque
|
||||
%"struct.memory_region::alloc_header" = type { i8 }
|
||||
%class.lock_and_signal = type { i32 (...)**, %union.pthread_cond_t, %union.pthread_mutex_t, i32 }
|
||||
%union.pthread_cond_t = type { %struct.anon, [4 x i8] }
|
||||
%struct.anon = type { i32, i32, i64, i64, i64, i8*, i32, i32 }
|
||||
%union.pthread_mutex_t = type { %"struct.<anonymous union>::__pthread_mutex_s" }
|
||||
%"struct.<anonymous union>::__pthread_mutex_s" = type { i32, i32, i32, i32, i32, %union.anon }
|
||||
%union.anon = type { i32 }
|
||||
%class.rust_task_list = type { %class.indexed_list, %struct.rust_task_thread*, i8* }
|
||||
%class.indexed_list = type { i32 (...)**, %class.array_list.1 }
|
||||
%class.array_list.1 = type { i32, %struct.rust_task**, i32 }
|
||||
%class.rust_crate_cache = type { %struct.type_desc*, %struct.rust_hashable_dict*, %struct.rust_task_thread*, i32 }
|
||||
%struct.rust_hashable_dict = type { %struct.UT_hash_handle, [0 x i8*] }
|
||||
%struct.randctx = type { i32, [256 x i32], [256 x i32], i32, i32, i32 }
|
||||
%class.rust_kernel = type { %class.memory_region, %class.rust_log, %class.rust_srv*, %class.lock_and_signal, i32, i32, %class.hash_map, %class.lock_and_signal, i32, %class.lock_and_signal, i32, i32, %"class.std::map", %struct.rust_env* }
|
||||
%class.hash_map = type { %"struct.hash_map<int, rust_task *>::map_entry"* }
|
||||
%"struct.hash_map<int, rust_task *>::map_entry" = type opaque
|
||||
%"class.std::map" = type { %"class.std::_Rb_tree" }
|
||||
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, std::pair<const int, rust_scheduler *>, std::_Select1st<std::pair<const int, rust_scheduler *> >, std::less<int>, std::allocator<std::pair<const int, rust_scheduler *> > >::_Rb_tree_impl" }
|
||||
%"struct.std::_Rb_tree<int, std::pair<const int, rust_scheduler *>, std::_Select1st<std::pair<const int, rust_scheduler *> >, std::less<int>, std::allocator<std::pair<const int, rust_scheduler *> > >::_Rb_tree_impl" = type { %"struct.std::less", %"struct.std::_Rb_tree_node_base", i32 }
|
||||
%"struct.std::less" = type { i8 }
|
||||
%"struct.std::_Rb_tree_node_base" = type { i32, %"struct.std::_Rb_tree_node_base"*, %"struct.std::_Rb_tree_node_base"*, %"struct.std::_Rb_tree_node_base"* }
|
||||
%union.pthread_attr_t = type { i32, [32 x i8] }
|
||||
%struct.rust_cond = type { i8 }
|
||||
%class.boxed_region = type { %class.memory_region*, %struct.rust_opaque_box* }
|
||||
%struct.rust_opaque_box = type { i32, %struct.type_desc*, %struct.rust_opaque_box*, %struct.rust_opaque_box* }
|
||||
%class.hash_map.3 = type { %"struct.hash_map<int, rust_port *>::map_entry"* }
|
||||
%"struct.hash_map<int, rust_port *>::map_entry" = type opaque
|
||||
%class.rust_obstack = type { %struct.rust_obstack_chunk*, %struct.rust_task* }
|
||||
%struct.registers_t = type { i32, i32, i32, i32, i32, i32, i32, i32, i16, i16, i16, i16, i16, i16, i32, i32, [12 x i8] }
|
||||
%struct.rust_box = type opaque
|
||||
%struct.rust_env = type { i32, i32, i32, i8*, i8, i8, i8* }
|
||||
%struct.rust_fn = type { i32*, %struct.rust_box* }
|
||||
%struct.rust_hashable_dict = type { %struct.UT_hash_handle, [0 x i8*] }
|
||||
%struct.rust_obstack_chunk = type { %struct.rust_obstack_chunk*, i32, i32, i32, [0 x i8] }
|
||||
%"class.debug::task_debug_info" = type { %"class.std::map.4" }
|
||||
%"class.std::map.4" = type { %"class.std::_Rb_tree.5" }
|
||||
%"class.std::_Rb_tree.5" = type { %"struct.std::_Rb_tree<void *, std::pair<void *const, std::basic_string<char> >, std::_Select1st<std::pair<void *const, std::basic_string<char> > >, std::less<void *>, std::allocator<std::pair<void *const, std::basic_string<char> > > >::_Rb_tree_impl" }
|
||||
%"struct.std::_Rb_tree<void *, std::pair<void *const, std::basic_string<char> >, std::_Select1st<std::pair<void *const, std::basic_string<char> > >, std::less<void *>, std::allocator<std::pair<void *const, std::basic_string<char> > > >::_Rb_tree_impl" = type { %"struct.std::less.9", %"struct.std::_Rb_tree_node_base", i32 }
|
||||
%"struct.std::less.9" = type { i8 }
|
||||
%class.rust_port_selector = type { %class.rust_port**, i32, %class.lock_and_signal }
|
||||
%class.rust_port = type { i32, i32, %class.rust_kernel*, %struct.rust_task*, i32, %class.circular_buffer, %class.lock_and_signal }
|
||||
%class.circular_buffer = type { %class.rust_kernel*, i32, i32, i32, i32, i8* }
|
||||
%struct.rust_opaque_box = type { i32, %struct.type_desc*, %struct.rust_opaque_box*, %struct.rust_opaque_box* }
|
||||
%struct.rust_shape_tables = type { i8*, i8* }
|
||||
%struct.rust_task = type { i32, i32, i8, %struct.chan_handle, [12 x i8], %class.context, %struct.stk_seg*, i32, %class.rust_scheduler*, %struct.rust_task_thread*, %class.rust_crate_cache*, %class.rust_kernel*, i8*, %class.rust_task_list*, %"struct.memory_region::alloc_header"*, i8*, %struct.rust_task*, i32, i32, i32*, %class.memory_region, %class.boxed_region, i8, i8, %class.lock_and_signal, %class.hash_map, %class.rust_obstack, i32, %"class.debug::task_debug_info", i32, i8, i8, %struct.stk_seg*, i32, i32, %class.rust_port_selector, [8 x i8] }
|
||||
%struct.rust_task_thread = type { %class.rust_thread, i32, %class.rust_log, i32, %class.rust_srv*, i8*, %class.rust_task_list, %class.rust_task_list, %class.rust_task_list, %class.rust_task_list, %class.rust_crate_cache, %struct.randctx, %class.rust_kernel*, %class.rust_scheduler*, i32, i32, %class.lock_and_signal, i32, %struct._opaque_pthread_attr_t, %struct.rust_env*, [4 x i8], %class.context, i8, %struct.stk_seg*, %struct.stk_seg*, [4 x i8] }
|
||||
%struct.rust_vec = type { i32, i32, [0 x i8] }
|
||||
%"struct.std::_Rb_tree<long, std::pair<const long, rust_scheduler *>, std::_Select1st<std::pair<const long, rust_scheduler *> >, std::less<long>, std::allocator<std::pair<const long, rust_scheduler *> > >::_Rb_tree_impl" = type { %"struct.memory_region::alloc_header", %"struct.std::_Rb_tree_node_base", i32 }
|
||||
%"struct.std::_Rb_tree_node_base" = type { i32, %"struct.std::_Rb_tree_node_base"*, %"struct.std::_Rb_tree_node_base"*, %"struct.std::_Rb_tree_node_base"* }
|
||||
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long, std::allocator<long> >::_Vector_impl" }
|
||||
%"struct.std::_Vector_base<long, std::allocator<long> >::_Vector_impl" = type { i32*, i32*, i32* }
|
||||
%struct.stk_seg = type { %struct.stk_seg*, %struct.stk_seg*, i32, i32, i32, i32, [0 x i8] }
|
||||
%struct.type_desc = type { %struct.type_desc**, i32, i32, void (i8*, i8*, %struct.type_desc**, i8*)*, void (i8*, i8*, %struct.type_desc**, i8*)*, void (i8*, i8*, %struct.type_desc**, i8*)*, i8*, void (i8*, i8*, %struct.type_desc**, i8*)*, void (i8*, i8*, %struct.type_desc**, i8*)*, i32, i8*, i8*, %struct.rust_shape_tables*, i32, i32, %struct.UT_hash_handle, i32, [0 x %struct.type_desc*] }
|
||||
|
||||
define void @rust_intrinsic_vec_len(i32* nocapture %retptr, i8* nocapture %env, %struct.type_desc* nocapture %ty, %struct.rust_vec** nocapture %vp) nounwind {
|
||||
entry:
|
||||
%0 = load %struct.rust_vec** %vp, align 4, !tbaa !0
|
||||
%fill = getelementptr inbounds %struct.rust_vec* %0, i32 0, i32 0
|
||||
%1 = load i32* %fill, align 4, !tbaa !3
|
||||
%size = getelementptr inbounds %struct.type_desc* %ty, i32 0, i32 1
|
||||
%2 = load i32* %size, align 4, !tbaa !3
|
||||
%div = udiv i32 %1, %2
|
||||
store i32 %div, i32* %retptr, align 4, !tbaa !3
|
||||
%1 = load %struct.rust_vec** %vp, align 4
|
||||
%2 = getelementptr inbounds %struct.rust_vec* %1, i32 0, i32 0
|
||||
%3 = load i32* %2, align 4
|
||||
%4 = getelementptr inbounds %struct.type_desc* %ty, i32 0, i32 1
|
||||
%5 = load i32* %4, align 4
|
||||
%6 = udiv i32 %3, %5
|
||||
store i32 %6, i32* %retptr, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @rust_intrinsic_ptr_offset(i8** nocapture %retptr, i8* nocapture %env, %struct.type_desc* nocapture %ty, i8* %ptr, i32 %count) nounwind {
|
||||
entry:
|
||||
%size = getelementptr inbounds %struct.type_desc* %ty, i32 0, i32 1
|
||||
%0 = load i32* %size, align 4, !tbaa !3
|
||||
%mul = mul i32 %0, %count
|
||||
%arrayidx = getelementptr inbounds i8* %ptr, i32 %mul
|
||||
store i8* %arrayidx, i8** %retptr, align 4, !tbaa !0
|
||||
%1 = getelementptr inbounds %struct.type_desc* %ty, i32 0, i32 1
|
||||
%2 = load i32* %1, align 4
|
||||
%3 = mul i32 %2, %count
|
||||
%4 = getelementptr inbounds i8* %ptr, i32 %3
|
||||
store i8* %4, i8** %retptr, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @rust_intrinsic_cast(i8* nocapture %retptr, i8* nocapture %env, %struct.type_desc* nocapture %t1, %struct.type_desc* nocapture %t2, i8* nocapture %src) nounwind {
|
||||
entry:
|
||||
%size = getelementptr inbounds %struct.type_desc* %t1, i32 0, i32 1
|
||||
%0 = load i32* %size, align 4, !tbaa !3
|
||||
tail call void @llvm.memmove.p0i8.p0i8.i32(i8* %retptr, i8* %src, i32 %0, i32 1, i1 false)
|
||||
%1 = getelementptr inbounds %struct.type_desc* %t1, i32 0, i32 1
|
||||
%2 = load i32* %1, align 4
|
||||
tail call void @llvm.memmove.p0i8.p0i8.i32(i8* %retptr, i8* %src, i32 %2, i32 1, i1 false)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @llvm.memmove.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind
|
||||
|
||||
define void @rust_intrinsic_addr_of(i8** nocapture %retptr, i8* nocapture %env, %struct.type_desc* nocapture %ty, i8* %valptr) nounwind {
|
||||
entry:
|
||||
store i8* %valptr, i8** %retptr, align 4, !tbaa !0
|
||||
store i8* %valptr, i8** %retptr, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @rust_intrinsic_call_with_retptr(i8** %retptr, i8* nocapture %env, %struct.type_desc* nocapture %ty, %struct.rust_fn* nocapture %recvfn) {
|
||||
entry:
|
||||
%fn1 = getelementptr inbounds %struct.rust_fn* %recvfn, i32 0, i32 0
|
||||
%0 = load i32** %fn1, align 4, !tbaa !0
|
||||
%1 = bitcast i32* %0 to void (i8**, i8*, i8**)*
|
||||
%env2 = getelementptr inbounds %struct.rust_fn* %recvfn, i32 0, i32 1
|
||||
%2 = load %struct.rust_box** %env2, align 4, !tbaa !0
|
||||
%3 = bitcast %struct.rust_box* %2 to i8*
|
||||
tail call void %1(i8** null, i8* %3, i8** %retptr)
|
||||
%1 = getelementptr inbounds %struct.rust_fn* %recvfn, i32 0, i32 0
|
||||
%2 = load i32** %1, align 4
|
||||
%3 = bitcast i32* %2 to void (i8**, i8*, i8**)*
|
||||
%4 = getelementptr inbounds %struct.rust_fn* %recvfn, i32 0, i32 1
|
||||
%5 = load %struct.rust_box** %4, align 4
|
||||
%6 = bitcast %struct.rust_box* %5 to i8*
|
||||
tail call void %3(i8** null, i8* %6, i8** %retptr)
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @rust_intrinsic_get_type_desc(i8** nocapture %retptr, i8* nocapture %env, %struct.type_desc* %ty) nounwind {
|
||||
entry:
|
||||
%ty.c = bitcast %struct.type_desc* %ty to i8*
|
||||
store i8* %ty.c, i8** %retptr, align 4, !tbaa !0
|
||||
store i8* %ty.c, i8** %retptr, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @rust_intrinsic_task_yield(i8** nocapture %retptr, i8* nocapture %env, %struct.rust_task* %task, i8* %killed) {
|
||||
entry:
|
||||
tail call void @rust_task_yield(%struct.rust_task* %task, i8* %killed)
|
||||
ret void
|
||||
}
|
||||
@ -127,114 +116,121 @@ entry:
|
||||
declare void @rust_task_yield(%struct.rust_task*, i8*)
|
||||
|
||||
define void @rust_intrinsic_memmove(i8* nocapture %retptr, i8* nocapture %env, %struct.type_desc* nocapture %ty, i8* nocapture %dst, i8* nocapture %src, i32 %count) nounwind {
|
||||
entry:
|
||||
%size = getelementptr inbounds %struct.type_desc* %ty, i32 0, i32 1
|
||||
%0 = load i32* %size, align 4, !tbaa !3
|
||||
%mul = mul i32 %0, %count
|
||||
tail call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src, i32 %mul, i32 1, i1 false)
|
||||
%1 = getelementptr inbounds %struct.type_desc* %ty, i32 0, i32 1
|
||||
%2 = load i32* %1, align 4
|
||||
%3 = mul i32 %2, %count
|
||||
tail call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src, i32 %3, i32 1, i1 false)
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @rust_intrinsic_memcpy(i8* nocapture %retptr, i8* nocapture %env, %struct.type_desc* nocapture %ty, i8* nocapture %dst, i8* nocapture %src, i32 %count) nounwind {
|
||||
entry:
|
||||
%size = getelementptr inbounds %struct.type_desc* %ty, i32 0, i32 1
|
||||
%0 = load i32* %size, align 4, !tbaa !3
|
||||
%mul = mul i32 %0, %count
|
||||
tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, i32 %mul, i32 1, i1 false)
|
||||
%1 = getelementptr inbounds %struct.type_desc* %ty, i32 0, i32 1
|
||||
%2 = load i32* %1, align 4
|
||||
%3 = mul i32 %2, %count
|
||||
tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, i32 %3, i32 1, i1 false)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind
|
||||
|
||||
define void @rust_intrinsic_leak(i8* nocapture %retptr, i8* nocapture %env, %struct.type_desc* nocapture %ty, i8* nocapture %thing) nounwind readnone {
|
||||
entry:
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @upcall_intrinsic_vec_push(%struct.rust_vec** nocapture %vp, %struct.type_desc* nocapture %elt_ty, i8* nocapture %elt) {
|
||||
entry:
|
||||
%0 = load %struct.rust_vec** %vp, align 4, !tbaa !0
|
||||
%fill = getelementptr inbounds %struct.rust_vec* %0, i32 0, i32 0
|
||||
%1 = load i32* %fill, align 4, !tbaa !3
|
||||
%size = getelementptr inbounds %struct.type_desc* %elt_ty, i32 0, i32 1
|
||||
%2 = load i32* %size, align 4, !tbaa !3
|
||||
%add = add i32 %2, %1
|
||||
%alloc.i = getelementptr inbounds %struct.rust_vec* %0, i32 0, i32 1
|
||||
%3 = load i32* %alloc.i, align 4, !tbaa !3
|
||||
%cmp.i = icmp ult i32 %3, %add
|
||||
br i1 %cmp.i, label %if.then.i, label %_Z16reserve_vec_fastPP8rust_vecj.exit
|
||||
; <label>:0
|
||||
%1 = load %struct.rust_vec** %vp, align 4
|
||||
%2 = getelementptr inbounds %struct.rust_vec* %1, i32 0, i32 0
|
||||
%3 = load i32* %2, align 4
|
||||
%4 = getelementptr inbounds %struct.type_desc* %elt_ty, i32 0, i32 1
|
||||
%5 = load i32* %4, align 4
|
||||
%6 = add i32 %5, %3
|
||||
%7 = getelementptr inbounds %struct.rust_vec* %1, i32 0, i32 1
|
||||
%8 = load i32* %7, align 4
|
||||
%9 = icmp ult i32 %8, %6
|
||||
br i1 %9, label %10, label %_Z16reserve_vec_fastPP8rust_vecm.exit
|
||||
|
||||
if.then.i: ; preds = %entry
|
||||
%sub.i.i = add i32 %add, -1
|
||||
%shr.i.i = lshr i32 %sub.i.i, 1
|
||||
%or.i.i = or i32 %shr.i.i, %sub.i.i
|
||||
%shr1.i.i = lshr i32 %or.i.i, 2
|
||||
%or2.i.i = or i32 %shr1.i.i, %or.i.i
|
||||
%shr3.i.i = lshr i32 %or2.i.i, 4
|
||||
%or4.i.i = or i32 %shr3.i.i, %or2.i.i
|
||||
%shr5.i.i = lshr i32 %or4.i.i, 8
|
||||
%or6.i.i = or i32 %shr5.i.i, %or4.i.i
|
||||
%shr7.i.i = lshr i32 %or6.i.i, 16
|
||||
%or8.i.i = or i32 %shr7.i.i, %or6.i.i
|
||||
%add.i.i = add i32 %or8.i.i, 1
|
||||
%add.i = add i32 %or8.i.i, 9
|
||||
%4 = bitcast %struct.rust_vec* %0 to i8*
|
||||
%call1.i = tail call i8* @upcall_shared_realloc(i8* %4, i32 %add.i)
|
||||
%5 = bitcast i8* %call1.i to %struct.rust_vec*
|
||||
store %struct.rust_vec* %5, %struct.rust_vec** %vp, align 4, !tbaa !0
|
||||
%alloc2.i = getelementptr inbounds i8* %call1.i, i32 4
|
||||
%6 = bitcast i8* %alloc2.i to i32*
|
||||
store i32 %add.i.i, i32* %6, align 4, !tbaa !3
|
||||
%.pr = load i32* %size, align 4
|
||||
%fill1.phi.trans.insert = bitcast i8* %call1.i to i32*
|
||||
%.pre = load i32* %fill1.phi.trans.insert, align 4, !tbaa !3
|
||||
br label %_Z16reserve_vec_fastPP8rust_vecj.exit
|
||||
; <label>:10 ; preds = %0
|
||||
%11 = add i32 %6, -1
|
||||
%12 = lshr i32 %11, 1
|
||||
%13 = or i32 %12, %11
|
||||
%14 = lshr i32 %13, 2
|
||||
%15 = or i32 %14, %13
|
||||
%16 = lshr i32 %15, 4
|
||||
%17 = or i32 %16, %15
|
||||
%18 = lshr i32 %17, 8
|
||||
%19 = or i32 %18, %17
|
||||
%20 = lshr i32 %19, 16
|
||||
%21 = or i32 %20, %19
|
||||
%22 = add i32 %21, 1
|
||||
%23 = add i32 %21, 9
|
||||
%24 = bitcast %struct.rust_vec* %1 to i8*
|
||||
%25 = tail call i8* @upcall_shared_realloc(i8* %24, i32 %23)
|
||||
%26 = bitcast i8* %25 to %struct.rust_vec*
|
||||
store %struct.rust_vec* %26, %struct.rust_vec** %vp, align 4
|
||||
%27 = getelementptr inbounds i8* %25, i32 4
|
||||
%28 = bitcast i8* %27 to i32*
|
||||
store i32 %22, i32* %28, align 4
|
||||
%.pr = load i32* %4, align 4
|
||||
%.pre = load %struct.rust_vec** %vp, align 4
|
||||
%.phi.trans.insert = getelementptr inbounds %struct.rust_vec* %.pre, i32 0, i32 0
|
||||
%.pre4 = load i32* %.phi.trans.insert, align 4
|
||||
br label %_Z16reserve_vec_fastPP8rust_vecm.exit
|
||||
|
||||
_Z16reserve_vec_fastPP8rust_vecj.exit: ; preds = %entry, %if.then.i
|
||||
%7 = phi i32 [ %1, %entry ], [ %.pre, %if.then.i ]
|
||||
%8 = phi %struct.rust_vec* [ %0, %entry ], [ %5, %if.then.i ]
|
||||
%9 = phi i32 [ %2, %entry ], [ %.pr, %if.then.i ]
|
||||
%fill1 = getelementptr inbounds %struct.rust_vec* %8, i32 0, i32 0
|
||||
%add.ptr = getelementptr inbounds %struct.rust_vec* %8, i32 0, i32 2, i32 %7
|
||||
tail call void @llvm.memmove.p0i8.p0i8.i32(i8* %add.ptr, i8* %elt, i32 %9, i32 1, i1 false)
|
||||
%take_glue.i = getelementptr inbounds %struct.type_desc* %elt_ty, i32 0, i32 3
|
||||
%10 = load void (i8*, i8*, %struct.type_desc**, i8*)** %take_glue.i, align 4, !tbaa !0
|
||||
%tobool.i = icmp eq void (i8*, i8*, %struct.type_desc**, i8*)* %10, null
|
||||
br i1 %tobool.i, label %_ZL13copy_elementsP9type_descPvS1_j.exit, label %if.then.i6
|
||||
_Z16reserve_vec_fastPP8rust_vecm.exit: ; preds = %0, %10
|
||||
%29 = phi i32 [ %3, %0 ], [ %.pre4, %10 ]
|
||||
%30 = phi %struct.rust_vec* [ %1, %0 ], [ %.pre, %10 ]
|
||||
%31 = phi i32 [ %5, %0 ], [ %.pr, %10 ]
|
||||
%32 = getelementptr inbounds %struct.rust_vec* %30, i32 0, i32 0
|
||||
%33 = getelementptr inbounds %struct.rust_vec* %30, i32 0, i32 2, i32 %29
|
||||
tail call void @llvm.memmove.p0i8.p0i8.i32(i8* %33, i8* %elt, i32 %31, i32 1, i1 false)
|
||||
%34 = getelementptr inbounds %struct.type_desc* %elt_ty, i32 0, i32 3
|
||||
%35 = load void (i8*, i8*, %struct.type_desc**, i8*)** %34, align 4
|
||||
%36 = icmp eq void (i8*, i8*, %struct.type_desc**, i8*)* %35, null
|
||||
br i1 %36, label %_ZL13copy_elementsP9type_descPvS1_m.exit, label %37
|
||||
|
||||
if.then.i6: ; preds = %_Z16reserve_vec_fastPP8rust_vecj.exit
|
||||
%11 = load i32* %size, align 4, !tbaa !3
|
||||
%first_param.i = getelementptr inbounds %struct.type_desc* %elt_ty, i32 0, i32 0
|
||||
%12 = load %struct.type_desc*** %first_param.i, align 4, !tbaa !0
|
||||
%add.ptr.sum = add i32 %7, %9
|
||||
%add.ptr.i = getelementptr inbounds %struct.rust_vec* %8, i32 0, i32 2, i32 %add.ptr.sum
|
||||
%cmp4.i = icmp sgt i32 %9, 0
|
||||
br i1 %cmp4.i, label %for.body.i, label %_ZL13copy_elementsP9type_descPvS1_j.exit
|
||||
; <label>:37 ; preds = %_Z16reserve_vec_fastPP8rust_vecm.exit
|
||||
%38 = load i32* %4, align 4
|
||||
%39 = getelementptr inbounds %struct.type_desc* %elt_ty, i32 0, i32 0
|
||||
%40 = load %struct.type_desc*** %39, align 4
|
||||
%41 = icmp sgt i32 %31, 0
|
||||
br i1 %41, label %.lr.ph.i.preheader, label %_ZL13copy_elementsP9type_descPvS1_m.exit
|
||||
|
||||
for.body.i: ; preds = %if.then.i6, %for.body.i
|
||||
%p.05.i = phi i8* [ %add.ptr3.i, %for.body.i ], [ %add.ptr, %if.then.i6 ]
|
||||
tail call void %10(i8* null, i8* null, %struct.type_desc** %12, i8* %p.05.i)
|
||||
%add.ptr3.i = getelementptr inbounds i8* %p.05.i, i32 %11
|
||||
%cmp.i7 = icmp ult i8* %add.ptr3.i, %add.ptr.i
|
||||
br i1 %cmp.i7, label %for.body.i, label %_ZL13copy_elementsP9type_descPvS1_j.exit
|
||||
.lr.ph.i.preheader: ; preds = %37
|
||||
%scevgep = getelementptr %struct.rust_vec* %30, i32 1, i32 0
|
||||
%scevgep2 = bitcast i32* %scevgep to i8*
|
||||
br label %.lr.ph.i
|
||||
|
||||
_ZL13copy_elementsP9type_descPvS1_j.exit: ; preds = %for.body.i, %_Z16reserve_vec_fastPP8rust_vecj.exit, %if.then.i6
|
||||
%13 = load i32* %size, align 4, !tbaa !3
|
||||
%14 = load i32* %fill1, align 4, !tbaa !3
|
||||
%add5 = add i32 %14, %13
|
||||
store i32 %add5, i32* %fill1, align 4, !tbaa !3
|
||||
.lr.ph.i: ; preds = %.lr.ph.i.preheader, %.lr.ph.i
|
||||
%indvar.i = phi i32 [ %indvar.next.i, %.lr.ph.i ], [ 0, %.lr.ph.i.preheader ]
|
||||
%tmp = mul i32 %38, %indvar.i
|
||||
%tmp2.i = add i32 %38, %tmp
|
||||
%tmp3 = add i32 %29, %tmp
|
||||
%p.01.i = getelementptr i8* %scevgep2, i32 %tmp3
|
||||
tail call void %35(i8* null, i8* null, %struct.type_desc** %40, i8* %p.01.i)
|
||||
%42 = icmp slt i32 %tmp2.i, %31
|
||||
%indvar.next.i = add i32 %indvar.i, 1
|
||||
br i1 %42, label %.lr.ph.i, label %_ZL13copy_elementsP9type_descPvS1_m.exit
|
||||
|
||||
_ZL13copy_elementsP9type_descPvS1_m.exit: ; preds = %.lr.ph.i, %_Z16reserve_vec_fastPP8rust_vecm.exit, %37
|
||||
%43 = load i32* %4, align 4
|
||||
%44 = load i32* %32, align 4
|
||||
%45 = add i32 %44, %43
|
||||
store i32 %45, i32* %32, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @upcall_vec_push(%struct.rust_vec** nocapture %vp, %struct.type_desc* nocapture %elt_ty, i8* nocapture %elt) {
|
||||
entry:
|
||||
tail call void @upcall_intrinsic_vec_push(%struct.rust_vec** %vp, %struct.type_desc* %elt_ty, i8* %elt)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare i8* @upcall_shared_realloc(i8*, i32)
|
||||
define void @rust_intrinsic_frame_address(i8** nocapture %p) nounwind {
|
||||
%1 = tail call i8* @llvm.frameaddress(i32 1)
|
||||
store i8* %1, i8** %p, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
!0 = metadata !{metadata !"any pointer", metadata !1}
|
||||
!1 = metadata !{metadata !"omnipotent char", metadata !2}
|
||||
!2 = metadata !{metadata !"Simple C/C++ TBAA", null}
|
||||
!3 = metadata !{metadata !"int", metadata !1}
|
||||
declare i8* @llvm.frameaddress(i32) nounwind readnone
|
||||
|
||||
declare i8* @upcall_shared_realloc(i8*, i32)
|
||||
|
@ -1,242 +1,237 @@
|
||||
; ModuleID = 'src/rt/intrinsics/intrinsics.cpp'
|
||||
; 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-S128"
|
||||
; 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 = "@CFG_TARGET_TRIPLE@"
|
||||
|
||||
%struct.type_desc = type { %struct.type_desc**, i64, i64, void (i8*, i8*, %struct.type_desc**, i8*)*, void (i8*, i8*, %struct.type_desc**, i8*)*, void (i8*, i8*, %struct.type_desc**, i8*)*, i8*, void (i8*, i8*, %struct.type_desc**, i8*)*, void (i8*, i8*, %struct.type_desc**, i8*)*, i64, i8*, i8*, %struct.rust_shape_tables*, i64, i64, %struct.UT_hash_handle, i64, [0 x %struct.type_desc*] }
|
||||
%struct.rust_shape_tables = type { i8*, i8* }
|
||||
%0 = type { i64, %struct.rust_task**, i64 }
|
||||
%1 = type { %"struct.hash_map<long, rust_task *>::map_entry"* }
|
||||
%class.array_list = type { i64, %"struct.memory_region::alloc_header"**, i64 }
|
||||
%class.boxed_region = type { %class.memory_region*, %struct.rust_opaque_box* }
|
||||
%class.circular_buffer = type { %class.rust_kernel*, i64, i64, i64, i64, i8* }
|
||||
%class.context = type { %struct.registers_t, %class.context*, [8 x i8] }
|
||||
%"class.debug::task_debug_info" = type { %"class.std::map" }
|
||||
%class.hash_map = type { %"struct.hash_map<long, rust_port *>::map_entry"* }
|
||||
%class.indexed_list = type { i32 (...)**, %0 }
|
||||
%class.lock_and_signal = type { i32 (...)**, %struct._opaque_pthread_cond_t, %struct._opaque_pthread_attr_t, %struct._opaque_pthread_t* }
|
||||
%class.memory_region = type { i32 (...)**, %class.rust_srv*, %class.memory_region*, i32, %class.array_list, i8, i8, %class.lock_and_signal }
|
||||
%class.rust_crate_cache = type { %struct.type_desc*, %struct.rust_hashable_dict*, %struct.rust_task_thread*, i64 }
|
||||
%class.rust_kernel = type { %class.memory_region, %class.rust_log, %class.rust_srv*, %class.lock_and_signal, i64, i64, %1, %class.lock_and_signal, i32, %class.lock_and_signal, i64, %"class.std::map", %"class.std::vector", %struct.rust_env* }
|
||||
%class.rust_log = type { i32 (...)**, %class.rust_srv*, %struct.rust_task_thread*, i8 }
|
||||
%class.rust_obstack = type { %struct.rust_obstack_chunk*, %struct.rust_task* }
|
||||
%class.rust_port = type { i64, i64, %class.rust_kernel*, %struct.rust_task*, i64, %class.circular_buffer, %class.lock_and_signal }
|
||||
%class.rust_port_selector = type { %class.rust_port**, i64, %class.lock_and_signal }
|
||||
%class.rust_scheduler = type opaque
|
||||
%class.rust_srv = type { i32 (...)**, %struct.rust_env*, %class.memory_region }
|
||||
%class.rust_task_list = type { %class.indexed_list, %struct.rust_task_thread*, i8* }
|
||||
%class.rust_thread = type { i32 (...)**, %struct._opaque_pthread_t*, i64 }
|
||||
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long, std::pair<const long, rust_scheduler *>, std::_Select1st<std::pair<const long, rust_scheduler *> >, std::less<long>, std::allocator<std::pair<const long, rust_scheduler *> > >::_Rb_tree_impl" }
|
||||
%"class.std::map" = type { %"class.std::_Rb_tree" }
|
||||
%"class.std::vector" = type { %"struct.std::_Vector_base" }
|
||||
%struct.UT_hash_bucket = type { %struct.UT_hash_handle*, i32, i32 }
|
||||
%struct.UT_hash_handle = type { %struct.UT_hash_table*, i8*, i8*, %struct.UT_hash_handle*, %struct.UT_hash_handle*, i8*, i32, i32 }
|
||||
%struct.UT_hash_table = type { %struct.UT_hash_bucket*, i32, i32, i32, %struct.UT_hash_handle*, i64, i32, i32, i32, i32 }
|
||||
%struct.UT_hash_bucket = type { %struct.UT_hash_handle*, i32, i32 }
|
||||
%struct.rust_vec = type { i64, i64, [0 x i8] }
|
||||
%struct.rust_fn = type { i64*, %struct.rust_box* }
|
||||
%struct.rust_box = type opaque
|
||||
%struct.rust_task = type { i64, i64, i8, %struct.chan_handle, [8 x i8], %class.context, %struct.stk_seg*, i64, %class.rust_scheduler*, %struct.rust_task_thread*, %class.rust_crate_cache*, %class.rust_kernel*, i8*, %class.rust_task_list*, %struct.rust_cond*, i8*, %struct.rust_task*, i32, i64, i64*, %class.memory_region, %class.boxed_region, i8, i8, %class.lock_and_signal, %class.hash_map.3, %class.rust_obstack, i32, %"class.debug::task_debug_info", i64, i8, i8, %struct.stk_seg*, i64, i64, %class.rust_port_selector, [8 x i8] }
|
||||
%struct.__darwin_pthread_handler_rec = type { void (i8*)*, i8*, %struct.__darwin_pthread_handler_rec* }
|
||||
%struct._opaque_pthread_attr_t = type { i64, [56 x i8] }
|
||||
%struct._opaque_pthread_cond_t = type { i64, [40 x i8] }
|
||||
%struct._opaque_pthread_t = type { i64, %struct.__darwin_pthread_handler_rec*, [1168 x i8] }
|
||||
%struct.chan_handle = type { i64, i64 }
|
||||
%class.context = type { %struct.registers_t, %class.context*, [8 x i8] }
|
||||
%struct.registers_t = type { [22 x i64] }
|
||||
%struct.stk_seg = type { %struct.stk_seg*, %struct.stk_seg*, i64, i32, i64, [0 x i8] }
|
||||
%class.rust_scheduler = type opaque
|
||||
%struct.rust_task_thread = type { %class.rust_thread, i64, %class.rust_log, i32, %class.rust_srv*, i8*, %class.rust_task_list, %class.rust_task_list, %class.rust_task_list, %class.rust_task_list, %class.rust_crate_cache, %struct.randctx, %class.rust_kernel*, %class.rust_scheduler*, i32, i32, %class.lock_and_signal, i64, %union.pthread_attr_t, %struct.rust_env*, %class.context, i8, %struct.stk_seg*, %struct.stk_seg*, [8 x i8] }
|
||||
%class.rust_thread = type { i32 (...)**, i64, i64 }
|
||||
%class.rust_log = type { i32 (...)**, %class.rust_srv*, %struct.rust_task_thread*, i8 }
|
||||
%class.rust_srv = type { i32 (...)**, %struct.rust_env*, %class.memory_region }
|
||||
%struct.rust_env = type { i64, i64, i64, i8*, i8, i8, i8* }
|
||||
%class.memory_region = type { i32 (...)**, %class.rust_srv*, %class.memory_region*, i32, %class.array_list, i8, i8, %class.lock_and_signal }
|
||||
%class.array_list = type { i64, %"struct.memory_region::alloc_header"**, i64 }
|
||||
%"struct.memory_region::alloc_header" = type { i8 }
|
||||
%class.lock_and_signal = type { i32 (...)**, %union.pthread_cond_t, %union.pthread_mutex_t, i64 }
|
||||
%union.pthread_cond_t = type { %struct.anon }
|
||||
%struct.anon = type { i32, i32, i64, i64, i64, i8*, i32, i32 }
|
||||
%union.pthread_mutex_t = type { %"struct.<anonymous union>::__pthread_mutex_s" }
|
||||
%"struct.<anonymous union>::__pthread_mutex_s" = type { i32, i32, i32, i32, i32, i32, %struct.__pthread_internal_list }
|
||||
%struct.__pthread_internal_list = type { %struct.__pthread_internal_list*, %struct.__pthread_internal_list* }
|
||||
%class.rust_task_list = type { %class.indexed_list, %struct.rust_task_thread*, i8* }
|
||||
%class.indexed_list = type { i32 (...)**, %class.array_list.1 }
|
||||
%class.array_list.1 = type { i64, %struct.rust_task**, i64 }
|
||||
%class.rust_crate_cache = type { %struct.type_desc*, %struct.rust_hashable_dict*, %struct.rust_task_thread*, i64 }
|
||||
%struct.rust_hashable_dict = type { %struct.UT_hash_handle, [0 x i8*] }
|
||||
%struct.randctx = type { i64, [256 x i64], [256 x i64], i64, i64, i64 }
|
||||
%class.rust_kernel = type { %class.memory_region, %class.rust_log, %class.rust_srv*, %class.lock_and_signal, i64, i64, %class.hash_map, %class.lock_and_signal, i32, %class.lock_and_signal, i64, i64, %"class.std::map", %struct.rust_env* }
|
||||
%class.hash_map = type { %"struct.hash_map<long, rust_task *>::map_entry"* }
|
||||
%"struct.hash_map<long, rust_task *>::map_entry" = type opaque
|
||||
%"class.std::map" = type { %"class.std::_Rb_tree" }
|
||||
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long, std::pair<const long, rust_scheduler *>, std::_Select1st<std::pair<const long, rust_scheduler *> >, std::less<long>, std::allocator<std::pair<const long, rust_scheduler *> > >::_Rb_tree_impl" }
|
||||
%"struct.std::_Rb_tree<long, std::pair<const long, rust_scheduler *>, std::_Select1st<std::pair<const long, rust_scheduler *> >, std::less<long>, std::allocator<std::pair<const long, rust_scheduler *> > >::_Rb_tree_impl" = type { %"struct.std::less", %"struct.std::_Rb_tree_node_base", i64 }
|
||||
%"struct.std::less" = type { i8 }
|
||||
%"struct.std::_Rb_tree_node_base" = type { i32, %"struct.std::_Rb_tree_node_base"*, %"struct.std::_Rb_tree_node_base"*, %"struct.std::_Rb_tree_node_base"* }
|
||||
%union.pthread_attr_t = type { i64, [48 x i8] }
|
||||
%struct.rust_cond = type { i8 }
|
||||
%class.boxed_region = type { %class.memory_region*, %struct.rust_opaque_box* }
|
||||
%struct.rust_opaque_box = type { i64, %struct.type_desc*, %struct.rust_opaque_box*, %struct.rust_opaque_box* }
|
||||
%class.hash_map.3 = type { %"struct.hash_map<long, rust_port *>::map_entry"* }
|
||||
%"struct.hash_map<long, rust_port *>::map_entry" = type opaque
|
||||
%class.rust_obstack = type { %struct.rust_obstack_chunk*, %struct.rust_task* }
|
||||
%"struct.hash_map<long, rust_task *>::map_entry" = type opaque
|
||||
%"struct.memory_region::alloc_header" = type { i8 }
|
||||
%struct.randctx = type { i64, [256 x i64], [256 x i64], i64, i64, i64 }
|
||||
%struct.registers_t = type { [22 x i64] }
|
||||
%struct.rust_box = type opaque
|
||||
%struct.rust_env = type { i64, i64, i64, i8*, i8, i8, i8* }
|
||||
%struct.rust_fn = type { i64*, %struct.rust_box* }
|
||||
%struct.rust_hashable_dict = type { %struct.UT_hash_handle, [0 x i8*] }
|
||||
%struct.rust_obstack_chunk = type { %struct.rust_obstack_chunk*, i64, i64, i64, [0 x i8] }
|
||||
%"class.debug::task_debug_info" = type { %"class.std::map.4" }
|
||||
%"class.std::map.4" = type { %"class.std::_Rb_tree.5" }
|
||||
%"class.std::_Rb_tree.5" = type { %"struct.std::_Rb_tree<void *, std::pair<void *const, std::basic_string<char> >, std::_Select1st<std::pair<void *const, std::basic_string<char> > >, std::less<void *>, std::allocator<std::pair<void *const, std::basic_string<char> > > >::_Rb_tree_impl" }
|
||||
%"struct.std::_Rb_tree<void *, std::pair<void *const, std::basic_string<char> >, std::_Select1st<std::pair<void *const, std::basic_string<char> > >, std::less<void *>, std::allocator<std::pair<void *const, std::basic_string<char> > > >::_Rb_tree_impl" = type { %"struct.std::less.9", %"struct.std::_Rb_tree_node_base", i64 }
|
||||
%"struct.std::less.9" = type { i8 }
|
||||
%class.rust_port_selector = type { %class.rust_port**, i64, %class.lock_and_signal }
|
||||
%class.rust_port = type { i64, i64, %class.rust_kernel*, %struct.rust_task*, i64, %class.circular_buffer, %class.lock_and_signal }
|
||||
%class.circular_buffer = type { %class.rust_kernel*, i64, i64, i64, i64, i8* }
|
||||
%struct.rust_opaque_box = type { i64, %struct.type_desc*, %struct.rust_opaque_box*, %struct.rust_opaque_box* }
|
||||
%struct.rust_shape_tables = type { i8*, i8* }
|
||||
%struct.rust_task = type { i64, i64, i8, %struct.chan_handle, [8 x i8], %class.context, %struct.stk_seg*, i64, %class.rust_scheduler*, %struct.rust_task_thread*, %class.rust_crate_cache*, %class.rust_kernel*, i8*, %class.rust_task_list*, %"struct.memory_region::alloc_header"*, i8*, %struct.rust_task*, i32, i64, i64*, %class.memory_region, %class.boxed_region, i8, i8, %class.lock_and_signal, %class.hash_map, %class.rust_obstack, i32, %"class.debug::task_debug_info", i64, i8, i8, %struct.stk_seg*, i64, i64, %class.rust_port_selector }
|
||||
%struct.rust_task_thread = type { %class.rust_thread, i64, %class.rust_log, i32, %class.rust_srv*, i8*, %class.rust_task_list, %class.rust_task_list, %class.rust_task_list, %class.rust_task_list, %class.rust_crate_cache, %struct.randctx, %class.rust_kernel*, %class.rust_scheduler*, i32, i32, %class.lock_and_signal, i64, %struct._opaque_pthread_attr_t, %struct.rust_env*, %class.context, i8, %struct.stk_seg*, %struct.stk_seg*, [8 x i8] }
|
||||
%struct.rust_vec = type { i64, i64, [0 x i8] }
|
||||
%"struct.std::_Rb_tree<long, std::pair<const long, rust_scheduler *>, std::_Select1st<std::pair<const long, rust_scheduler *> >, std::less<long>, std::allocator<std::pair<const long, rust_scheduler *> > >::_Rb_tree_impl" = type { %"struct.memory_region::alloc_header", %"struct.std::_Rb_tree_node_base", i64 }
|
||||
%"struct.std::_Rb_tree_node_base" = type { i32, %"struct.std::_Rb_tree_node_base"*, %"struct.std::_Rb_tree_node_base"*, %"struct.std::_Rb_tree_node_base"* }
|
||||
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long, std::allocator<long> >::_Vector_impl" }
|
||||
%"struct.std::_Vector_base<long, std::allocator<long> >::_Vector_impl" = type { i64*, i64*, i64* }
|
||||
%struct.stk_seg = type { %struct.stk_seg*, %struct.stk_seg*, i64, i32, i64, [0 x i8] }
|
||||
%struct.type_desc = type { %struct.type_desc**, i64, i64, void (i8*, i8*, %struct.type_desc**, i8*)*, void (i8*, i8*, %struct.type_desc**, i8*)*, void (i8*, i8*, %struct.type_desc**, i8*)*, i8*, void (i8*, i8*, %struct.type_desc**, i8*)*, void (i8*, i8*, %struct.type_desc**, i8*)*, i64, i8*, i8*, %struct.rust_shape_tables*, i64, i64, %struct.UT_hash_handle, i64, [0 x %struct.type_desc*] }
|
||||
|
||||
define void @rust_intrinsic_vec_len(i64* nocapture %retptr, i8* nocapture %env, %struct.type_desc* nocapture %ty, %struct.rust_vec** nocapture %vp) nounwind uwtable {
|
||||
entry:
|
||||
%0 = load %struct.rust_vec** %vp, align 8, !tbaa !0
|
||||
%fill = getelementptr inbounds %struct.rust_vec* %0, i64 0, i32 0
|
||||
%1 = load i64* %fill, align 8, !tbaa !3
|
||||
%size = getelementptr inbounds %struct.type_desc* %ty, i64 0, i32 1
|
||||
%2 = load i64* %size, align 8, !tbaa !3
|
||||
%div = udiv i64 %1, %2
|
||||
store i64 %div, i64* %retptr, align 8, !tbaa !3
|
||||
define void @rust_intrinsic_vec_len(i64* nocapture %retptr, i8* nocapture %env, %struct.type_desc* nocapture %ty, %struct.rust_vec** nocapture %vp) nounwind {
|
||||
%1 = load %struct.rust_vec** %vp, align 8
|
||||
%2 = getelementptr inbounds %struct.rust_vec* %1, i64 0, i32 0
|
||||
%3 = load i64* %2, align 8
|
||||
%4 = getelementptr inbounds %struct.type_desc* %ty, i64 0, i32 1
|
||||
%5 = load i64* %4, align 8
|
||||
%6 = udiv i64 %3, %5
|
||||
store i64 %6, i64* %retptr, align 8
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @rust_intrinsic_ptr_offset(i8** nocapture %retptr, i8* nocapture %env, %struct.type_desc* nocapture %ty, i8* %ptr, i64 %count) nounwind uwtable {
|
||||
entry:
|
||||
%size = getelementptr inbounds %struct.type_desc* %ty, i64 0, i32 1
|
||||
%0 = load i64* %size, align 8, !tbaa !3
|
||||
%mul = mul i64 %0, %count
|
||||
%arrayidx = getelementptr inbounds i8* %ptr, i64 %mul
|
||||
store i8* %arrayidx, i8** %retptr, align 8, !tbaa !0
|
||||
define void @rust_intrinsic_ptr_offset(i8** nocapture %retptr, i8* nocapture %env, %struct.type_desc* nocapture %ty, i8* %ptr, i64 %count) nounwind {
|
||||
%1 = getelementptr inbounds %struct.type_desc* %ty, i64 0, i32 1
|
||||
%2 = load i64* %1, align 8
|
||||
%3 = mul i64 %2, %count
|
||||
%4 = getelementptr inbounds i8* %ptr, i64 %3
|
||||
store i8* %4, i8** %retptr, align 8
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @rust_intrinsic_cast(i8* nocapture %retptr, i8* nocapture %env, %struct.type_desc* nocapture %t1, %struct.type_desc* nocapture %t2, i8* nocapture %src) nounwind uwtable {
|
||||
entry:
|
||||
%size = getelementptr inbounds %struct.type_desc* %t1, i64 0, i32 1
|
||||
%0 = load i64* %size, align 8, !tbaa !3
|
||||
tail call void @llvm.memmove.p0i8.p0i8.i64(i8* %retptr, i8* %src, i64 %0, i32 1, i1 false)
|
||||
define void @rust_intrinsic_cast(i8* nocapture %retptr, i8* nocapture %env, %struct.type_desc* nocapture %t1, %struct.type_desc* nocapture %t2, i8* nocapture %src) nounwind {
|
||||
%1 = getelementptr inbounds %struct.type_desc* %t1, i64 0, i32 1
|
||||
%2 = load i64* %1, align 8
|
||||
tail call void @llvm.memmove.p0i8.p0i8.i64(i8* %retptr, i8* %src, i64 %2, i32 1, i1 false)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @llvm.memmove.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
|
||||
|
||||
define void @rust_intrinsic_addr_of(i8** nocapture %retptr, i8* nocapture %env, %struct.type_desc* nocapture %ty, i8* %valptr) nounwind uwtable {
|
||||
entry:
|
||||
store i8* %valptr, i8** %retptr, align 8, !tbaa !0
|
||||
define void @rust_intrinsic_addr_of(i8** nocapture %retptr, i8* nocapture %env, %struct.type_desc* nocapture %ty, i8* %valptr) nounwind {
|
||||
store i8* %valptr, i8** %retptr, align 8
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @rust_intrinsic_call_with_retptr(i8** %retptr, i8* nocapture %env, %struct.type_desc* nocapture %ty, %struct.rust_fn* nocapture %recvfn) uwtable {
|
||||
entry:
|
||||
%fn1 = getelementptr inbounds %struct.rust_fn* %recvfn, i64 0, i32 0
|
||||
%0 = load i64** %fn1, align 8, !tbaa !0
|
||||
%1 = bitcast i64* %0 to void (i8**, i8*, i8**)*
|
||||
%env2 = getelementptr inbounds %struct.rust_fn* %recvfn, i64 0, i32 1
|
||||
%2 = load %struct.rust_box** %env2, align 8, !tbaa !0
|
||||
%3 = bitcast %struct.rust_box* %2 to i8*
|
||||
tail call void %1(i8** null, i8* %3, i8** %retptr)
|
||||
define void @rust_intrinsic_call_with_retptr(i8** %retptr, i8* nocapture %env, %struct.type_desc* nocapture %ty, %struct.rust_fn* nocapture %recvfn) {
|
||||
%1 = getelementptr inbounds %struct.rust_fn* %recvfn, i64 0, i32 0
|
||||
%2 = load i64** %1, align 8
|
||||
%3 = bitcast i64* %2 to void (i8**, i8*, i8**)*
|
||||
%4 = getelementptr inbounds %struct.rust_fn* %recvfn, i64 0, i32 1
|
||||
%5 = load %struct.rust_box** %4, align 8
|
||||
%6 = bitcast %struct.rust_box* %5 to i8*
|
||||
tail call void %3(i8** null, i8* %6, i8** %retptr)
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @rust_intrinsic_get_type_desc(i8** nocapture %retptr, i8* nocapture %env, %struct.type_desc* %ty) nounwind uwtable {
|
||||
entry:
|
||||
define void @rust_intrinsic_get_type_desc(i8** nocapture %retptr, i8* nocapture %env, %struct.type_desc* %ty) nounwind {
|
||||
%ty.c = bitcast %struct.type_desc* %ty to i8*
|
||||
store i8* %ty.c, i8** %retptr, align 8, !tbaa !0
|
||||
store i8* %ty.c, i8** %retptr, align 8
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @rust_intrinsic_task_yield(i8** nocapture %retptr, i8* nocapture %env, %struct.rust_task* %task, i8* %killed) uwtable {
|
||||
entry:
|
||||
define void @rust_intrinsic_task_yield(i8** nocapture %retptr, i8* nocapture %env, %struct.rust_task* %task, i8* %killed) {
|
||||
tail call void @rust_task_yield(%struct.rust_task* %task, i8* %killed)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @rust_task_yield(%struct.rust_task*, i8*)
|
||||
|
||||
define void @rust_intrinsic_memmove(i8* nocapture %retptr, i8* nocapture %env, %struct.type_desc* nocapture %ty, i8* nocapture %dst, i8* nocapture %src, i64 %count) nounwind uwtable {
|
||||
entry:
|
||||
%size = getelementptr inbounds %struct.type_desc* %ty, i64 0, i32 1
|
||||
%0 = load i64* %size, align 8, !tbaa !3
|
||||
%mul = mul i64 %0, %count
|
||||
tail call void @llvm.memmove.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %mul, i32 1, i1 false)
|
||||
define void @rust_intrinsic_memmove(i8* nocapture %retptr, i8* nocapture %env, %struct.type_desc* nocapture %ty, i8* nocapture %dst, i8* nocapture %src, i64 %count) nounwind {
|
||||
%1 = getelementptr inbounds %struct.type_desc* %ty, i64 0, i32 1
|
||||
%2 = load i64* %1, align 8
|
||||
%3 = mul i64 %2, %count
|
||||
tail call void @llvm.memmove.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %3, i32 1, i1 false)
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @rust_intrinsic_memcpy(i8* nocapture %retptr, i8* nocapture %env, %struct.type_desc* nocapture %ty, i8* nocapture %dst, i8* nocapture %src, i64 %count) nounwind uwtable {
|
||||
entry:
|
||||
%size = getelementptr inbounds %struct.type_desc* %ty, i64 0, i32 1
|
||||
%0 = load i64* %size, align 8, !tbaa !3
|
||||
%mul = mul i64 %0, %count
|
||||
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %mul, i32 1, i1 false)
|
||||
define void @rust_intrinsic_memcpy(i8* nocapture %retptr, i8* nocapture %env, %struct.type_desc* nocapture %ty, i8* nocapture %dst, i8* nocapture %src, i64 %count) nounwind {
|
||||
%1 = getelementptr inbounds %struct.type_desc* %ty, i64 0, i32 1
|
||||
%2 = load i64* %1, align 8
|
||||
%3 = mul i64 %2, %count
|
||||
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %3, i32 1, i1 false)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
|
||||
|
||||
define void @rust_intrinsic_leak(i8* nocapture %retptr, i8* nocapture %env, %struct.type_desc* nocapture %ty, i8* nocapture %thing) nounwind uwtable readnone {
|
||||
entry:
|
||||
define void @rust_intrinsic_leak(i8* nocapture %retptr, i8* nocapture %env, %struct.type_desc* nocapture %ty, i8* nocapture %thing) nounwind readnone {
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @upcall_intrinsic_vec_push(%struct.rust_vec** nocapture %vp, %struct.type_desc* nocapture %elt_ty, i8* nocapture %elt) uwtable {
|
||||
entry:
|
||||
%0 = load %struct.rust_vec** %vp, align 8, !tbaa !0
|
||||
%fill = getelementptr inbounds %struct.rust_vec* %0, i64 0, i32 0
|
||||
%1 = load i64* %fill, align 8, !tbaa !3
|
||||
%size = getelementptr inbounds %struct.type_desc* %elt_ty, i64 0, i32 1
|
||||
%2 = load i64* %size, align 8, !tbaa !3
|
||||
%add = add i64 %2, %1
|
||||
%alloc.i = getelementptr inbounds %struct.rust_vec* %0, i64 0, i32 1
|
||||
%3 = load i64* %alloc.i, align 8, !tbaa !3
|
||||
%cmp.i = icmp ult i64 %3, %add
|
||||
br i1 %cmp.i, label %if.then.i, label %_Z16reserve_vec_fastPP8rust_vecm.exit
|
||||
define void @upcall_intrinsic_vec_push(%struct.rust_vec** nocapture %vp, %struct.type_desc* nocapture %elt_ty, i8* nocapture %elt) {
|
||||
; <label>:0
|
||||
%1 = load %struct.rust_vec** %vp, align 8
|
||||
%2 = getelementptr inbounds %struct.rust_vec* %1, i64 0, i32 0
|
||||
%3 = load i64* %2, align 8
|
||||
%4 = getelementptr inbounds %struct.type_desc* %elt_ty, i64 0, i32 1
|
||||
%5 = load i64* %4, align 8
|
||||
%6 = add i64 %5, %3
|
||||
%7 = getelementptr inbounds %struct.rust_vec* %1, i64 0, i32 1
|
||||
%8 = load i64* %7, align 8
|
||||
%9 = icmp ult i64 %8, %6
|
||||
br i1 %9, label %10, label %_Z16reserve_vec_fastPP8rust_vecm.exit
|
||||
|
||||
if.then.i: ; preds = %entry
|
||||
%sub.i.i = add i64 %add, -1
|
||||
%shr.i.i = lshr i64 %sub.i.i, 1
|
||||
%or.i.i = or i64 %shr.i.i, %sub.i.i
|
||||
%shr1.i.i = lshr i64 %or.i.i, 2
|
||||
%or2.i.i = or i64 %shr1.i.i, %or.i.i
|
||||
%shr3.i.i = lshr i64 %or2.i.i, 4
|
||||
%or4.i.i = or i64 %shr3.i.i, %or2.i.i
|
||||
%shr5.i.i = lshr i64 %or4.i.i, 8
|
||||
%or6.i.i = or i64 %shr5.i.i, %or4.i.i
|
||||
%shr7.i.i = lshr i64 %or6.i.i, 16
|
||||
%or8.i.i = or i64 %shr7.i.i, %or6.i.i
|
||||
%shr9.i.i = lshr i64 %or8.i.i, 32
|
||||
%or10.i.i = or i64 %shr9.i.i, %or8.i.i
|
||||
%add.i.i = add i64 %or10.i.i, 1
|
||||
%add.i = add i64 %or10.i.i, 17
|
||||
%4 = bitcast %struct.rust_vec* %0 to i8*
|
||||
%call1.i = tail call i8* @upcall_shared_realloc(i8* %4, i64 %add.i)
|
||||
%5 = bitcast i8* %call1.i to %struct.rust_vec*
|
||||
store %struct.rust_vec* %5, %struct.rust_vec** %vp, align 8, !tbaa !0
|
||||
%alloc2.i = getelementptr inbounds i8* %call1.i, i64 8
|
||||
%6 = bitcast i8* %alloc2.i to i64*
|
||||
store i64 %add.i.i, i64* %6, align 8, !tbaa !3
|
||||
%.pr = load i64* %size, align 8
|
||||
%fill1.phi.trans.insert = bitcast i8* %call1.i to i64*
|
||||
%.pre = load i64* %fill1.phi.trans.insert, align 8, !tbaa !3
|
||||
; <label>:10 ; preds = %0
|
||||
%11 = add i64 %6, -1
|
||||
%12 = lshr i64 %11, 1
|
||||
%13 = or i64 %12, %11
|
||||
%14 = lshr i64 %13, 2
|
||||
%15 = or i64 %14, %13
|
||||
%16 = lshr i64 %15, 4
|
||||
%17 = or i64 %16, %15
|
||||
%18 = lshr i64 %17, 8
|
||||
%19 = or i64 %18, %17
|
||||
%20 = lshr i64 %19, 16
|
||||
%21 = or i64 %20, %19
|
||||
%22 = lshr i64 %21, 32
|
||||
%23 = or i64 %22, %21
|
||||
%24 = add i64 %23, 1
|
||||
%25 = add i64 %23, 17
|
||||
%26 = bitcast %struct.rust_vec* %1 to i8*
|
||||
%27 = tail call i8* @upcall_shared_realloc(i8* %26, i64 %25)
|
||||
%28 = bitcast i8* %27 to %struct.rust_vec*
|
||||
store %struct.rust_vec* %28, %struct.rust_vec** %vp, align 8
|
||||
%29 = getelementptr inbounds i8* %27, i64 8
|
||||
%30 = bitcast i8* %29 to i64*
|
||||
store i64 %24, i64* %30, align 8
|
||||
%.pr = load i64* %4, align 8
|
||||
%.pre = load %struct.rust_vec** %vp, align 8
|
||||
%.phi.trans.insert = getelementptr inbounds %struct.rust_vec* %.pre, i64 0, i32 0
|
||||
%.pre4 = load i64* %.phi.trans.insert, align 8
|
||||
br label %_Z16reserve_vec_fastPP8rust_vecm.exit
|
||||
|
||||
_Z16reserve_vec_fastPP8rust_vecm.exit: ; preds = %entry, %if.then.i
|
||||
%7 = phi i64 [ %1, %entry ], [ %.pre, %if.then.i ]
|
||||
%8 = phi %struct.rust_vec* [ %0, %entry ], [ %5, %if.then.i ]
|
||||
%9 = phi i64 [ %2, %entry ], [ %.pr, %if.then.i ]
|
||||
%fill1 = getelementptr inbounds %struct.rust_vec* %8, i64 0, i32 0
|
||||
%add.ptr = getelementptr inbounds %struct.rust_vec* %8, i64 0, i32 2, i64 %7
|
||||
tail call void @llvm.memmove.p0i8.p0i8.i64(i8* %add.ptr, i8* %elt, i64 %9, i32 1, i1 false)
|
||||
%take_glue.i = getelementptr inbounds %struct.type_desc* %elt_ty, i64 0, i32 3
|
||||
%10 = load void (i8*, i8*, %struct.type_desc**, i8*)** %take_glue.i, align 8, !tbaa !0
|
||||
%tobool.i = icmp eq void (i8*, i8*, %struct.type_desc**, i8*)* %10, null
|
||||
br i1 %tobool.i, label %_ZL13copy_elementsP9type_descPvS1_m.exit, label %if.then.i6
|
||||
_Z16reserve_vec_fastPP8rust_vecm.exit: ; preds = %0, %10
|
||||
%31 = phi i64 [ %3, %0 ], [ %.pre4, %10 ]
|
||||
%32 = phi %struct.rust_vec* [ %1, %0 ], [ %.pre, %10 ]
|
||||
%33 = phi i64 [ %5, %0 ], [ %.pr, %10 ]
|
||||
%34 = getelementptr inbounds %struct.rust_vec* %32, i64 0, i32 0
|
||||
%35 = getelementptr inbounds %struct.rust_vec* %32, i64 0, i32 2, i64 %31
|
||||
tail call void @llvm.memmove.p0i8.p0i8.i64(i8* %35, i8* %elt, i64 %33, i32 1, i1 false)
|
||||
%36 = getelementptr inbounds %struct.type_desc* %elt_ty, i64 0, i32 3
|
||||
%37 = load void (i8*, i8*, %struct.type_desc**, i8*)** %36, align 8
|
||||
%38 = icmp eq void (i8*, i8*, %struct.type_desc**, i8*)* %37, null
|
||||
br i1 %38, label %_ZL13copy_elementsP9type_descPvS1_m.exit, label %39
|
||||
|
||||
if.then.i6: ; preds = %_Z16reserve_vec_fastPP8rust_vecm.exit
|
||||
%11 = load i64* %size, align 8, !tbaa !3
|
||||
%first_param.i = getelementptr inbounds %struct.type_desc* %elt_ty, i64 0, i32 0
|
||||
%12 = load %struct.type_desc*** %first_param.i, align 8, !tbaa !0
|
||||
%add.ptr.sum = add i64 %7, %9
|
||||
%add.ptr.i = getelementptr inbounds %struct.rust_vec* %8, i64 0, i32 2, i64 %add.ptr.sum
|
||||
%cmp4.i = icmp sgt i64 %9, 0
|
||||
br i1 %cmp4.i, label %for.body.i, label %_ZL13copy_elementsP9type_descPvS1_m.exit
|
||||
; <label>:39 ; preds = %_Z16reserve_vec_fastPP8rust_vecm.exit
|
||||
%40 = load i64* %4, align 8
|
||||
%41 = getelementptr inbounds %struct.type_desc* %elt_ty, i64 0, i32 0
|
||||
%42 = load %struct.type_desc*** %41, align 8
|
||||
%43 = icmp sgt i64 %33, 0
|
||||
br i1 %43, label %.lr.ph.i.preheader, label %_ZL13copy_elementsP9type_descPvS1_m.exit
|
||||
|
||||
for.body.i: ; preds = %if.then.i6, %for.body.i
|
||||
%p.05.i = phi i8* [ %add.ptr3.i, %for.body.i ], [ %add.ptr, %if.then.i6 ]
|
||||
tail call void %10(i8* null, i8* null, %struct.type_desc** %12, i8* %p.05.i)
|
||||
%add.ptr3.i = getelementptr inbounds i8* %p.05.i, i64 %11
|
||||
%cmp.i7 = icmp ult i8* %add.ptr3.i, %add.ptr.i
|
||||
br i1 %cmp.i7, label %for.body.i, label %_ZL13copy_elementsP9type_descPvS1_m.exit
|
||||
.lr.ph.i.preheader: ; preds = %39
|
||||
%scevgep = getelementptr %struct.rust_vec* %32, i64 1, i32 0
|
||||
%scevgep2 = bitcast i64* %scevgep to i8*
|
||||
br label %.lr.ph.i
|
||||
|
||||
_ZL13copy_elementsP9type_descPvS1_m.exit: ; preds = %for.body.i, %_Z16reserve_vec_fastPP8rust_vecm.exit, %if.then.i6
|
||||
%13 = load i64* %size, align 8, !tbaa !3
|
||||
%14 = load i64* %fill1, align 8, !tbaa !3
|
||||
%add5 = add i64 %14, %13
|
||||
store i64 %add5, i64* %fill1, align 8, !tbaa !3
|
||||
.lr.ph.i: ; preds = %.lr.ph.i.preheader, %.lr.ph.i
|
||||
%indvar.i = phi i64 [ %indvar.next.i, %.lr.ph.i ], [ 0, %.lr.ph.i.preheader ]
|
||||
%tmp = mul i64 %40, %indvar.i
|
||||
%tmp2.i = add i64 %40, %tmp
|
||||
%tmp3 = add i64 %31, %tmp
|
||||
%p.01.i = getelementptr i8* %scevgep2, i64 %tmp3
|
||||
tail call void %37(i8* null, i8* null, %struct.type_desc** %42, i8* %p.01.i)
|
||||
%44 = icmp slt i64 %tmp2.i, %33
|
||||
%indvar.next.i = add i64 %indvar.i, 1
|
||||
br i1 %44, label %.lr.ph.i, label %_ZL13copy_elementsP9type_descPvS1_m.exit
|
||||
|
||||
_ZL13copy_elementsP9type_descPvS1_m.exit: ; preds = %.lr.ph.i, %_Z16reserve_vec_fastPP8rust_vecm.exit, %39
|
||||
%45 = load i64* %4, align 8
|
||||
%46 = load i64* %34, align 8
|
||||
%47 = add i64 %46, %45
|
||||
store i64 %47, i64* %34, align 8
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @upcall_vec_push(%struct.rust_vec** nocapture %vp, %struct.type_desc* nocapture %elt_ty, i8* nocapture %elt) uwtable {
|
||||
entry:
|
||||
define void @upcall_vec_push(%struct.rust_vec** nocapture %vp, %struct.type_desc* nocapture %elt_ty, i8* nocapture %elt) {
|
||||
tail call void @upcall_intrinsic_vec_push(%struct.rust_vec** %vp, %struct.type_desc* %elt_ty, i8* %elt)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare i8* @upcall_shared_realloc(i8*, i64)
|
||||
define void @rust_intrinsic_frame_address(i8** nocapture %p) nounwind {
|
||||
%1 = tail call i8* @llvm.frameaddress(i32 1)
|
||||
store i8* %1, i8** %p, align 8
|
||||
ret void
|
||||
}
|
||||
|
||||
!0 = metadata !{metadata !"any pointer", metadata !1}
|
||||
!1 = metadata !{metadata !"omnipotent char", metadata !2}
|
||||
!2 = metadata !{metadata !"Simple C/C++ TBAA", null}
|
||||
!3 = metadata !{metadata !"long", metadata !1}
|
||||
declare i8* @llvm.frameaddress(i32) nounwind readnone
|
||||
|
||||
declare i8* @upcall_shared_realloc(i8*, i64)
|
||||
|
@ -682,11 +682,6 @@ rust_dbg_call(dbg_callback cb, void *data) {
|
||||
return cb(data);
|
||||
}
|
||||
|
||||
extern "C" CDECL void *
|
||||
rust_frame_address() {
|
||||
return __builtin_frame_address(1);
|
||||
}
|
||||
|
||||
//
|
||||
// Local Variables:
|
||||
// mode: C++
|
||||
|
@ -101,4 +101,3 @@ rust_dbg_lock_unlock
|
||||
rust_dbg_lock_wait
|
||||
rust_dbg_lock_signal
|
||||
rust_dbg_call
|
||||
rust_frame_address
|
||||
|
10
src/test/auxiliary/cci_impl_lib.rs
Normal file
10
src/test/auxiliary/cci_impl_lib.rs
Normal file
@ -0,0 +1,10 @@
|
||||
impl helpers for uint {
|
||||
#[inline]
|
||||
fn to(v: uint, f: fn(uint)) {
|
||||
let i = self;
|
||||
while i < v {
|
||||
f(i);
|
||||
i += 1u;
|
||||
}
|
||||
}
|
||||
}
|
9
src/test/auxiliary/cci_no_inline_lib.rs
Normal file
9
src/test/auxiliary/cci_no_inline_lib.rs
Normal file
@ -0,0 +1,9 @@
|
||||
// same as cci_iter_lib, more-or-less, but not marked inline
|
||||
fn iter(v: [uint], f: fn(uint)) {
|
||||
let i = 0u;
|
||||
let n = vec::len(v);
|
||||
while i < n {
|
||||
f(v[i]);
|
||||
i += 1u;
|
||||
}
|
||||
}
|
19
src/test/run-pass/cci_impl_exe.rs
Normal file
19
src/test/run-pass/cci_impl_exe.rs
Normal file
@ -0,0 +1,19 @@
|
||||
// aux-build:cci_impl_lib.rs
|
||||
|
||||
use std;
|
||||
use cci_impl_lib;
|
||||
import std::io;
|
||||
import cci_impl_lib::helpers;
|
||||
|
||||
fn main() {
|
||||
//let bt0 = sys::frame_address();
|
||||
//#debug["%?", bt0];
|
||||
|
||||
3u.to(10u) {|i|
|
||||
io::print(#fmt["%u\n", i]);
|
||||
|
||||
//let bt1 = sys::frame_address();
|
||||
//#debug["%?", bt1];
|
||||
//assert bt0 == bt1;
|
||||
}
|
||||
}
|
15
src/test/run-pass/cci_iter_exe.rs
Normal file
15
src/test/run-pass/cci_iter_exe.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// aux-build:cci_iter_lib.rs
|
||||
|
||||
use std;
|
||||
use cci_iter_lib;
|
||||
|
||||
import std::io;
|
||||
|
||||
fn main() {
|
||||
//let bt0 = sys::rusti::frame_address(1u32);
|
||||
//#debug["%?", bt0];
|
||||
cci_iter_lib::iter([1, 2, 3]) {|i|
|
||||
io::print(#fmt["%d", i]);
|
||||
//assert bt0 == sys::rusti::frame_address(2u32);
|
||||
}
|
||||
}
|
25
src/test/run-pass/cci_no_inline_exe.rs
Normal file
25
src/test/run-pass/cci_no_inline_exe.rs
Normal file
@ -0,0 +1,25 @@
|
||||
// aux-build:cci_no_inline_lib.rs
|
||||
|
||||
use std;
|
||||
use cci_no_inline_lib;
|
||||
import cci_no_inline_lib::iter;
|
||||
|
||||
import std::io;
|
||||
|
||||
fn main() {
|
||||
// Check that a cross-crate call function not marked as inline
|
||||
// does not, in fact, get inlined. Also, perhaps more
|
||||
// importantly, checks that our scheme of using
|
||||
// sys::frame_address() to determine if we are inlining is
|
||||
// actually working.
|
||||
//let bt0 = sys::frame_address();
|
||||
//#debug["%?", bt0];
|
||||
iter([1u, 2u, 3u]) {|i|
|
||||
io::print(#fmt["%u\n", i]);
|
||||
|
||||
//let bt1 = sys::frame_address();
|
||||
//#debug["%?", bt1];
|
||||
|
||||
//assert bt0 != bt1;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user