Need help for doing gcc modifications
James E Wilson
wilson@specifixinc.com
Tue Sep 7 22:57:00 GMT 2004
Perret Yannick wrote:
> I tried to add additionnal parameters for these functions, by
> modifying the emit_library_call (in functions.c).
emit_library_call is for emitting so-called libcalls, which are calls to
helper functions in libgcc. It doesn't handle all possible argument
types correctly, and it isn't wise to use it for anything complicated.
It is really only useful for integer and floating point arguments and
return values.
> Using other uses of this function I managed to add simple
> parameters such as intergers, but I do not know how to add
> a 'const char *'... First the name returned by current_function_name
> is in a the gcc space, not in the compiled program space, so
> I think I have to create inside the compiled program space
> a constant string to hold that name.
Strings only exist in the front end and middle end, not in the back end.
Looking at expand_expr, case STRING_CST, I see it calls
output_constant_def. So you need to create a STRING_CST tree, and then
pass it to output_constant_def. There might be other ways to handle this.
> In addition each parameters need a pair of 'rtx'/'machine_mode',
> and I can't figure how to generate them.
Either you don't what the rtx is, then I probably can't help you much.
For machine_mode, GET_MODE (rtx) probably works in all cases. For a
string pointer, this should be Pmode.
> Please can you help me for that ? Or give me a good pointer
> on a doc which explains that points ?
We don't have good docs for stuff like this. There is just too much
different stuff to document, and it all changes so often, and sometimes
so completely, that attempts to document stuff to the detail you need
tend to be futile. If you want to do work on gcc, you just have to put
in the time needed to learn how the internals work.
We do have some stuff on the Further Readings section of the web site,
but I'm not sure if anything there will be helpful to you.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com
More information about the Gcc
mailing list