-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Compiler test: check against user defined output filenames.
- Loading branch information
Showing
7 changed files
with
95 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,4 +26,5 @@ output/ | |
.grin-output/ | ||
.vscode/ | ||
*.out | ||
|
||
*.out.ll | ||
*.out.s |
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,3 +1,5 @@ | ||
outputExtension: "out" | ||
grinOptions: | ||
- "--quiet" | ||
- "--dpe" | ||
- "--save-grin=$$$OUT$$$" |
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,37 @@ | ||
grinMain = t1 <- store (CInt 1) | ||
t2 <- store (CInt 10000) | ||
t3 <- store (Fupto t1 t2) | ||
t4 <- store (Fsum t3) | ||
(CInt r') <- eval t4 | ||
_prim_int_print r' | ||
|
||
upto m n = (CInt m') <- eval m | ||
(CInt n') <- eval n | ||
b' <- _prim_int_gt m' n' | ||
if b' then | ||
pure (CNil) | ||
else | ||
m1' <- _prim_int_add m' 1 | ||
m1 <- store (CInt m1') | ||
p <- store (Fupto m1 n) | ||
pure (CCons m p) | ||
|
||
sum l = l2 <- eval l | ||
case l2 of | ||
(CNil) -> pure (CInt 0) | ||
(CCons x xs) -> (CInt x') <- eval x | ||
(CInt s') <- sum xs | ||
ax' <- _prim_int_add x' s' | ||
pure (CInt ax') | ||
|
||
eval q = v <- fetch q | ||
case v of | ||
(CInt x'1) -> pure (CInt x'1) | ||
(CNil) -> pure (CNil) | ||
(CCons y ys) -> pure (CCons y ys) | ||
(Fupto a b) -> w <- upto a b | ||
update q w | ||
pure w | ||
(Fsum c) -> z <- sum c | ||
update q z | ||
pure z |
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,24 @@ | ||
.text | ||
.file "<string>" | ||
.globl grinMain # -- Begin function grinMain | ||
.p2align 4, 0x90 | ||
.type grinMain,@function | ||
grinMain: # @grinMain | ||
.cfi_startproc | ||
# %bb.0: # %grinMain.entry | ||
movl $50005000, %edi # imm = 0x2FB0408 | ||
jmp _prim_int_print # TAILCALL | ||
.Lfunc_end0: | ||
.size grinMain, .Lfunc_end0-grinMain | ||
.cfi_endproc | ||
# -- End function | ||
.type _heap_ptr_,@object # @_heap_ptr_ | ||
.bss | ||
.globl _heap_ptr_ | ||
.p2align 3 | ||
_heap_ptr_: | ||
.quad 0 # 0x0 | ||
.size _heap_ptr_, 8 | ||
|
||
|
||
.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,6 @@ | ||
outputExtension: "out.s" | ||
grinOptions: | ||
- "--optimize" | ||
- "--hpt" | ||
- "--quiet" | ||
- "--save-llvm=$$$OUT$$$" |
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