diff options
| author | Marijn Haverbeke <marijnh@gmail.com> | 2012-03-23 11:51:06 +0100 |
|---|---|---|
| committer | Marijn Haverbeke <marijnh@gmail.com> | 2012-03-23 12:21:55 +0100 |
| commit | f5024692d49be49b2efff452059f83efaebfd0ee (patch) | |
| tree | 23da664fb1bf1c374081550309731cf206341b57 /src/rt | |
| parent | 0303396f4cc292b54a0b097364581c88b8631696 (diff) | |
| download | rust-f5024692d49be49b2efff452059f83efaebfd0ee.tar.gz rust-f5024692d49be49b2efff452059f83efaebfd0ee.zip | |
Remove support for the old-style intrinsics
Closes #2042 Closes #1981
Diffstat (limited to 'src/rt')
| -rw-r--r-- | src/rt/intrinsics/intrinsics.cpp | 174 | ||||
| -rw-r--r-- | src/rt/intrinsics/intrinsics.i386.ll.in | 236 | ||||
| -rw-r--r-- | src/rt/intrinsics/intrinsics.ll.bak | 149 | ||||
| -rw-r--r-- | src/rt/intrinsics/intrinsics.x86_64.ll.in | 237 |
4 files changed, 0 insertions, 796 deletions
diff --git a/src/rt/intrinsics/intrinsics.cpp b/src/rt/intrinsics/intrinsics.cpp deleted file mode 100644 index d36bdf87675..00000000000 --- a/src/rt/intrinsics/intrinsics.cpp +++ /dev/null @@ -1,174 +0,0 @@ -// Rust intrinsics. These are built into each compilation unit and are -// run on the Rust stack. They should not call C methods because that -// will very likely result in running off the end of the stack. -// Build with the script in src/etc/gen-intrinsics - -#include "../rust_internal.h" -#include "../rust_util.h" -#include <cstdlib> -#include <cstring> - -extern "C" CDECL void -rust_task_yield(rust_task *task, bool *killed); - -extern "C" void -rust_intrinsic_vec_len(size_t *retptr, - void *env, - type_desc *ty, - rust_vec **vp) -{ - *retptr = (*vp)->fill / ty->size; -} - -extern "C" void -rust_intrinsic_ptr_offset(void **retptr, - void *env, - type_desc *ty, - void *ptr, - uintptr_t count) -{ - *retptr = &((uint8_t *)ptr)[ty->size * count]; -} - -extern "C" void -rust_intrinsic_cast(void *retptr, - void *env, - type_desc *t1, - type_desc *t2, - void *src) -{ - // assert t1->size == t2->size - // FIXME: This should be easily expressible in rust - memmove(retptr, src, t1->size); -} - -extern "C" void -rust_intrinsic_addr_of(void **retptr, - void *env, - type_desc *ty, - void *valptr) { - *retptr = valptr; -} - -struct rust_fn { - uintptr_t *fn; - rust_box *env; -}; - -typedef void (*retptr_fn)(void **retptr, - void *env, - void **dptr); -// FIXME (1185): This exists just to get access to the return pointer -extern "C" void -rust_intrinsic_call_with_retptr(void **retptr, - void *env, - type_desc *ty, - rust_fn *recvfn) { - retptr_fn fn = ((retptr_fn)(recvfn->fn)); - ((retptr_fn)(*fn))(NULL, recvfn->env, retptr); -} - -extern "C" void -rust_intrinsic_get_type_desc(void **retptr, - void *env, - type_desc* ty) { - *(type_desc**)retptr = ty; -} - -extern "C" void -rust_intrinsic_task_yield(void **retptr, - void *env, - rust_task *task, - bool *killed) { - rust_task_yield(task, killed); -} - -extern "C" void -rust_intrinsic_memmove(void *retptr, - void *env, - type_desc *ty, - void *dst, - void *src, - uintptr_t count) -{ - memmove(dst, src, ty->size * count); -} - -extern "C" void -rust_intrinsic_memcpy(void *retptr, - void *env, - type_desc *ty, - void *dst, - void *src, - uintptr_t count) -{ - memcpy(dst, src, ty->size * count); -} - -extern "C" void -rust_intrinsic_leak(void *retptr, - void *env, - type_desc *ty, - void *thing) -{ -} - -extern "C" CDECL void * -upcall_shared_realloc(void *ptr, size_t size); - -inline void reserve_vec_fast(rust_vec **vpp, size_t size) { - if (size > (*vpp)->alloc) { - size_t new_size = next_power_of_two(size); - size_t alloc_size = new_size + sizeof(rust_vec); - // Because this is called from an intrinsic we need to use - // the exported API - *vpp = (rust_vec*)upcall_shared_realloc(*vpp, alloc_size); - (*vpp)->alloc = new_size; - } -} - -// Copy elements from one vector to another, -// dealing with reference counts -static inline void -copy_elements(type_desc *elem_t, - void *pdst, void *psrc, size_t n) { - char *dst = (char *)pdst, *src = (char *)psrc; - memmove(dst, src, n); - - // increment the refcount of each element of the vector - if (elem_t->take_glue) { - glue_fn *take_glue = elem_t->take_glue; - size_t elem_size = elem_t->size; - const type_desc **tydescs = elem_t->first_param; - for (char *p = dst; p < dst+n; p += elem_size) { - take_glue(NULL, NULL, tydescs, p); - } - } -} - -// Because this is used so often, and it calls take glue that must run -// on the rust stack, it is statically compiled into every crate. -extern "C" CDECL void -upcall_intrinsic_vec_push(rust_vec** vp, - type_desc* elt_ty, void* elt) { - - size_t new_sz = (*vp)->fill + elt_ty->size; - reserve_vec_fast(vp, new_sz); - rust_vec* v = *vp; - copy_elements(elt_ty, &v->data[0] + v->fill, - elt, elt_ty->size); - v->fill += elt_ty->size; -} - -// FIXME: Transational. Remove -extern "C" CDECL void -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); -} - diff --git a/src/rt/intrinsics/intrinsics.i386.ll.in b/src/rt/intrinsics/intrinsics.i386.ll.in deleted file mode 100644 index a03bed03118..00000000000 --- a/src/rt/intrinsics/intrinsics.i386.ll.in +++ /dev/null @@ -1,236 +0,0 @@ -; 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:128:128-n8:16:32" -target triple = "@CFG_TARGET_TRIPLE@" - -%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.__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 } -%"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 } -%struct.randctx = type { i32, [256 x i32], [256 x i32], i32, i32, i32 } -%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] } -%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 { - %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 { - %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 { - %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 { - 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) { - %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 { - %ty.c = bitcast %struct.type_desc* %ty to i8* - 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) { - 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, i32 %count) nounwind { - %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 { - %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 { - ret void -} - -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 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 - -; <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_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 - -; <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 - -.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 - -.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) { - tail call void @upcall_intrinsic_vec_push(%struct.rust_vec** %vp, %struct.type_desc* %elt_ty, i8* %elt) - ret void -} - -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 -} - -declare i8* @llvm.frameaddress(i32) nounwind readnone - -declare i8* @upcall_shared_realloc(i8*, i32) diff --git a/src/rt/intrinsics/intrinsics.ll.bak b/src/rt/intrinsics/intrinsics.ll.bak deleted file mode 100644 index 8f02e4b3d98..00000000000 --- a/src/rt/intrinsics/intrinsics.ll.bak +++ /dev/null @@ -1,149 +0,0 @@ -; ModuleID = 'intrinsics.cpp' -target triple = "@CFG_LLVM_TRIPLE@" - -%struct.rust_task = type { i32, %struct.stk_seg*, i32, i32, %struct.gc_alloc*, %struct.rust_scheduler*, %class.rust_crate_cache*, %class.rust_kernel*, i8*, %class.rust_task_list*, %struct.rust_cond*, i8*, %struct.rust_task*, i32, i32, i32, %class.timer, i32*, %class.array_list, %class.context, i32, i32, %class.memory_region, %"class.rust_task::wakeup_callback"*, i8, i8, %class.lock_and_signal } -%struct.stk_seg = type { i32, i32, [0 x i8] } -%struct.gc_alloc = type { %struct.gc_alloc*, %struct.gc_alloc*, i32, [0 x i8] } -%struct.rust_scheduler = type { %class.rust_thread, %struct.rc_base, 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*, i32, %class.hash_map, %class.hash_map.3, i32, %class.lock_and_signal, i32, %struct._opaque_pthread_attr_t, %struct.rust_env* } -%class.rust_thread = type { i32 (...)**, i8, %struct._opaque_pthread_t* } -%struct._opaque_pthread_t = type { i32, %struct.__darwin_pthread_handler_rec*, [596 x i8] } -%struct.__darwin_pthread_handler_rec = type { {}*, i8*, %struct.__darwin_pthread_handler_rec* } -%struct.rc_base = type { i32 } -%class.rust_log = type { i32 (...)**, %class.rust_srv*, %struct.rust_scheduler*, i8 } -%class.rust_srv = type { i32 (...)**, %struct.rust_env*, %class.memory_region } -%struct.rust_env = type { i32, i32, i8*, i8, i8, i8* } -%class.memory_region = type { i32 (...)**, %class.rust_srv*, %class.memory_region*, i32, %class.array_list.0, i8, i8, %class.lock_and_signal, i8 } -%class.array_list.0 = type { i32, %"struct.memory_region::alloc_header"**, i32 } -%"struct.memory_region::alloc_header" = type { i32, i32, i8*, [0 x i8] } -%class.lock_and_signal = type { i32 (...)**, %struct._opaque_pthread_cond_t, %struct._opaque_pthread_mutex_t, %struct._opaque_pthread_t*, i8, i8 } -%struct._opaque_pthread_cond_t = type { i32, [24 x i8] } -%struct._opaque_pthread_mutex_t = type { i32, [40 x i8] } -%class.rust_task_list = type { %class.indexed_list, %struct.rust_scheduler*, i8* } -%class.indexed_list = type { i32 (...)**, %class.array_list } -%class.array_list = type { i32, %struct.rust_task**, i32 } -%class.rust_crate_cache = type { %struct.type_desc*, %struct.rust_scheduler*, i32 } -%struct.type_desc = type { %struct.type_desc**, i32, i32, {}*, {}*, {}*, {}*, {}*, {}*, i32, {}*, %struct.UT_hash_handle, i32, [0 x %struct.type_desc*] } -%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.randctx = type { i32, [256 x i32], [256 x i32], i32, i32, i32 } -%class.rust_kernel = type { i32 (...)**, %class.memory_region, %class.rust_log, %class.rust_srv*, %class.lock_and_signal, %class.array_list.4, %struct.randctx, i32, i32, i32, %struct.rust_env* } -%class.array_list.4 = type { i32, %struct.rust_scheduler**, i32 } -%class.hash_map = type { %"struct.hash_map<rust_task *, rust_task *>::map_entry"* } -%"struct.hash_map<rust_task *, rust_task *>::map_entry" = type opaque -%class.hash_map.3 = type { %"struct.hash_map<rust_port *, rust_port *>::map_entry"* } -%"struct.hash_map<rust_port *, rust_port *>::map_entry" = type opaque -%struct._opaque_pthread_attr_t = type { i32, [36 x i8] } -%struct.rust_cond = type { i8 } -%class.timer = type { i32 (...)**, i64, i64 } -%class.context = type { %struct.registers_t, %class.context* } -%struct.registers_t = type { i32, i32, i32, i32, i32, i32, i32, i32, i16, i16, i16, i16, i16, i16, i32, i32 } -%"class.rust_task::wakeup_callback" = type { i32 (...)** } -%struct.rust_vec = type { %struct.rc_base.5, i32, i32, i32, [0 x i8] } -%struct.rc_base.5 = type { i32 } -%struct.rust_ivec = type { i32, i32, %union.rust_ivec_payload } -%union.rust_ivec_payload = type { %struct.rust_ivec_heap* } -%struct.rust_ivec_heap = type { i32, [0 x i8] } -%class.rust_port = type { i32, %class.rust_kernel*, %struct.rust_task*, i32, %class.ptr_vec, %class.ptr_vec.7, %class.rust_chan*, %class.lock_and_signal } -%class.ptr_vec = type { %struct.rust_task*, i32, i32, %struct.rust_token** } -%struct.rust_token = type opaque -%class.ptr_vec.7 = type { %struct.rust_task*, i32, i32, %class.rust_chan** } -%class.rust_chan = type { i32, %class.rust_kernel*, %struct.rust_task*, %class.rust_port*, i32, %class.circular_buffer } -%class.circular_buffer = type { %class.rust_kernel*, i32, i32, i32, i32, i8* } - -@.str = private unnamed_addr constant [42 x i8] c"attempt to cast values of differing sizes\00", align 1 -@.str1 = private unnamed_addr constant [15 x i8] c"intrinsics.cpp\00", align 1 - -define linkonce_odr void @rust_intrinsic_vec_len(%struct.rust_task* nocapture %task, i32* nocapture %retptr, %struct.type_desc* nocapture %ty, %struct.rust_vec* nocapture %v) nounwind { -entry: - %fill = getelementptr inbounds %struct.rust_vec* %v, i32 0, i32 2 - %tmp1 = load i32* %fill, align 4, !tbaa !0 - %size = getelementptr inbounds %struct.type_desc* %ty, i32 0, i32 1 - %tmp3 = load i32* %size, align 4, !tbaa !0 - %div = udiv i32 %tmp1, %tmp3 - store i32 %div, i32* %retptr, align 4, !tbaa !0 - ret void -} - -define linkonce_odr void @rust_intrinsic_ivec_len(%struct.rust_task* nocapture %task, i32* nocapture %retptr, %struct.type_desc* nocapture %ty, %struct.rust_ivec* nocapture %v) nounwind { -entry: - %fill1 = getelementptr inbounds %struct.rust_ivec* %v, i32 0, i32 0 - %tmp2 = load i32* %fill1, align 4, !tbaa !0 - %tobool = icmp eq i32 %tmp2, 0 - br i1 %tobool, label %if.else, label %if.end17 - -if.else: ; preds = %entry - %ptr = getelementptr inbounds %struct.rust_ivec* %v, i32 0, i32 2, i32 0 - %tmp7 = load %struct.rust_ivec_heap** %ptr, align 4, !tbaa !3 - %tobool8 = icmp eq %struct.rust_ivec_heap* %tmp7, null - br i1 %tobool8, label %if.end17, label %if.then9 - -if.then9: ; preds = %if.else - %fill14 = getelementptr inbounds %struct.rust_ivec_heap* %tmp7, i32 0, i32 0 - %tmp15 = load i32* %fill14, align 4, !tbaa !0 - br label %if.end17 - -if.end17: ; preds = %if.else, %entry, %if.then9 - %fill.0 = phi i32 [ %tmp15, %if.then9 ], [ %tmp2, %entry ], [ 0, %if.else ] - %size = getelementptr inbounds %struct.type_desc* %ty, i32 0, i32 1 - %tmp20 = load i32* %size, align 4, !tbaa !0 - %div = udiv i32 %fill.0, %tmp20 - store i32 %div, i32* %retptr, align 4, !tbaa !0 - ret void -} - -define linkonce_odr void @rust_intrinsic_ptr_offset(%struct.rust_task* nocapture %task, i8** nocapture %retptr, %struct.type_desc* nocapture %ty, i8* %ptr, i32 %count) nounwind { -entry: - %size = getelementptr inbounds %struct.type_desc* %ty, i32 0, i32 1 - %tmp1 = load i32* %size, align 4, !tbaa !0 - %mul = mul i32 %tmp1, %count - %arrayidx = getelementptr inbounds i8* %ptr, i32 %mul - store i8* %arrayidx, i8** %retptr, align 4, !tbaa !3 - ret void -} - -define linkonce_odr void @rust_intrinsic_cast(%struct.rust_task* %task, i8* nocapture %retptr, %struct.type_desc* nocapture %t1, %struct.type_desc* nocapture %t2, i8* nocapture %src) { -entry: - %size = getelementptr inbounds %struct.type_desc* %t1, i32 0, i32 1 - %tmp1 = load i32* %size, align 4, !tbaa !0 - %size3 = getelementptr inbounds %struct.type_desc* %t2, i32 0, i32 1 - %tmp4 = load i32* %size3, align 4, !tbaa !0 - %cmp = icmp eq i32 %tmp1, %tmp4 - br i1 %cmp, label %if.end, label %if.then - -if.then: ; preds = %entry - tail call void @upcall_fail(%struct.rust_task* %task, i8* getelementptr inbounds ([42 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8]* @.str1, i32 0, i32 0), i32 45) - br label %return - -if.end: ; preds = %entry - tail call void @llvm.memmove.p0i8.p0i8.i32(i8* %retptr, i8* %src, i32 %tmp1, i32 1, i1 false) - br label %return - -return: ; preds = %if.end, %if.then - ret void -} - -declare void @upcall_fail(%struct.rust_task*, i8*, i8*, i32) - -declare void @llvm.memmove.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind - -define linkonce_odr void @rust_intrinsic_addr_of(%struct.rust_task* nocapture %task, i8** nocapture %retptr, %struct.type_desc* nocapture %ty, i8* %valptr) nounwind { -entry: - store i8* %valptr, i8** %retptr, align 4, !tbaa !3 - ret void -} - -define linkonce_odr void @rust_intrinsic_recv(%struct.rust_task* %task, i8** nocapture %retptr, %struct.type_desc* nocapture %ty, %class.rust_port* %port) { -entry: - %tmp2 = load i8** %retptr, align 4, !tbaa !3 - %0 = bitcast i8* %tmp2 to i32* - tail call void @port_recv(%struct.rust_task* %task, i32* %0, %class.rust_port* %port) - ret void -} - -declare void @port_recv(%struct.rust_task*, i32*, %class.rust_port*) - -!0 = metadata !{metadata !"long", metadata !1} -!1 = metadata !{metadata !"omnipotent char", metadata !2} -!2 = metadata !{metadata !"Simple C/C++ TBAA", null} -!3 = metadata !{metadata !"any pointer", metadata !1} diff --git a/src/rt/intrinsics/intrinsics.x86_64.ll.in b/src/rt/intrinsics/intrinsics.x86_64.ll.in deleted file mode 100644 index d18c1f7c9e4..00000000000 --- a/src/rt/intrinsics/intrinsics.x86_64.ll.in +++ /dev/null @@ -1,237 +0,0 @@ -; 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" -target triple = "@CFG_TARGET_TRIPLE@" - -%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.__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 } -%"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 } -%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] } -%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 { - %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 { - %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 { - %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 { - 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) { - %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 { - %ty.c = bitcast %struct.type_desc* %ty to i8* - 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) { - 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 { - %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 { - %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 readnone { - ret void -} - -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 - -; <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 = %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 - -; <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 - -.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 - -.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) { - tail call void @upcall_intrinsic_vec_push(%struct.rust_vec** %vp, %struct.type_desc* %elt_ty, i8* %elt) - ret void -} - -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 -} - -declare i8* @llvm.frameaddress(i32) nounwind readnone - -declare i8* @upcall_shared_realloc(i8*, i64) |
