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: problem when making a new target


> 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.


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