This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: function pointer
- To: benedetto dot proietti at infinito dot it (Fu-hau Hsu)
- Subject: Re: function pointer
- From: Joern Rennecke <amylaar at redhat dot com>
- Date: Wed, 8 Nov 2000 21:56:01 +0000 (GMT)
- Cc: fhsu at ic dot sunysb dot edu, gcc at gcc dot gnu dot org
> It seems that in the assembly translation the address of
> another_function() is pushed into register %ebx first, and then a
> indirect call(i.e. call *%ebx) is used to transfer control flow to
> another_function(). Is this the standare way that gcc handles function
> calls which are invoked through function pointer variable? I would like
No, gcc is free to use any suitable register.
> to
> add some assembly instructions right before every this kind of indirect
> funciton call? (i.e. so every fucntion call invoked through function
> pointer will be tranlated as follows:
The straightforward way to do this is to hack the *call_1 pattern in i386.md.
> Besides, as you know the C source code will be translated into RTL form
> first. Then the RTL form will be tranlated into assembly code and the
> assembly code will be saved into a temporary file. After all the
> assembly
> code is generated and saved into the temporary file, what function of
> the
> gcc souce code is called to process the temporary assembly file? If I
It's not just a function call - the gcc compiler driver invokes the assembler,
which is a separate executable. As is the cc1 compiler.
> add
> some assembly instructions into the temporary file right before it is
> further processed, will this caused any problem?
Maybe. Depends.