-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ee66611
commit 7884bb6
Showing
14 changed files
with
1,296 additions
and
155 deletions.
There are no files selected for viewing
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
; ModuleID = 'llvm_byte_code/test/record_esc.tig.ll' | ||
source_filename = "Tiger jit" | ||
|
||
define i32 @main() local_unnamed_addr { | ||
entry: | ||
%frame_pointer = alloca { i32, { i32, i8* }* } | ||
%root = getelementptr { i32, { i32, i8* }* }, { i32, { i32, i8* }* }* %frame_pointer, i32 0, i32 1 | ||
store { i32, i8* }* null, { i32, i8* }** %root | ||
ret i32 0 | ||
} | ||
|
||
define void @f({ i32, { i32, i8* }* }*) local_unnamed_addr { | ||
entry: | ||
%frame_pointer = alloca { { i32, { i32, i8* }* }* } | ||
%arg_address = getelementptr { { i32, { i32, i8* }* }* }, { { i32, { i32, i8* }* }* }* %frame_pointer, i32 0, i32 0 | ||
store { i32, { i32, i8* }* }* %0, { i32, { i32, i8* }* }** %arg_address | ||
%malloccall = tail call i8* @malloc(i32 ptrtoint ({ i32, i8* }* getelementptr ({ i32, i8* }, { i32, i8* }* null, i32 1) to i32)) | ||
%record_init = bitcast i8* %malloccall to { i32, i8* }* | ||
%Element = getelementptr { i32, i8* }, { i32, i8* }* %record_init, i32 0, i32 0 | ||
store i32 5, i32* %Element | ||
%Element2 = getelementptr { i32, i8* }, { i32, i8* }* %record_init, i32 0, i32 1 | ||
store i8* null, i8** %Element2 | ||
ret void | ||
} | ||
|
||
declare noalias i8* @malloc(i32) local_unnamed_addr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
.text | ||
.file "Tiger jit" | ||
.globl main # -- Begin function main | ||
.p2align 4, 0x90 | ||
.type main,@function | ||
main: # @main | ||
.cfi_startproc | ||
# %bb.0: # %entry | ||
movq $0, -8(%rsp) | ||
xorl %eax, %eax | ||
retq | ||
.Lfunc_end0: | ||
.size main, .Lfunc_end0-main | ||
.cfi_endproc | ||
# -- End function | ||
.globl f # -- Begin function f | ||
.p2align 4, 0x90 | ||
.type f,@function | ||
f: # @f | ||
.cfi_startproc | ||
# %bb.0: # %entry | ||
pushq %rax | ||
.cfi_def_cfa_offset 16 | ||
movq %rdi, (%rsp) | ||
movl $16, %edi | ||
callq malloc | ||
movl $5, (%rax) | ||
movq $0, 8(%rax) | ||
popq %rax | ||
retq | ||
.Lfunc_end1: | ||
.size f, .Lfunc_end1-f | ||
.cfi_endproc | ||
# -- End function | ||
|
||
.section ".note.GNU-stack","",@progbits |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
; ModuleID = 'Tiger jit' | ||
source_filename = "Tiger jit" | ||
|
||
declare void @tig_print_int(i32) | ||
|
||
declare void @tig_print(i8*) | ||
|
||
declare void @print_arr_int_ele(i32) | ||
|
||
declare i32* @tig_init_array(i32, i32) | ||
|
||
declare i32* @tig_init_record(i32) | ||
|
||
declare i32 @tig_array_length(i8*) | ||
|
||
declare i32 @tig_nillable(i8*) | ||
|
||
declare void @tig_check_array_bound(i8*, i32, i8*) | ||
|
||
declare void @tig_check_null_pointer(i8*, i8*) | ||
|
||
declare i32 @tig_random(i32) | ||
|
||
declare void @tig_exit(i32) | ||
|
||
declare void @tig_flush() | ||
|
||
declare i8* @tig_getchar() | ||
|
||
declare i32 @tig_ord(i8*) | ||
|
||
declare i8* @tig_chr(i32) | ||
|
||
declare i32 @tig_string_cmp(i8*, i8*) | ||
|
||
declare i32 @tig_size(i8*) | ||
|
||
declare i8* @tig_substring(i8*, i32, i32) | ||
|
||
declare i8* @tig_concat(i8*, i8*) | ||
|
||
declare i32 @tig_not(i32) | ||
|
||
declare void @assert_equal_int(i32, i32) | ||
|
||
declare void @assert_equal_string(i8*, i8*) | ||
|
||
define i32 @main() { | ||
entry: | ||
%frame_pointer = alloca { i32, { i32, i8* }* } | ||
%root = getelementptr { i32, { i32, i8* }* }, { i32, { i32, i8* }* }* %frame_pointer, i32 0, i32 1 | ||
store { i32, i8* }* null, { i32, i8* }** %root | ||
ret i32 0 | ||
|
||
break_loop: ; No predecessors! | ||
ret i32 0 | ||
} | ||
|
||
define void @f({ i32, { i32, i8* }* }*) { | ||
entry: | ||
%frame_pointer = alloca { { i32, { i32, i8* }* }* } | ||
%arg_address = getelementptr { { i32, { i32, i8* }* }* }, { { i32, { i32, i8* }* }* }* %frame_pointer, i32 0, i32 0 | ||
store { i32, { i32, i8* }* }* %0, { i32, { i32, i8* }* }** %arg_address | ||
%fp_addr_in_sl = getelementptr { { i32, { i32, i8* }* }* }, { { i32, { i32, i8* }* }* }* %frame_pointer, i32 0, i32 0 | ||
%fp_addr = load { i32, { i32, i8* }* }*, { i32, { i32, i8* }* }** %fp_addr_in_sl | ||
%root = getelementptr { i32, { i32, i8* }* }, { i32, { i32, i8* }* }* %fp_addr, i32 0, i32 1 | ||
%root1 = load { i32, i8* }*, { i32, i8* }** %root | ||
%malloccall = tail call i8* @malloc(i32 ptrtoint ({ i32, i8* }* getelementptr ({ i32, i8* }, { i32, i8* }* null, i32 1) to i32)) | ||
%record_init = bitcast i8* %malloccall to { i32, i8* }* | ||
%Element = getelementptr { i32, i8* }, { i32, i8* }* %record_init, i32 0, i32 0 | ||
store i32 5, i32* %Element | ||
%Element2 = getelementptr { i32, i8* }, { i32, i8* }* %record_init, i32 0, i32 1 | ||
store i8* null, i8** %Element2 | ||
ret void | ||
} | ||
|
||
declare noalias i8* @malloc(i32) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
; ModuleID = 'llvm_byte_code/test/record_nil_esc.tig.ll' | ||
source_filename = "Tiger jit" | ||
|
||
@0 = private unnamed_addr constant [54 x i8] c"test/record_nil_esc.tig::8.19: Nil pointer exception!\00" | ||
|
||
declare i32 @tig_nillable(i8*) local_unnamed_addr | ||
|
||
declare void @tig_check_null_pointer(i8*, i8*) local_unnamed_addr | ||
|
||
declare void @assert_equal_int(i32, i32) local_unnamed_addr | ||
|
||
define i32 @main() local_unnamed_addr { | ||
entry: | ||
%frame_pointer = alloca { i32, { i32, i8* }* } | ||
%root = getelementptr { i32, { i32, i8* }* }, { i32, { i32, i8* }* }* %frame_pointer, i32 0, i32 1 | ||
store { i32, i8* }* null, { i32, i8* }** %root | ||
%root1 = getelementptr { i32, { i32, i8* }* }, { i32, { i32, i8* }* }* %frame_pointer, i32 0, i32 1 | ||
%root2 = load { i32, i8* }*, { i32, i8* }** %root1 | ||
%0 = bitcast { i32, i8* }* %root2 to i8* | ||
%1 = call i32 @tig_nillable(i8* %0) | ||
call void @assert_equal_int(i32 %1, i32 1) | ||
call void @f({ i32, { i32, i8* }* }* %frame_pointer) | ||
%root3 = getelementptr { i32, { i32, i8* }* }, { i32, { i32, i8* }* }* %frame_pointer, i32 0, i32 1 | ||
%root4 = load { i32, i8* }*, { i32, i8* }** %root3 | ||
%2 = bitcast { i32, i8* }* %root4 to i8* | ||
call void @tig_check_null_pointer(i8* %2, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @0, i32 0, i32 0)) | ||
%element = getelementptr { i32, i8* }, { i32, i8* }* %root4, i32 0, i32 0 | ||
%field_var = load i32, i32* %element | ||
call void @assert_equal_int(i32 %field_var, i32 5) | ||
ret i32 0 | ||
} | ||
|
||
define void @f({ i32, { i32, i8* }* }*) local_unnamed_addr { | ||
entry: | ||
%frame_pointer = alloca { { i32, { i32, i8* }* }* } | ||
%arg_address = getelementptr { { i32, { i32, i8* }* }* }, { { i32, { i32, i8* }* }* }* %frame_pointer, i32 0, i32 0 | ||
store { i32, { i32, i8* }* }* %0, { i32, { i32, i8* }* }** %arg_address | ||
%fp_addr_in_sl = getelementptr { { i32, { i32, i8* }* }* }, { { i32, { i32, i8* }* }* }* %frame_pointer, i32 0, i32 0 | ||
%fp_addr = load { i32, { i32, i8* }* }*, { i32, { i32, i8* }* }** %fp_addr_in_sl | ||
%root = getelementptr { i32, { i32, i8* }* }, { i32, { i32, i8* }* }* %fp_addr, i32 0, i32 1 | ||
%malloccall = tail call i8* @malloc(i32 ptrtoint ({ i32, i8* }* getelementptr ({ i32, i8* }, { i32, i8* }* null, i32 1) to i32)) | ||
%record_init = bitcast i8* %malloccall to { i32, i8* }* | ||
%Element = getelementptr { i32, i8* }, { i32, i8* }* %record_init, i32 0, i32 0 | ||
store i32 5, i32* %Element | ||
%Element1 = getelementptr { i32, i8* }, { i32, i8* }* %record_init, i32 0, i32 1 | ||
store i8* null, i8** %Element1 | ||
store { i32, i8* }* %record_init, { i32, i8* }** %root | ||
ret void | ||
} | ||
|
||
declare noalias i8* @malloc(i32) local_unnamed_addr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
.text | ||
.file "Tiger jit" | ||
.globl main # -- Begin function main | ||
.p2align 4, 0x90 | ||
.type main,@function | ||
main: # @main | ||
.cfi_startproc | ||
# %bb.0: # %entry | ||
pushq %rbx | ||
.cfi_def_cfa_offset 16 | ||
subq $16, %rsp | ||
.cfi_def_cfa_offset 32 | ||
.cfi_offset %rbx, -16 | ||
movq $0, 8(%rsp) | ||
xorl %edi, %edi | ||
callq tig_nillable | ||
movl $1, %esi | ||
movl %eax, %edi | ||
callq assert_equal_int | ||
movq %rsp, %rdi | ||
callq f | ||
movq 8(%rsp), %rbx | ||
movl $.L__unnamed_1, %esi | ||
movq %rbx, %rdi | ||
callq tig_check_null_pointer | ||
movl (%rbx), %edi | ||
movl $5, %esi | ||
callq assert_equal_int | ||
xorl %eax, %eax | ||
addq $16, %rsp | ||
popq %rbx | ||
retq | ||
.Lfunc_end0: | ||
.size main, .Lfunc_end0-main | ||
.cfi_endproc | ||
# -- End function | ||
.globl f # -- Begin function f | ||
.p2align 4, 0x90 | ||
.type f,@function | ||
f: # @f | ||
.cfi_startproc | ||
# %bb.0: # %entry | ||
pushq %rbx | ||
.cfi_def_cfa_offset 16 | ||
subq $16, %rsp | ||
.cfi_def_cfa_offset 32 | ||
.cfi_offset %rbx, -16 | ||
movq %rdi, %rbx | ||
movq %rbx, 8(%rsp) | ||
movl $16, %edi | ||
callq malloc | ||
movl $5, (%rax) | ||
movq $0, 8(%rax) | ||
movq %rax, 8(%rbx) | ||
addq $16, %rsp | ||
popq %rbx | ||
retq | ||
.Lfunc_end1: | ||
.size f, .Lfunc_end1-f | ||
.cfi_endproc | ||
# -- End function | ||
.type .L__unnamed_1,@object # @0 | ||
.section .rodata.str1.16,"aMS",@progbits,1 | ||
.p2align 4 | ||
.L__unnamed_1: | ||
.asciz "test/record_nil_esc.tig::8.19: Nil pointer exception!" | ||
.size .L__unnamed_1, 54 | ||
|
||
|
||
.section ".note.GNU-stack","",@progbits |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
; ModuleID = 'Tiger jit' | ||
source_filename = "Tiger jit" | ||
|
||
@0 = private unnamed_addr constant [54 x i8] c"test/record_nil_esc.tig::8.19: Nil pointer exception!\00" | ||
|
||
declare void @tig_print_int(i32) | ||
|
||
declare void @tig_print(i8*) | ||
|
||
declare void @print_arr_int_ele(i32) | ||
|
||
declare i32* @tig_init_array(i32, i32) | ||
|
||
declare i32* @tig_init_record(i32) | ||
|
||
declare i32 @tig_array_length(i8*) | ||
|
||
declare i32 @tig_nillable(i8*) | ||
|
||
declare void @tig_check_array_bound(i8*, i32, i8*) | ||
|
||
declare void @tig_check_null_pointer(i8*, i8*) | ||
|
||
declare i32 @tig_random(i32) | ||
|
||
declare void @tig_exit(i32) | ||
|
||
declare void @tig_flush() | ||
|
||
declare i8* @tig_getchar() | ||
|
||
declare i32 @tig_ord(i8*) | ||
|
||
declare i8* @tig_chr(i32) | ||
|
||
declare i32 @tig_string_cmp(i8*, i8*) | ||
|
||
declare i32 @tig_size(i8*) | ||
|
||
declare i8* @tig_substring(i8*, i32, i32) | ||
|
||
declare i8* @tig_concat(i8*, i8*) | ||
|
||
declare i32 @tig_not(i32) | ||
|
||
declare void @assert_equal_int(i32, i32) | ||
|
||
declare void @assert_equal_string(i8*, i8*) | ||
|
||
define i32 @main() { | ||
entry: | ||
%frame_pointer = alloca { i32, { i32, i8* }* } | ||
%root = getelementptr { i32, { i32, i8* }* }, { i32, { i32, i8* }* }* %frame_pointer, i32 0, i32 1 | ||
store { i32, i8* }* null, { i32, i8* }** %root | ||
%root1 = getelementptr { i32, { i32, i8* }* }, { i32, { i32, i8* }* }* %frame_pointer, i32 0, i32 1 | ||
%root2 = load { i32, i8* }*, { i32, i8* }** %root1 | ||
%0 = bitcast { i32, i8* }* %root2 to i8* | ||
%1 = call i32 @tig_nillable(i8* %0) | ||
call void @assert_equal_int(i32 %1, i32 1) | ||
call void @f({ i32, { i32, i8* }* }* %frame_pointer) | ||
%root3 = getelementptr { i32, { i32, i8* }* }, { i32, { i32, i8* }* }* %frame_pointer, i32 0, i32 1 | ||
%root4 = load { i32, i8* }*, { i32, i8* }** %root3 | ||
%2 = bitcast { i32, i8* }* %root4 to i8* | ||
call void @tig_check_null_pointer(i8* %2, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @0, i32 0, i32 0)) | ||
%element = getelementptr { i32, i8* }, { i32, i8* }* %root4, i32 0, i32 0 | ||
%field_var = load i32, i32* %element | ||
call void @assert_equal_int(i32 %field_var, i32 5) | ||
ret i32 0 | ||
|
||
break_loop: ; No predecessors! | ||
ret i32 0 | ||
} | ||
|
||
define void @f({ i32, { i32, i8* }* }*) { | ||
entry: | ||
%frame_pointer = alloca { { i32, { i32, i8* }* }* } | ||
%arg_address = getelementptr { { i32, { i32, i8* }* }* }, { { i32, { i32, i8* }* }* }* %frame_pointer, i32 0, i32 0 | ||
store { i32, { i32, i8* }* }* %0, { i32, { i32, i8* }* }** %arg_address | ||
%fp_addr_in_sl = getelementptr { { i32, { i32, i8* }* }* }, { { i32, { i32, i8* }* }* }* %frame_pointer, i32 0, i32 0 | ||
%fp_addr = load { i32, { i32, i8* }* }*, { i32, { i32, i8* }* }** %fp_addr_in_sl | ||
%root = getelementptr { i32, { i32, i8* }* }, { i32, { i32, i8* }* }* %fp_addr, i32 0, i32 1 | ||
%malloccall = tail call i8* @malloc(i32 ptrtoint ({ i32, i8* }* getelementptr ({ i32, i8* }, { i32, i8* }* null, i32 1) to i32)) | ||
%record_init = bitcast i8* %malloccall to { i32, i8* }* | ||
%Element = getelementptr { i32, i8* }, { i32, i8* }* %record_init, i32 0, i32 0 | ||
store i32 5, i32* %Element | ||
%Element1 = getelementptr { i32, i8* }, { i32, i8* }* %record_init, i32 0, i32 1 | ||
store i8* null, i8** %Element1 | ||
store { i32, i8* }* %record_init, { i32, i8* }** %root | ||
ret void | ||
} | ||
|
||
declare noalias i8* @malloc(i32) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.