Magicloud Magiclouds | 12 Feb 17:41 2013
Picon

How to compile ghc 7.6.2 with llvm?

Hi,
  I am using Linuxmint Nadia with clang and llvm-3.0 installed.

  Then I `mv build.mk.sample build.mk`, set "BuildFlavour = perf-llvm", add "GhcWithLlvmCodeGen = YES". Finally `./configure --with-gcc=/usr/bin/llvm-gcc`. Configure output attached.

  After make, I tried `inplace/bin/ghc-stage2 –info`, it is still using native code generator. What should I do?​
--
竹密岂妨流水过
山高哪阻野云飞

And for G+, please use magiclouds#gmail.com.
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users <at> haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Magicloud Magiclouds | 12 Feb 17:48 2013
Picon

Re: How to compile ghc 7.6.2 with llvm?


On Wed, Feb 13, 2013 at 12:41 AM, Magicloud Magiclouds <magicloud.magiclouds <at> gmail.com> wrote:
./configure --with-gcc=/usr/bin/llvm-gcc

Sorry, I was wrong. with 'with-gcc' option, I got a ld error, which I will post later.
Without this option, I got native code generator result because the configure found gcc.
Should I or not using this option?

--
竹密岂妨流水过
山高哪阻野云飞

And for G+, please use magiclouds#gmail.com.
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users <at> haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
David Terei | 12 Feb 18:08 2013
Picon

Re: How to compile ghc 7.6.2 with llvm?

Hi Magicloud,

Setting build.mk to "BuildFlavour = perf-llvm" means that the GHC
built will be built using the LLVM backend of GHC.

For any build of GHC though, to *use* the LLVM backend of GHC you
simply want to compile with "-fllvm".

The output of inplace/bin/ghc-stage2 –info won't differ for a GHC
built with the native-code-generator compared to one built with the
LLVM code generator. Both build of GHC will include support for the
native-code-generator and the LLVM backends.

Cheers,
David

On 12 February 2013 08:48, Magicloud Magiclouds
<magicloud.magiclouds <at> gmail.com> wrote:
>
> On Wed, Feb 13, 2013 at 12:41 AM, Magicloud Magiclouds
> <magicloud.magiclouds <at> gmail.com> wrote:
>>
>> ./configure --with-gcc=/usr/bin/llvm-gcc
>
>
> Sorry, I was wrong. with 'with-gcc' option, I got a ld error, which I will
> post later.
> Without this option, I got native code generator result because the
> configure found gcc.
> Should I or not using this option?
>
> --
> 竹密岂妨流水过
> 山高哪阻野云飞
>
> And for G+, please use magiclouds#gmail.com.
>
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users <at> haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
>

_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users <at> haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Brandon Allbery | 12 Feb 18:09 2013
Picon

Re: How to compile ghc 7.6.2 with llvm?

On Tue, Feb 12, 2013 at 11:41 AM, Magicloud Magiclouds <magicloud.magiclouds <at> gmail.com> wrote:
  Then I `mv build.mk.sample build.mk`, set "BuildFlavour = perf-llvm", add "GhcWithLlvmCodeGen = YES". Finally `./configure --with-gcc=/usr/bin/llvm-gcc`. Configure output attached.

  After make, I tried `inplace/bin/ghc-stage2 –info`, it is still using native code generator. What should I do?​

1. I think --with-gcc= is independent of the llvm code generator.
2. Building the llvm codegen does not necessarily make it the *default* codegen; I think native remains default.  I don't know if there's a way to specify that llvm should be the default code generator.

fwiw, the ghc I have on here does not mention llvm in ghc --info, but ghc -fllvm at least tries to work.

--
brandon s allbery kf8nh                               sine nomine associates
allbery.b <at> gmail.com                                  ballbery <at> sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users <at> haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Magicloud Magiclouds | 12 Feb 19:13 2013
Picon

Re: How to compile ghc 7.6.2 with llvm?

Thank you for the replies. These are what I got, correct me if I am wrong:

If I want to build ghc executables and standard libraries, all I need is to set perf-llvm.
And set perf-llvm or not does not effect the ability of ghc to use llvm.

Then how to check if the output files (executables, libraries) are generated by llvm, instead of gcc? In other words, to see if llvm was used correct.


On Wed, Feb 13, 2013 at 1:09 AM, Brandon Allbery <allbery.b <at> gmail.com> wrote:
On Tue, Feb 12, 2013 at 11:41 AM, Magicloud Magiclouds <magicloud.magiclouds <at> gmail.com> wrote:
  Then I `mv build.mk.sample build.mk`, set "BuildFlavour = perf-llvm", add "GhcWithLlvmCodeGen = YES". Finally `./configure --with-gcc=/usr/bin/llvm-gcc`. Configure output attached.

  After make, I tried `inplace/bin/ghc-stage2 –info`, it is still using native code generator. What should I do?​

1. I think --with-gcc= is independent of the llvm code generator.
2. Building the llvm codegen does not necessarily make it the *default* codegen; I think native remains default.  I don't know if there's a way to specify that llvm should be the default code generator.

fwiw, the ghc I have on here does not mention llvm in ghc --info, but ghc -fllvm at least tries to work.

--
brandon s allbery kf8nh                               sine nomine associates
allbery.b <at> gmail.com                                  ballbery <at> sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net



--
竹密岂妨流水过
山高哪阻野云飞

And for G+, please use magiclouds#gmail.com.
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users <at> haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Brandon Allbery | 12 Feb 19:33 2013
Picon

Re: How to compile ghc 7.6.2 with llvm?

On Tue, Feb 12, 2013 at 1:13 PM, Magicloud Magiclouds <magicloud.magiclouds <at> gmail.com> wrote:
Then how to check if the output files (executables, libraries) are generated by llvm, instead of gcc? In other words, to see if llvm was used correct.

I doubt that there is a good way unless something involved with llvm stamps something distinctive into its object files.

--
brandon s allbery kf8nh                               sine nomine associates
allbery.b <at> gmail.com                                  ballbery <at> sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users <at> haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
David Terei | 13 Feb 00:39 2013
Picon

Re: How to compile ghc 7.6.2 with llvm?

Nothing straight forward to do this. You could do any of:

1) Look at the output of make a GHC is compiled. Verify that by and
large most lines have '-fllvm' on them.
2) As above but pipe output of building GHC to a file. Grep it later
for '-fllvm', you should get a very high count.
3) Add a "-v2" option to the build settings in build.mk, this will
give lots and lots of output, showing for example that the various
LLVM tools (llc, opt) are being called.
4) temporarily remove the llvm tools (opt, llc) from the command line
and verify that building GHC fails pretty quickly.

I'd say 2 is the best bet. However, if you chose "perf-llvm" as your
build setting and GHC built, you built GHC with LLVM.

Cheers,
David

On 12 February 2013 10:13, Magicloud Magiclouds
<magicloud.magiclouds <at> gmail.com> wrote:
> Thank you for the replies. These are what I got, correct me if I am wrong:
>
> If I want to build ghc executables and standard libraries, all I need is to
> set perf-llvm.
> And set perf-llvm or not does not effect the ability of ghc to use llvm.
>
> Then how to check if the output files (executables, libraries) are generated
> by llvm, instead of gcc? In other words, to see if llvm was used correct.
>
>
> On Wed, Feb 13, 2013 at 1:09 AM, Brandon Allbery <allbery.b <at> gmail.com>
> wrote:
>>
>> On Tue, Feb 12, 2013 at 11:41 AM, Magicloud Magiclouds
>> <magicloud.magiclouds <at> gmail.com> wrote:
>>>
>>>   Then I `mv build.mk.sample build.mk`, set "BuildFlavour = perf-llvm",
>>> add "GhcWithLlvmCodeGen = YES". Finally `./configure
>>> --with-gcc=/usr/bin/llvm-gcc`. Configure output attached.
>>>
>>>   After make, I tried `inplace/bin/ghc-stage2 –info`, it is still using
>>> native code generator. What should I do?
>>
>>
>> 1. I think --with-gcc= is independent of the llvm code generator.
>> 2. Building the llvm codegen does not necessarily make it the *default*
>> codegen; I think native remains default.  I don't know if there's a way to
>> specify that llvm should be the default code generator.
>>
>> fwiw, the ghc I have on here does not mention llvm in ghc --info, but ghc
>> -fllvm at least tries to work.
>>
>> --
>> brandon s allbery kf8nh                               sine nomine
>> associates
>> allbery.b <at> gmail.com
>> ballbery <at> sinenomine.net
>> unix, openafs, kerberos, infrastructure, xmonad
>> http://sinenomine.net
>
>
>
>
> --
> 竹密岂妨流水过
> 山高哪阻野云飞
>
> And for G+, please use magiclouds#gmail.com.

_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users <at> haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Gmane