This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Inquiry about RTL


SRUTHY C.N. wrote:
Sir,
      In the RTL representation for a C program, I am finding so many
numbers in each instruction.For eg, in the Hello World Program ,RTL
code is given below ...what do those numbers 2 0 3  3 2 6 etc ..in
note insns represent?

The numbers represent the numeric IDs of insns. Each insn in a function has a unique integer ID, and the insn also contains pointers to the previous and next insns in the function's list of insns. In the RTL representation, the first of the numbers is the insn's unique ID, the second number is the ID of the previous insn, and the third number is the ID of the next insn. If you look closely at the numbers in the RTL list you provided, you will see the relationship.

The insn IDs aren't necessarily consecutive because some insns are
created or deleted during optimization.

[RTL listing snipped]

 I didn't understatnd what it is? Can anybody suggest any other documents
other than Richard Stallman's "Using and Porting GNU CC" ,to understand
RTL code for a program.

I'm afraid that Using and Porting GNU CC is the best source, though you want to be sure that you're reading an up-to-date version, since RTL sometimes changes with changes in the compiler.

The current RTL documentation is on the GCC website at the URL:

http://gcc.gnu.org/onlinedocs/gccint/

Another source of information is the GCC source code, in particular the
files gcc/rtl.def, which defines the various RTL components, and
gcc/rtl.h, which defines macros for RTL.  The comments in these files
provide a great deal of information.  You might also check the machine
description for the specific target you are compiling for; in your
case, this is gcc/config/i386/i386.md.

Unfortunately, RTL is inherently complex, partly because it depends on
the specific machine being compiled for.  So it takes quite a bit of
studying to fully understand.  If you're interested in fully learning
it, don't expect to get everything on a first reading.

For more information on GCC porting, you might try the document at:

ftp://ftp.axis.se/pub/users/hp/pgccfd/

which is included at the top of the Further Readings page on the GCC
website.

Colin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]