updating the "Getting Started" page with more info about the gcc4 frontend

Hello,

It looks like the "Getting Started" is missing some info about the gcc 4.0 frontend. Since it doesn't follow the setup of the cfrontend/gcc3.4 package, a couple sections describing the front end don't cover the gcc4 package. Here are the couple things I'd wish could be fleshed out a bit more:

Under "Getting Started Quickly (A Summary)", it'd be nice if the section 4 could also have an example for gcc4. Since that package doesn't include a "fixheaders" script, it's unclear whether or not there's anything that I need to do after I extract the code.

Under "Getting Started With LLVM", section "Terminology and Notation", the description of "LLVMGCCDIR" should be extended to also say "or where ever the gcc4 binary package was extracted to", or something similar.

The section "Install the GCC Front End" doesn't reference the gcc4 packages, so it'd be nice if some info was added. Also, a sentence or two on if it's possible to use both the gcc3.4 and the gcc4 packages at the same time, and how to do it if it's doable.

Hopefully, this isn't too unreasonable at this point in time. It'd really help out someone with little experience with llvm get started. Thanks!

-e

There should also be a large notice in 40 point font and bold that says,
"gcc4 does not produce byte code by default: you must use the -emit-llvm
flag to get LLVM byte code."

Erick Tryzelaar wrote:

=)

Where -is- that documented?

The only reason I know about it is because of how many times it's come
up on the list. =)

(Which doesn't help people who don't read the list)

--Emil

http://llvm.org/docs/GettingStarted.html ?

...
Example with llvm-gcc4
First, create a simple C file, name it 'hello.c':
   #include <stdio.h>
   int main() {
     printf("hello world\n");
     return 0;
   }

Next, compile the C file into a native executable:
% llvm-gcc hello.c -o hello
Note that llvm-gcc works just like GCC by default. The standard -S and -c arguments work as usual (producing a native .s or .o file, respectively).
Next, compile the C file into a LLVM bytecode file:
% llvm-gcc -O3 -emit-llvm hello.c -c -o hello.bc
The -emit-llvm option can be used with the -S or -c options to emit an LLVM ".ll" or ".bc" file (respectively) for the code. This allows you to use the standard LLVM tools on the bytecode file.
Unlike llvm-gcc3, llvm-gcc4 correctly responds to -O[0123] arguments.
...

Devang Patel wrote:

Where -is- that documented?

The only reason I know about it is because of how many times it's come
up on the list. =)

http://llvm.org/docs/GettingStarted.html ?

...
Example with llvm-gcc4
First, create a simple C file, name it 'hello.c':
  #include <stdio.h>
  int main() {
    printf("hello world\n");
    return 0;
  }

Next, compile the C file into a native executable:

That part about "native" -- yeah, it's there. The existence predicate
returns true. IT'S SOMETHING THAT IS EASILY SKIPPED OVER WHEN SKIMMING
THE DOCUMENT BECAUSE, HECK, THE GCC3 DRIVER COMPILES DIRECTLY TO
BYTECODE SO WHY DOESNT GCC4?

It's a "least surprise" issue. If gcc3 produces bytecode directly, why
did the gcc4 driver create such a large departure from original,
expected functionality? It's a rhetorical question, BTW.

Scott Michel wrote:

That part about "native" -- yeah, it's there. The existence predicate
returns true. IT'S SOMETHING THAT IS EASILY SKIPPED OVER WHEN SKIMMING
THE DOCUMENT BECAUSE, HECK, THE GCC3 DRIVER COMPILES DIRECTLY TO
BYTECODE SO WHY DOESNT GCC4?

It's a "least surprise" issue. If gcc3 produces bytecode directly, why
did the gcc4 driver create such a large departure from original,
expected functionality? It's a rhetorical question, BTW.
  
I actually know this one :slight_smile: I believe the powers that be decided that having a gcc-compatible interface was less surprising to folks than keeping compatible with the gcc3 driver. Thats why the gcc4 driver now supports the whole -O[1-4] options, among other things.

Erick Tryzelaar wrote:

It's a "least surprise" issue. If gcc3 produces bytecode directly, why
did the gcc4 driver create such a large departure from original,
expected functionality? It's a rhetorical question, BTW.
  
I actually know this one :slight_smile: I believe the powers that be decided that
having a gcc-compatible interface was less surprising to folks than
keeping compatible with the gcc3 driver. Thats why the gcc4 driver now
supports the whole -O[1-4] options, among other things.

That's why I would either make sure that the difference is highlighted
in the FAQ and that the difference is highlighted in the "Getting
Started" pages. Otherwise, it'll remain a mailing list FAQ.

Patches welcome. Please send a patch, or even just some suggested text, and we'll be happy to include it. Remember that the people who usually end up writing the FAQ's already know all the answers, so it's hard for us to see things from fresh perspectives sometimes :slight_smile:

-Chris

Chris Lattner wrote:

Patches welcome. Please send a patch, or even just some suggested text, and we'll be happy to include it. Remember that the people who usually end up writing the FAQ's already know all the answers, so it's hard for us to see things from fresh perspectives sometimes :slight_smile:

-Chris

Actually, my request for more info in the "Getting Started" had some hidden questions, as I don't know the answer to them :slight_smile: So to be a little more clear, here are the two I had:

Does the gcc4 no longer need the "fixheaders" script that the gcc3.4 frontends uses?

Is it possible to install both the gcc4 and the gcc3.4 frontends at the same time, or are they mutually exclusive? If so, how? If not, would it require a full rebuild, and renaming the executables something like llvm-gcc3?

Thanks again,

-e

I will join in on the questions as a complete newbie

is there anywhere a complete list of the environment variables used by llvm and what i should put in each of them before and after the install?

so fur my attempt to get the configure script to run ended in a few wornings that i haven’t been able to find the solutions to them in the documentation.

thanks
lee

Erick Tryzelaar wrote:

Actually, my request for more info in the "Getting Started" had some hidden questions, as I don't know the answer to them :slight_smile: So to be a little more clear, here are the two I had:

Does the gcc4 no longer need the "fixheaders" script that the gcc3.4 frontends uses?

Is it possible to install both the gcc4 and the gcc3.4 frontends at the same time, or are they mutually exclusive? If so, how? If not, would it require a full rebuild, and renaming the executables something like llvm-gcc3?

Thanks again,

Sorry to bump this again, but I haven't been able to figure it out :frowning: Anyone know the answer?

Try passing “–program-suffix=- 3.4-llvm” to GCC’s configure to have all the executable names suffixed with “-3.4-llvm”.

More GCC configure options are documented at http://gcc.gnu.org/install/configure.html

-Jey Kottalam

They can coexist. The steps I use are to install both into separate directories. Don't add either bin dir to your path. Then create (in some directory in your PATH) symlinks to both trees. I have llvm-gcc/llvm-g++ symlinked to llvm-gcc4 and llvm-gcc3/llvm-g++3 symlinked to the llvm-gcc3 binaries.

Seems to work for me, YMMV,

-Chris