Use HDoc for LLVM backend (#22455)
This MR is intended to complete some of the work from #22455 to use the more efficient HDoc
type for the LLVM backend. Currently it's lacking:
-
almost certainly doesn't meet the style guide -
SPECIALIZE pragmas should be moved under unction definitions(?)
-
-
Handling metadata is something I'm not happy about - with the current AST, it's possible to recursively have to append an arbitrary amount of metadata to any given statement (which includes comments and labels), which feels wrong. Personally I'd prefer to see the AST modified, perhaps using pattern synonyms, so that only statements that we need to append metadata to contain it. This MR collects up the metadata and achieves the same result.
As an aside, while testing I noticed that master
fails several tests when compiling using the LLVM backend, the common aspects seem to be the use of StaticPtr or call stacks:
Unexpected results from:
TEST="CgStaticPointers CgStaticPointersNoFullLazyness GcStaticPointers ListStaticPointers T12622 T18623 T367_letnoescape UnboxedTuples changelogs decodeMyStack decodeMyStack_underflowFrames staticcallstack001 staticcallstack002"
SUMMARY for test run started at Mon Jan 16 23:35:38 2023
0:33:46.401927 spent to go through
9232 total tests, which gave rise to
54652 test cases, of which
50177 were skipped
7 had missing libraries
4402 expected passes
52 expected failures
0 caused framework failures
0 caused framework warnings
0 unexpected passes
13 unexpected failures
0 unexpected stat failures
8 fragile tests
Unexpected failures:
/var/folders/s7/5wdsz_xn6zxdnzl3hm67b3mc0000gn/T/ghctest-5j0zld9z/test spaces/testsuite/tests/codeGen/should_run/CgStaticPointers.run CgStaticPointers [bad exit code (1)] (llvm)
/var/folders/s7/5wdsz_xn6zxdnzl3hm67b3mc0000gn/T/ghctest-5j0zld9z/test spaces/testsuite/tests/codeGen/should_run/CgStaticPointersNoFullLazyness.run CgStaticPointersNoFullLazyness [bad exit code (1)] (llvm)
/var/folders/s7/5wdsz_xn6zxdnzl3hm67b3mc0000gn/T/ghctest-5j0zld9z/test spaces/testsuite/tests/linters/changelogs.run changelogs [bad stdout] (llvm)
/var/folders/s7/5wdsz_xn6zxdnzl3hm67b3mc0000gn/T/ghctest-5j0zld9z/test spaces/testsuite/tests/rts/decodeMyStack.run decodeMyStack [bad stdout] (llvm)
/var/folders/s7/5wdsz_xn6zxdnzl3hm67b3mc0000gn/T/ghctest-5j0zld9z/test spaces/testsuite/tests/rts/decodeMyStack_underflowFrames.run decodeMyStack_underflowFrames [bad exit code (1)] (llvm)
/var/folders/s7/5wdsz_xn6zxdnzl3hm67b3mc0000gn/T/ghctest-5j0zld9z/test spaces/testsuite/tests/rts/GcStaticPointers.run GcStaticPointers [bad exit code (1)] (llvm)
/var/folders/s7/5wdsz_xn6zxdnzl3hm67b3mc0000gn/T/ghctest-5j0zld9z/test spaces/testsuite/tests/rts/ListStaticPointers.run ListStaticPointers [bad exit code (1)] (llvm)
/var/folders/s7/5wdsz_xn6zxdnzl3hm67b3mc0000gn/T/ghctest-5j0zld9z/test spaces/testsuite/tests/profiling/should_run/staticcallstack001.run staticcallstack001 [bad stdout] (llvm)
/var/folders/s7/5wdsz_xn6zxdnzl3hm67b3mc0000gn/T/ghctest-5j0zld9z/test spaces/testsuite/tests/profiling/should_run/staticcallstack002.run staticcallstack002 [bad stdout] (llvm)
/var/folders/s7/5wdsz_xn6zxdnzl3hm67b3mc0000gn/T/ghctest-5j0zld9z/test spaces/testsuite/tests/codeGen/should_run/T12622.run T12622 [bad exit code (1)] (llvm)
/var/folders/s7/5wdsz_xn6zxdnzl3hm67b3mc0000gn/T/ghctest-5j0zld9z/test spaces/testsuite/tests/rts/T18623/T18623.run T18623 [bad exit code (1)] (llvm)
/var/folders/s7/5wdsz_xn6zxdnzl3hm67b3mc0000gn/T/ghctest-5j0zld9z/test spaces/testsuite/tests/concurrent/should_run/T367_letnoescape.run T367_letnoescape [bad exit code (99): test timeout] (llvm)
/var/folders/s7/5wdsz_xn6zxdnzl3hm67b3mc0000gn/T/ghctest-5j0zld9z/test spaces/testsuite/tests/ghci/should_run/UnboxedTuples/UnboxedTuples.run UnboxedTuples [bad exit code (138)] (llvm)
Appending 0 stats to file: master-964284fcab6-summary.txt
user error (tests failed)
Build failed.
Please take a few moments to verify that your commits fulfill the following:
-
are either individually buildable or squashed -
have commit messages which describe what they do (referring to [Notes][notes] and tickets using #NNNN
syntax when appropriate) -
have added source comments describing your change. For larger changes you likely should add a [Note][notes] and cross-reference it from the relevant places. -
add a testcase to the testsuite. -
if your MR affects library interfaces (e.g. changes base
) or affects whether GHC will accept user-written code, please add the ~"user facing" label. -
updates the users guide if applicable -
mentions new features in the release notes for the next release