Skip to content

Commit

Permalink
Merge pull request #256 from iu-parfunc/test-case-changes
Browse files Browse the repository at this point in the history
Test case changes
  • Loading branch information
0xtimmy authored Feb 21, 2024
2 parents 41d3b82 + 4330552 commit 65ab88c
Show file tree
Hide file tree
Showing 20 changed files with 4,245 additions and 24 deletions.
1 change: 1 addition & 0 deletions gibbon-compiler/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ demo/*.c
demo/*.exe
gibbon-compiler/examples/parallel/data/*.txt
*.log.hs
*.log
3 changes: 0 additions & 3 deletions gibbon-compiler/IR.log

This file was deleted.

20 changes: 20 additions & 0 deletions gibbon-compiler/examples/layout_bench/Basics.hs
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,8 @@ printID id = case id of

printBlog :: Blog -> ()
printBlog blog = case blog of
End -> let _ = printsym (quote "Fin")
in ()
Layout1 header id author date content tags rst -> let _ = printsym (quote "Layout1 ")
_ = printHeader header
_ = printID id
Expand All @@ -597,6 +599,24 @@ printBlog blog = case blog of
_ = printTagList tags
_ = printBlog rst
in ()
Layout2 content tags rst header id author date -> let _ = printsym (quote "Layout2 ")
_ = printHeader header
_ = printID id
_ = printAuthor author
_ = printDate date
_ = printContent content
_ = printTagList tags
_ = printBlog rst
in ()
Layout4 tags content rst header id author date -> let _ = printsym (quote "Layout4 ")
_ = printHeader header
_ = printID id
_ = printAuthor author
_ = printDate date
_ = printContent content
_ = printTagList tags
_ = printBlog rst
in ()



Expand Down
4,150 changes: 4,150 additions & 0 deletions gibbon-compiler/examples/layout_bench/ir.log

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
(Layout1 ->i (Header Vector) ->i (ID 8) ->i (Author Vector) ->i (Date Vector) (Content (Plain (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 (Emph (Cons_v_1062 ->i (Str Vector) (Nil_v_1062))) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->r ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 (Emph (Cons_v_1062 ->i (Str Vector) (Nil_v_1062))) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Nil_v_1062))))))))))))))))))))))))))))))))))))))))))))))))))))) ->i (TagList (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Nil_v_1063)))))))))))) (Layout1 ->i (Header Vector) ->i (ID 9) ->i (Author Vector) ->i (Date Vector) (Content (Plain (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 (Emph (Cons_v_1062 ->i (Str Vector) (Nil_v_1062))) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Nil_v_1062))))))))))))))))))))))))))))))))))))))))))))))))))))) ->i (TagList (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Nil_v_1063)))))))))))) (End)))'#()
(Layout1160 ->i (Header173 Vector) ->i (ID172 8) ->i (Author171 Vector) ->i (Date170 Vector) (Content169 (Plain174 (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 (Emph177 (Cons94_v1221 ->i (Str176 Vector) (Nil93_v1221))) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->r ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 (Emph177 (Cons94_v1221 ->i (Str176 Vector) (Nil93_v1221))) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Nil93_v1221))))))))))))))))))))))))))))))))))))))))))))))))))))) ->i (TagList168 (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Nil93_v1222)))))))))))) (Layout1160 ->i (Header173 Vector) ->i (ID172 9) ->i (Author171 Vector) ->i (Date170 Vector) (Content169 (Plain174 (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 (Emph177 (Cons94_v1221 ->i (Str176 Vector) (Nil93_v1221))) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Nil93_v1221))))))))))))))))))))))))))))))))))))))))))))))))))))) ->i (TagList168 (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Nil93_v1222)))))))))))) (End159)))'#()
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ gibbon_main =
keyword :: Vector Char
keyword = "a"
newblgs = emphKeywordInContent keyword blogs
in printPacked newblgs
in printBlog newblgs
40 changes: 39 additions & 1 deletion gibbon-compiler/examples/layout_bench/manyFuncs.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ emphKeywordInContent keyword blogs =
Content block -> Content (emphasizeKeywordInBlock keyword block)
newRst = emphKeywordInContent keyword rst
in Layout1 header id author date newContent tags newRst
Layout2 content tags rst header id author date -> let newContent = case content of
Content block -> Content (emphasizeKeywordInBlock keyword block)
newRst = emphKeywordInContent keyword rst
in Layout2 content tags newRst header id author date
Layout4 tags content rst header id author date -> let newContent = case content of
Content block -> Content (emphasizeKeywordInBlock keyword block)
newRst = emphKeywordInContent keyword rst
in Layout4 tags content newRst header id author date



Expand All @@ -23,6 +31,17 @@ filterByKeywordInTagList keyword blogs = case blogs of
let newRst = filterByKeywordInTagList keyword rst
in Layout4 tags content newRst header id author date
else filterByKeywordInTagList keyword rst
Layout2 content tags rst header id author date -> let present = searchBlogTags keyword tags
in if present then
let newRst = filterByKeywordInTagList keyword rst
in Layout4 tags content newRst header id author date
else filterByKeywordInTagList keyword rst
Layout4 tags content rst header id author date -> let present = searchBlogTags keyword tags
in if present then
let newRst = filterByKeywordInTagList keyword rst
in Layout4 tags content newRst header id author date
else filterByKeywordInTagList keyword rst



emphKeywordInTag :: Text -> Blog -> Blog
Expand All @@ -37,6 +56,25 @@ emphKeywordInTag keyword blogs = case blogs of
else
let newRst = emphKeywordInTag keyword rst
in Layout1 header id author date content tags newRst
Layout2 content tags rst header id author date -> let present = searchBlogTags keyword tags
in if (present)
then let newContent = case content of
Content block -> Content (emphasizeKeywordInBlock keyword block)
newRst = emphKeywordInTag keyword rst
in Layout2 content tags newRst header id author date
else
let newRst = emphKeywordInTag keyword rst
in Layout2 content tags newRst header id author date
Layout4 tags content rst header id author date -> let present = searchBlogTags keyword tags
in if (present)
then let newContent = case content of
Content block -> Content (emphasizeKeywordInBlock keyword block)
newRst = emphKeywordInTag keyword rst
in Layout4 tags content newRst header id author date
else
let newRst = emphKeywordInTag keyword rst
in Layout4 tags content newRst header id author date



-- main function
Expand All @@ -47,4 +85,4 @@ gibbon_main =
newblgs = emphKeywordInContent keyword blogs
newblgs' = emphKeywordInTag keyword newblgs
newblgs'' = filterByKeywordInTagList keyword newblgs'
in printPacked newblgs''
in printBlog newblgs''
Loading

0 comments on commit 65ab88c

Please sign in to comment.