Skip to content

Commit

Permalink
fixup! use separate names for internal and exported functions
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash committed Sep 16, 2021
1 parent 1fcaa95 commit 3a02a12
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/ccall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1281,9 +1281,9 @@ static jl_cgval_t emit_ccall(jl_codectx_t &ctx, jl_value_t **args, size_t nargs)
return false;
#endif
}
return f_name && (f_name == name || (name[0] == 'i' && f_name == name.drop_front()));
return f_name && f_name == name;
};
#define is_libjulia_func(name) _is_libjulia_func((uintptr_t)&(name), StringRef(XSTR(#name)))
#define is_libjulia_func(name) _is_libjulia_func((uintptr_t)&(name), StringRef(#name))

// emit arguments
jl_cgval_t *argv = (jl_cgval_t*)alloca(sizeof(jl_cgval_t) * nccallargs);
Expand Down
10 changes: 5 additions & 5 deletions test/llvmpasses/alloc-opt-gcframe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"

# CHECK-LABEL: @return_obj
# CHECK-NOT: @julia.gc_alloc_obj
# CHECK: %v = call noalias nonnull {} addrspace(10)* @jl_gc_pool_alloc
# CHECK: %v = call noalias nonnull {} addrspace(10)* @ijl_gc_pool_alloc
# CHECK: store atomic {} addrspace(10)* @tag, {} addrspace(10)* addrspace(10)* {{.*}} unordered, align 8, !tbaa !0
println("""
define {} addrspace(10)* @return_obj() {
Expand Down Expand Up @@ -52,7 +52,7 @@ define i64 @return_load(i64 %i) {
# CHECK: call {}*** @julia.get_pgcstack()
# CHECK: call {}*** @julia.ptls_states()
# CHECK-NOT: @julia.gc_alloc_obj
# CHECK: @jl_gc_pool_alloc
# CHECK: @ijl_gc_pool_alloc
# CHECK: store atomic {} addrspace(10)* @tag, {} addrspace(10)* addrspace(10)* {{.*}} unordered, align 8, !tbaa !0
println("""
define void @ccall_obj(i8* %fptr) {
Expand Down Expand Up @@ -98,7 +98,7 @@ define void @ccall_ptr(i8* %fptr) {
# CHECK: call {}*** @julia.get_pgcstack()
# CHECK: call {}*** @julia.ptls_states()
# CHECK-NOT: @julia.gc_alloc_obj
# CHECK: @jl_gc_pool_alloc
# CHECK: @ijl_gc_pool_alloc
# CHECK: store atomic {} addrspace(10)* @tag, {} addrspace(10)* addrspace(10)* {{.*}} unordered, align 8, !tbaa !0
println("""
define void @ccall_unknown_bundle(i8* %fptr) {
Expand Down Expand Up @@ -262,8 +262,8 @@ L3:
""")
# CHECK-LABEL: }{{$}}

# CHECK: declare noalias nonnull {} addrspace(10)* @jl_gc_pool_alloc(i8*,
# CHECK: declare noalias nonnull {} addrspace(10)* @jl_gc_big_alloc(i8*,
# CHECK: declare noalias nonnull {} addrspace(10)* @ijl_gc_pool_alloc(i8*,
# CHECK: declare noalias nonnull {} addrspace(10)* @ijl_gc_big_alloc(i8*,
println("""
declare void @external_function()
declare {}*** @julia.ptls_states()
Expand Down
10 changes: 4 additions & 6 deletions test/llvmpasses/final-lower-gc.ll
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
@tag = external addrspace(10) global {}

declare void @boxed_simple({} addrspace(10)*, {} addrspace(10)*)
declare {} addrspace(10)* @jl_box_int64(i64)
declare {} addrspace(10)* @ijl_box_int64(i64)
declare {}*** @julia.ptls_states()
declare {}*** @julia.get_pgcstack()
declare void @jl_safepoint()
declare {} addrspace(10)* @jl_apply_generic({} addrspace(10)*, {} addrspace(10)**, i32)

declare noalias nonnull {} addrspace(10)** @julia.new_gc_frame(i32)
declare void @julia.push_gc_frame({} addrspace(10)**, i32)
Expand All @@ -34,11 +32,11 @@ top:
; CHECK-DAG: [[GCFRAME_SLOT2:%.*]] = bitcast {}*** [[GCFRAME_SLOT]] to {} addrspace(10)***
; CHECK-NEXT: store {} addrspace(10)** %gcframe, {} addrspace(10)*** [[GCFRAME_SLOT2]], align 8
call void @julia.push_gc_frame({} addrspace(10)** %gcframe, i32 2)
%aboxed = call {} addrspace(10)* @jl_box_int64(i64 signext %a)
%aboxed = call {} addrspace(10)* @ijl_box_int64(i64 signext %a)
; CHECK: %frame_slot_1 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 3
%frame_slot_1 = call {} addrspace(10)** @julia.get_gc_frame_slot({} addrspace(10)** %gcframe, i32 1)
store {} addrspace(10)* %aboxed, {} addrspace(10)** %frame_slot_1, align 8
%bboxed = call {} addrspace(10)* @jl_box_int64(i64 signext %b)
%bboxed = call {} addrspace(10)* @ijl_box_int64(i64 signext %b)
; CHECK: %frame_slot_2 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)** %gcframe, i32 2
%frame_slot_2 = call {} addrspace(10)** @julia.get_gc_frame_slot({} addrspace(10)** %gcframe, i32 0)
store {} addrspace(10)* %bboxed, {} addrspace(10)** %frame_slot_2, align 8
Expand All @@ -59,7 +57,7 @@ top:
%pgcstack = call {}*** @julia.get_pgcstack()
%ptls = call {}*** @julia.ptls_states()
%ptls_i8 = bitcast {}*** %ptls to i8*
; CHECK: %v = call noalias nonnull {} addrspace(10)* @jl_gc_pool_alloc
; CHECK: %v = call noalias nonnull {} addrspace(10)* @ijl_gc_pool_alloc
%v = call {} addrspace(10)* @julia.gc_alloc_bytes(i8* %ptls_i8, i64 8)
%0 = bitcast {} addrspace(10)* %v to {} addrspace(10)* addrspace(10)*
%1 = getelementptr {} addrspace(10)*, {} addrspace(10)* addrspace(10)* %0, i64 -1
Expand Down
6 changes: 3 additions & 3 deletions test/llvmpasses/lower-handlers.ll
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

attributes #1 = { returns_twice }
declare i32 @julia.except_enter() #1
declare void @jl_pop_handler(i32)
declare void @ijl_pop_handler(i32)
declare i8**** @julia.ptls_states()
declare i8**** @julia.get_pgcstack()

define void @simple() {
top:
%pgcstack = call i8**** @julia.get_pgcstack()
; CHECK: call void @llvm.lifetime.start
; CHECK: call void @jl_enter_handler
; CHECK: call void @ijl_enter_handler
; CHECK: setjmp
%r = call i32 @julia.except_enter()
%cmp = icmp eq i32 %r, 0
Expand All @@ -20,7 +20,7 @@ try:
catch:
br label %after
after:
call void @jl_pop_handler(i32 1)
call void @ijl_pop_handler(i32 1)
; CHECK: llvm.lifetime.end
ret void
}
8 changes: 4 additions & 4 deletions test/llvmpasses/refinements.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ declare {}*** @julia.ptls_states()
declare {}*** @julia.get_pgcstack()
declare void @jl_safepoint()
declare void @one_arg_boxed({} addrspace(10)*)
declare {} addrspace(10)* @jl_box_int64(i64)
declare {} addrspace(10)* @ijl_box_int64(i64)

define void @argument_refinement({} addrspace(10)* %a) {
; CHECK-LABEL: @argument_refinement
Expand All @@ -26,7 +26,7 @@ define void @heap_refinement1(i64 %a) {
; CHECK: %gcframe = alloca {} addrspace(10)*, i32 3
%pgcstack = call {}*** @julia.get_pgcstack()
%ptls = call {}*** @julia.ptls_states()
%aboxed = call {} addrspace(10)* @jl_box_int64(i64 signext %a)
%aboxed = call {} addrspace(10)* @ijl_box_int64(i64 signext %a)
%casted1 = bitcast {} addrspace(10)* %aboxed to {} addrspace(10)* addrspace(10)*
%loaded1 = load {} addrspace(10)*, {} addrspace(10)* addrspace(10)* %casted1, !tbaa !1
; CHECK: store {} addrspace(10)* %aboxed
Expand All @@ -43,7 +43,7 @@ define void @heap_refinement2(i64 %a) {
; CHECK: %gcframe = alloca {} addrspace(10)*, i32 3
%pgcstack = call {}*** @julia.get_pgcstack()
%ptls = call {}*** @julia.ptls_states()
%aboxed = call {} addrspace(10)* @jl_box_int64(i64 signext %a)
%aboxed = call {} addrspace(10)* @ijl_box_int64(i64 signext %a)
%casted1 = bitcast {} addrspace(10)* %aboxed to {} addrspace(10)* addrspace(10)*
%loaded1 = load {} addrspace(10)*, {} addrspace(10)* addrspace(10)* %casted1, !tbaa !1
; CHECK: store {} addrspace(10)* %loaded1
Expand Down Expand Up @@ -211,7 +211,7 @@ declare void @julia.write_barrier({} addrspace(10)*, {} addrspace(10)*) #1
define {} addrspace(10)* @setfield({} addrspace(10)* %p) {
; CHECK-LABEL: @setfield(
; CHECK-NOT: %gcframe
; CHECK: call void @jl_gc_queue_root
; CHECK: call void @ijl_gc_queue_root
%pgcstack = call {}*** @julia.get_pgcstack()
%ptls = call {}*** @julia.ptls_states()
%c = call {} addrspace(10)* @allocate_some_value()
Expand Down

0 comments on commit 3a02a12

Please sign in to comment.