-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
29e3b79
commit 7298dfa
Showing
70 changed files
with
1,061 additions
and
1,137 deletions.
There are no files selected for viewing
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
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
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
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
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
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 |
---|---|---|
@@ -1,49 +1,49 @@ | ||
--- | ||
source: crates/mun_codegen/src/test.rs | ||
expression: "pub fn fibonacci(n:int) -> int {\n if n <= 1 {\n n\n } else {\n fibonacci(n-1) + fibonacci(n-2)\n }\n}" | ||
expression: "pub fn fibonacci(n:i32) -> i32 {\n if n <= 1 {\n n\n } else {\n fibonacci(n-1) + fibonacci(n-2)\n }\n}" | ||
--- | ||
; == FILE IR ===================================== | ||
; ModuleID = 'main.mun' | ||
source_filename = "main.mun" | ||
|
||
%DispatchTable = type { i64 (i64)* } | ||
%DispatchTable = type { i32 (i32)* } | ||
%struct.MunTypeInfo = type { [16 x i8], i8 addrspace(4)*, i32, i8, i8 } | ||
|
||
@dispatchTable = external global %DispatchTable | ||
@global_type_table = external global [1 x %struct.MunTypeInfo addrspace(4)*] | ||
|
||
define i64 @fibonacci(i64) { | ||
define i32 @fibonacci(i32) { | ||
body: | ||
%lesseq = icmp sle i64 %0, 1 | ||
%lesseq = icmp sle i32 %0, 1 | ||
br i1 %lesseq, label %if_merge, label %else | ||
|
||
else: ; preds = %body | ||
%sub = sub i64 %0, 1 | ||
%fibonacci_ptr = load i64 (i64)*, i64 (i64)** getelementptr inbounds (%DispatchTable, %DispatchTable* @dispatchTable, i32 0, i32 0) | ||
%fibonacci = call i64 %fibonacci_ptr(i64 %sub) | ||
%sub5 = sub i64 %0, 2 | ||
%fibonacci_ptr6 = load i64 (i64)*, i64 (i64)** getelementptr inbounds (%DispatchTable, %DispatchTable* @dispatchTable, i32 0, i32 0) | ||
%fibonacci7 = call i64 %fibonacci_ptr6(i64 %sub5) | ||
%add = add i64 %fibonacci, %fibonacci7 | ||
%sub = sub i32 %0, 1 | ||
%fibonacci_ptr = load i32 (i32)*, i32 (i32)** getelementptr inbounds (%DispatchTable, %DispatchTable* @dispatchTable, i32 0, i32 0) | ||
%fibonacci = call i32 %fibonacci_ptr(i32 %sub) | ||
%sub5 = sub i32 %0, 2 | ||
%fibonacci_ptr6 = load i32 (i32)*, i32 (i32)** getelementptr inbounds (%DispatchTable, %DispatchTable* @dispatchTable, i32 0, i32 0) | ||
%fibonacci7 = call i32 %fibonacci_ptr6(i32 %sub5) | ||
%add = add i32 %fibonacci, %fibonacci7 | ||
br label %if_merge | ||
|
||
if_merge: ; preds = %body, %else | ||
%iftmp = phi i64 [ %add, %else ], [ %0, %body ] | ||
ret i64 %iftmp | ||
%iftmp = phi i32 [ %add, %else ], [ %0, %body ] | ||
ret i32 %iftmp | ||
} | ||
|
||
|
||
; == GROUP IR ==================================== | ||
; ModuleID = 'group_name' | ||
source_filename = "group_name" | ||
|
||
%DispatchTable = type { i64 (i64)* } | ||
%DispatchTable = type { i32 (i32)* } | ||
%struct.MunTypeInfo = type { [16 x i8], i8 addrspace(4)*, i32, i8, i8 } | ||
|
||
@dispatchTable = global %DispatchTable { i64 (i64)* @fibonacci } | ||
@"type_info::<core::i64>::name" = private unnamed_addr constant [10 x i8] c"core::i64\00" | ||
@"type_info::<core::i64>" = private unnamed_addr constant %struct.MunTypeInfo { [16 x i8] c"G\13;t\97j8\18\D7M\83`\1D\C8\19%", [10 x i8]* @"type_info::<core::i64>::name", i32 64, i8 8, i8 0 } | ||
@global_type_table = global [1 x %struct.MunTypeInfo addrspace(4)*] [%struct.MunTypeInfo addrspace(4)* @"type_info::<core::i64>"] | ||
@dispatchTable = global %DispatchTable { i32 (i32)* @fibonacci } | ||
@"type_info::<core::i32>::name" = private unnamed_addr constant [10 x i8] c"core::i32\00" | ||
@"type_info::<core::i32>" = private unnamed_addr constant %struct.MunTypeInfo { [16 x i8] c"\17yzt\19\D62\17\D25\95C\17\88[\FA", [10 x i8]* @"type_info::<core::i32>::name", i32 32, i8 4, i8 0 } | ||
@global_type_table = global [1 x %struct.MunTypeInfo addrspace(4)*] [%struct.MunTypeInfo addrspace(4)* @"type_info::<core::i32>"] | ||
|
||
declare i64 @fibonacci(i64) | ||
declare i32 @fibonacci(i32) | ||
|
Oops, something went wrong.