-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit uses the previously-compiled LLVM IR representations of the rust `core`, `alloc` and `compiler_builtins` libraries to test the functionality of the hieratika compiler. At the same time it fixes any bugs that are found through this process. It also enables the compiler to consistency check the target definition in the file being compiled against the expected target definition, ensuring that it does not do unnecessary work on unsupported inputs. It also implements functionality for working with constants of aggregate type, thereby closing #91.
- Loading branch information
1 parent
f43fcda
commit e6a87dd
Showing
26 changed files
with
647 additions
and
262 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
; ModuleID = 'opcodes.ll' | ||
source_filename = "opcodes.ll" | ||
target datalayout = "E-m:e-p:64:64-i64:64-i128:128-n32:64-S128" | ||
target triple = "riscv64" | ||
|
||
define i64 @hieratika_test_add(i64 %left, i64 %right) unnamed_addr { | ||
start: | ||
%0 = add nuw nsw i64 %left, %right | ||
ret i64 %0 | ||
} |
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,10 @@ | ||
; ModuleID = 'opcodes.ll' | ||
source_filename = "opcodes.ll" | ||
target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128" | ||
target triple = "aarch64" | ||
|
||
define i64 @hieratika_test_add(i64 %left, i64 %right) unnamed_addr { | ||
start: | ||
%0 = add nuw nsw i64 %left, %right | ||
ret i64 %0 | ||
} |
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,55 @@ | ||
target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128" | ||
target triple = "riscv64" | ||
|
||
@test_const = constant { i1, [9 x i8] } { i1 0, [9 x i8] c"hieratika" } | ||
|
||
; @constant_pointer_const = constant ptr @test_const | ||
; @constant_pointer_const_in_struct = constant { i1, ptr } { i1 0, ptr @test_const } | ||
|
||
; @function_pointer_const = constant ptr @hieratika_test_const_integer | ||
; @function_pointer_const_in_struct = constant { i1, ptr } { i1 0, ptr @hieratika_test_const_integer } | ||
|
||
define ptr @hieratika_test_reference_const() unnamed_addr { | ||
start: | ||
ret ptr @test_const | ||
} | ||
|
||
define i64 @hieratika_test_const_integer() unnamed_addr { | ||
start: | ||
ret i64 0 | ||
} | ||
|
||
define double @hieratika_test_const_float() unnamed_addr { | ||
start: | ||
ret double 0.0 | ||
} | ||
|
||
define void @hieratika_test_const_pointer() unnamed_addr { | ||
start: | ||
%addr = alloca ptr | ||
store ptr blockaddress(@hieratika_test_const_pointer, %bb1), ptr %addr | ||
ret void | ||
bb1: | ||
unreachable | ||
} | ||
|
||
define void @hieratika_test_const_array() unnamed_addr { | ||
start: | ||
%ptr = alloca ptr | ||
store [2 x i8] [i8 0, i8 1], ptr %ptr | ||
ret void | ||
} | ||
|
||
define void @hieratika_test_const_string() unnamed_addr { | ||
start: | ||
%ptr = alloca ptr | ||
store [9 x i8] c"hieratika", ptr %ptr | ||
ret void | ||
} | ||
|
||
define void @hieratika_test_const_struct() unnamed_addr { | ||
start: | ||
%ptr = alloca ptr | ||
store { i8, i1 } { i8 0, i1 1 }, ptr %ptr | ||
ret void | ||
} |
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
Oops, something went wrong.