Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test case changes #256

Merged
merged 9 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading