llvm-gcc and -emit-llvm

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

llvm-gcc and -emit-llvm

Jonathan Turner-3

Just thought I'd mention this to keep other people from stubbing their toes on it...

Using llvm-gcc/llvm-g++ and -emit-llvm, you need to make sure to pass -S as well, like so:

./llvm-g++ -S -emit-llvm hello.cpp

not: /llvm-g++ -emit-llvm hello.cpp

I'm sure that's old news to most of the people on the list, but I thought it couldn't hurt to mention it in case other people happen upon it.

A question might be, can the -emit-llvm emit the llvm first before it goes into the linking phase?  That way the users can at least get something on the screen of what they're looking for, or maybe a warning saying "to emit llvm, you need to pass the -S flag"?


Jonathan
_________________________________________________________________
It’s easy to add contacts from Facebook and other social sites through Windows Live™ Messenger. Learn how.
https://www.invite2messenger.net/im/?source=TXT_EML_WLH_LearnHow
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: llvm-gcc and -emit-llvm

Dale Johannesen

On Jun 9, 2008, at 11:32 AM, Jonathan Turner wrote:

> Just thought I'd mention this to keep other people from stubbing  
> their toes on it...
>
> Using llvm-gcc/llvm-g++ and -emit-llvm, you need to make sure to  
> pass -S as well, like so:
>
> ./llvm-g++ -S -emit-llvm hello.cpp
>
> not: /llvm-g++ -emit-llvm hello.cpp
>
> I'm sure that's old news to most of the people on the list, but I  
> thought it couldn't hurt to mention it in case other people happen  
> upon it.
>
> A question might be, can the -emit-llvm emit the llvm first before  
> it goes into the linking phase?  That way the users can at least get  
> something on the screen of what they're looking for, or maybe a  
> warning saying "to emit llvm, you need to pass the -S flag"?

The flag usage follows standard Unix practice:  without -S or -c, the  
end result is an executable; with one of those flags, compilation  
stops earlier.  -c -emit-llvm will produce llvm IR in its binary  
format (suitable for feeding into llc).

It seems clear the current interface can be confusing; you are not the  
first.  Perhaps -emit-llvm should be renamed to indicate it does not  
necessarily result in emitting llvm IR?
-output-format-llvm?  Seems pretty ugly, maybe someone can do better.


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: llvm-gcc and -emit-llvm

dag-7
On Monday 09 June 2008 14:52, Dale Johannesen wrote:

> It seems clear the current interface can be confusing; you are not the
> first.  Perhaps -emit-llvm should be renamed to indicate it does not
> necessarily result in emitting llvm IR?
> -output-format-llvm?  Seems pretty ugly, maybe someone can do better.

-mcpu=llvm?  Yes, it may require some mucking around with config
files, but it would at least be consistent.

                                             -Dave
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: llvm-gcc and -emit-llvm

Gordon Henriksen-3
On 2008-06-09, at 18:20, David Greene wrote:

> On Monday 09 June 2008 14:52, Dale Johannesen wrote:
>
>> It seems clear the current interface can be confusing; you are not  
>> the first.  Perhaps -emit-llvm should be renamed to indicate it  
>> does not necessarily result in emitting llvm IR? -output-format-
>> llvm?  Seems pretty ugly, maybe someone can do better.
>
> -mcpu=llvm?  Yes, it may require some mucking around with config  
> files, but it would at least be consistent.

LLVM bitcode/assembly v.s. object code/assembly is orthogonal to CPU  
architecture. -mcpu=ppc and -mcpu=x86 will generate different IR. So  
this is no good.

— Gordon


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: llvm-gcc and -emit-llvm

Dale Johannesen
In reply to this post by Dale Johannesen
I'm interested in cleaning up the documentation for this, but it is in  
4 different formats.
 From the makefile it looks like the .pod is the master.  Do I need to  
do anything special
after changing this to get it propagated elsewhere?

On Jun 9, 2008, at 12:52 PMPDT, Dale Johannesen wrote:

> On Jun 9, 2008, at 11:32 AM, Jonathan Turner wrote:
>> Just thought I'd mention this to keep other people from stubbing  
>> their toes on it...
>>
>> Using llvm-gcc/llvm-g++ and -emit-llvm, you need to make sure to  
>> pass -S as well, like so:
>>
>> ./llvm-g++ -S -emit-llvm hello.cpp
>>
>> not: /llvm-g++ -emit-llvm hello.cpp
>>
>> I'm sure that's old news to most of the people on the list, but I  
>> thought it couldn't hurt to mention it in case other people happen  
>> upon it.
>>
>> A question might be, can the -emit-llvm emit the llvm first before  
>> it goes into the linking phase?  That way the users can at least  
>> get something on the screen of what they're looking for, or maybe a  
>> warning saying "to emit llvm, you need to pass the -S flag"?
>
> The flag usage follows standard Unix practice:  without -S or -c,  
> the end result is an executable; with one of those flags,  
> compilation stops earlier.  -c -emit-llvm will produce llvm IR in  
> its binary format (suitable for feeding into llc).
>
> It seems clear the current interface can be confusing; you are not  
> the first.  Perhaps -emit-llvm should be renamed to indicate it does  
> not necessarily result in emitting llvm IR?
> -output-format-llvm?  Seems pretty ugly, maybe someone can do better.

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: llvm-gcc and -emit-llvm

Chris Lattner

On Jun 10, 2008, at 3:34 PM, Dale Johannesen wrote:

> I'm interested in cleaning up the documentation for this, but it is in
> 4 different formats.
> From the makefile it looks like the .pod is the master.  Do I need to
> do anything special
> after changing this to get it propagated elsewhere?

Nope, editing and committing the .pod file should be enough, thanks  
Dale!

-Chris

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: llvm-gcc and -emit-llvm

Devang Patel
In reply to this post by Jonathan Turner-3

On Jun 9, 2008, at 11:32 AM, Jonathan Turner wrote:

>
> Just thought I'd mention this to keep other people from stubbing  
> their toes on it...
>
> Using llvm-gcc/llvm-g++ and -emit-llvm, you need to make sure to  
> pass -S as well, like so:
>
> ./llvm-g++ -S -emit-llvm hello.cpp
>
> not: /llvm-g++ -emit-llvm hello.cpp
>
> I'm sure that's old news to most of the people on the list, but I  
> thought it couldn't hurt to mention it in case other people happen  
> upon it.
>
> A question might be, can the -emit-llvm emit the llvm first before  
> it goes into the linking phase?  That way the users can at least get  
> something on the screen of what they're looking for, or maybe a  
> warning saying "to emit llvm, you need to pass the -S flag"?

This logic is  follows gcc tool chain. If you want to read llvm IR  
then you follow the steps to get assembly text file from the compiler,  
but add one additional flag.

$ gcc -c foo.cpp  <---- gcc generates binary object file.
$ gcc -S foo.cpp <---- gcc generates human readable assembly file.

$ llvm-gcc --emit-llvm -c foo.cpp  <---- llvm-gcc generates binary  
llvm IR file.
$ llvm-gcc --emit-llvm -S foo.cpp <---- llvm-gcc generates human  
readable LLVM IR file.

$ gcc foo.cpp -o foo <--- gcc generated binary object file is linked  
by the linker to generate final binary.

$ llvm-gcc --emit-llvm foo.cpp -o foo <--- llvm-gcc generated binary  
LLVM IR file is linked by the linker to generate final binary. This  
requires the linker that accepts LLVM IR.

-
Devang




_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: llvm-gcc and -emit-llvm

Dale Johannesen
In reply to this post by Chris Lattner

On Jun 10, 2008, at 10:58 PMPDT, Chris Lattner wrote:

>
> On Jun 10, 2008, at 3:34 PM, Dale Johannesen wrote:
>
>> I'm interested in cleaning up the documentation for this, but it is  
>> in
>> 4 different formats.
>> From the makefile it looks like the .pod is the master.  Do I need to
>> do anything special
>> after changing this to get it propagated elsewhere?
>
> Nope, editing and committing the .pod file should be enough, thanks  
> Dale!

Done, but I don't see any propagation....?  I haven't really tested  
this, was hoping to look at the html file...

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: llvm-gcc and -emit-llvm

Tanya Lattner-2

>> Nope, editing and committing the .pod file should be enough, thanks
>> Dale!
>
> Done, but I don't see any propagation....?  I haven't really tested
> this, was hoping to look at the html file...

Docs are generated/updated once a day (2am I think).

-Tanya

>
> _______________________________________________
> LLVM Developers mailing list
> [hidden email]         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: llvm-gcc and -emit-llvm

Dale Johannesen

On Jun 12, 2008, at 11:30 AM, Tanya M. Lattner wrote:
>>> Nope, editing and committing the .pod file should be enough, thanks
>>> Dale!
>>
>> Done, but I don't see any propagation....?  I haven't really tested
>> this, was hoping to look at the html file...
>
> Docs are generated/updated once a day (2am I think).
>
> -Tanya

Sorry, I need more help with this.  Today I do not see any propagated  
changes in the repository, nor on the web page?


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: llvm-gcc and -emit-llvm

Tanya Lattner-2

>> Docs are generated/updated once a day (2am I think).
>>
>> -Tanya
>
> Sorry, I need more help with this.  Today I do not see any propagated
> changes in the repository, nor on the web page?

I'm not sure what you you mean by propogated changes in the repository.

For the website, can you check again? There was a permissions issues on
something that might have been the problem. I fixed that.

-Tanya
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: llvm-gcc and -emit-llvm

Dale Johannesen

On Jun 13, 2008, at 12:41 PM, Tanya M. Lattner wrote:

>
>>> Docs are generated/updated once a day (2am I think).
>>>
>>> -Tanya
>>
>> Sorry, I need more help with this.  Today I do not see any propagated
>> changes in the repository, nor on the web page?
>
> I'm not sure what you you mean by propogated changes in the  
> repository.

OK, I had an llvmgcc.html (etc.) in my checkout, which I thought was  
checked out from the repository (certainly it is none of my doing).  
But I see it is not in there, so I just didn't understand how this  
works.

> For the website, can you check again? There was a permissions issues  
> on
> something that might have been the problem. I fixed that.

Nope.
It is certainly possible my change wasn't right and would not go  
through the conversion programs...


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: llvm-gcc and -emit-llvm

Tanya Lattner-2

>
> OK, I had an llvmgcc.html (etc.) in my checkout, which I thought was
> checked out from the repository (certainly it is none of my doing).
> But I see it is not in there, so I just didn't understand how this
> works.
>
>> For the website, can you check again? There was a permissions issues
>> on
>> something that might have been the problem. I fixed that.
>
> Nope.
> It is certainly possible my change wasn't right and would not go
> through the conversion programs...
>

Ok. So for future reference you can always just build the docs to  
verify this yourself. The webserver does a "make BUILD_FOR_WEBSITE=1"  
in the docs dir. Some links might be broken because thats specific to  
the llvm site, but you can see the new pod or html files.

At any rate, I think all the html files were regenerated now.
http://llvm.org/cmds/llvmgcc.html

-Tanya


>
> _______________________________________________
> LLVM Developers mailing list
> [hidden email]         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: llvm-gcc and -emit-llvm

Dale Johannesen

On Jun 13, 2008, at 2:32 PM, Tanya Lattner wrote:

>
>>
>> OK, I had an llvmgcc.html (etc.) in my checkout, which I thought was
>> checked out from the repository (certainly it is none of my doing).
>> But I see it is not in there, so I just didn't understand how this
>> works.
>>
>>> For the website, can you check again? There was a permissions issues
>>> on
>>> something that might have been the problem. I fixed that.
>>
>> Nope.
>> It is certainly possible my change wasn't right and would not go
>> through the conversion programs...
>>
>
> Ok. So for future reference you can always just build the docs to
> verify this yourself. The webserver does a "make BUILD_FOR_WEBSITE=1"
> in the docs dir. Some links might be broken because thats specific to
> the llvm site, but you can see the new pod or html files.
>
> At any rate, I think all the html files were regenerated now.
> http://llvm.org/cmds/llvmgcc.html

Yes, thanks!

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev