This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: How to get the line info about a function when outputing the funciton prolog?
- From: Alexandre Courbot <alexandrecourbot at linuxgames dot com>
- To: "Jiang Alan" <whjiang_cn at hotmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 9 Jul 2002 17:10:42 +0200
- Subject: Re: How to get the line info about a function when outputing the funciton prolog?
- References: <F90uvU12cxynlBb4w7l0000d5c9@hotmail.com>
> I am developing a new target for GCC. But my assember need the
> source
> line information about a function(its begin line and end line ) before
> the function body is outputted.
>
> I think the proper place to output this information is the function
> prologue macro. But when this macro is called, I don't know how to get
> the source file line information about the function?
You can get the begin and end lines of a function by parsing the
program's insn list. If you run GCC with the -dr option, it will
generate a .00.rtl file that contain a RTL dump of your program. You'll
see that there are "note" insn, some of them labelled
"NOTE_INSN_FUNCTION_BEG" and "NOTE_INSN_FUNCTION_END" With the
NOTE_LINE_NUMBER and NOTE_SOURCE_FILE macros applied on a note insn you
can get the line number and source file name respectively. It is
documented in http://gcc.gnu.org/onlinedocs/gccint/Insns.html, look for
the "note" insns.
Getting the corresponding note insn in your prologue should be easy I
guess, but I don't know if it would be the preferred way, and right now
I don't know precisely how you could do that. Maybe someone with more
experience than me could emphasize on this, and confirm/infirm my
suggestion.
See you!
Alex.
--
http://www.gnurou.org