Compiling CMM tests with LLVM

Erik de Castro Lopo mle+hs at mega-nerd.com
Sat Mar 18 22:06:09 UTC 2017


Erik de Castro Lopo wrote:

> Hi all,
> 
> I'm working on a minor change to CMM (#13442) and while writing the
> tests realized that the CMM tests were only run with `-fasm` and not
> with `-fllvm`. Furthermore other than running the test manually myself,
> I could not figure out how to make it compile with LLVM.
> 
> My test (in my WIP local branch) is:
> 
>     testsuite/tests/codeGen/should_compile/T13442.cmm
> 
> and I updated the `all.T` in that same directory with the line:
> 
>     test('T13442', [cmm_src], compile, ['-dcmm-lint'])
> 
> Anyone have any clues as to how to make this compile with LLVM if
> LLVM is available? I suspect it should probably be turned on for
> the vast majority of the CMM tests.

Ok, I added the following function to `testlib.py`:

    def cmm_src_llvm( name, opts ):
        opts.only_ways = ['optllvm', 'llvm', 'debugllvm']
        opts.cmm_src = 1;

and changed my test set up to:

     test('T13442', [cmm_src, cmm_src_llvm], compile, ['-dcmm-lint'])

Would still be interested to know if this is the correct way and
if there is a better way.

Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/


More information about the ghc-devs mailing list