This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: problem when making a new target
- From: Alexandre Courbot <Alexandre dot Courbot at lifl dot fr>
- To: "Roger.Gough" <Roger dot Gough at ul dot ie>, "'gcc at gcc dot gnu dot org'" <gcc at gcc dot gnu dot org>
- Date: Fri, 23 May 2003 17:05:56 +0200
- Subject: Re: problem when making a new target
- References: <0B2F845E9599D611A6FA00B0D0D1DE4AA43236@exch-staff4.ul.ie>
> Can I comment out the #pragmas in system.h and hence use the macros which
> otherwise would have been poisoned? If not how am I going to implement my
> function_epilogue and function_prologue?
All the poisonned macros have been replaced by target hooks. You should use
them instead, it will be little effort to port your macros to target hooks
anyway. For instance, FUNCTION_PROLOGUE has been replaced by
ASM_TARGET_FUNCTION_PROLOGUE. These macros should no longer be defined in
your target.h file, but rather in target.c. You can use the following scheme
to set the hooks correctly (for FUNCTION_PROLOGUE and FUNCTION_EPILOGUE in
the example below):
#undef TARGET_ASM_FUNCTION_PROLOGUE
#define TARGET_ASM_FUNCTION_PROLOGUE my_prologue_function
#undef TARGET_ASM_FUNCTION_EPILOGUE
#define TARGET_ASM_FUNCTION_EPILOGUE my_epilogue_function
/* Setup the targetm global variable */
struct gcc_target targetm = TARGET_INITIALIZER;
targetm is a structure which contains pointers to functions. By undefining and
redefining the target hooks, you substitute your own functions to the default
ones. TARGET_INITIALIZER is an initializer made of the target hooks. If you
need more informations about target hooks, the manual is quite explicit on
them
(http://gcc.gnu.org/onlinedocs/gccint/Target-Structure.html#Target%20Structure).
Chapter 10 also contains a list of the hooks and their format along with the
macros.
Alex.