arm.h, aof.h assembler dialect patch.

Nick Burrett nick.burrett@btinternet.com
Tue Apr 27 10:36:00 GMT 1999


This fixes a assembler dialect depencency on a.out targets which would
otherwise always break AOF targets.

I've attempted to use the proper macros for referencing labels and
creating new labels as well as tidying up incompatible references
to register names. ARM_MCOUNT_NAME is a new macro because AOF targets
don't prefix function names with underscores, unlike a.out targets.


Nick.


Wed Sep 03 16:17:12 1997  Nick Burrett  <nick.burrett@btinternet.com>

	* arm.h (TRAMPOLINE_TEMPLATE): Remove assembler dialect dependency.
	(ARM_MCOUNT_NAME): Define
	(FUNCTION_PROFILER): Remove assembler dialect dependency and use
	ARM_MCOUNT_NAME.
	* aof.h (ARM_MCOUNT_NAME): Define.

*** gcc/config/arm/arm.h.orig	Tue Apr 27 17:21:51 1999
--- gcc/config/arm/arm.h	Tue Apr 27 17:25:44 1999
*************** do {									\
*** 1134,1148 ****
  #define FUNCTION_PROLOGUE(STREAM, SIZE)  \
    output_func_prologue ((STREAM), (SIZE))
  
! /* Call the function profiler with a given profile label.  The Acorn compiler
!    puts this BEFORE the prolog but gcc puts it afterwards.  The ``mov ip,lr''
!    seems like a good idea to stick with cc convention.  ``prof'' doesn't seem
!    to mind about this!  */
  #define FUNCTION_PROFILER(STREAM,LABELNO)  				    \
  {									    \
!     fprintf(STREAM, "\tmov\t%sip, %slr\n", REGISTER_PREFIX, REGISTER_PREFIX); \
!     fprintf(STREAM, "\tbl\tmcount\n");					    \
!     fprintf(STREAM, "\t.word\tLP%d\n", (LABELNO));			    \
  }
  
  /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
--- 1134,1175 ----
  #define FUNCTION_PROLOGUE(STREAM, SIZE)  \
    output_func_prologue ((STREAM), (SIZE))
  
! /* If your target environment doesn't prefix user functions with an
!    underscore, you may wish to re-define this to prevent any conflicts.
!    e.g. AOF may prefix mcount with an underscore.  */
! #ifndef ARM_MCOUNT_NAME
! #define ARM_MCOUNT_NAME "*mcount"
! #endif
! 
! /* Call the function profiler with a given profile label.  The Acorn
!    compiler puts this BEFORE the prolog but gcc puts it afterwards.
!    On the ARM the full profile code will look like:
! 	.data
! 	LP1
! 		.word	0
! 	.text
! 		mov	ip, lr
! 		bl	mcount
! 		.word	LP1
! 
!    profile_function() in final.c outputs the .data section, FUNCTION_PROFILER
!    will output the .text section.
! 
!    The ``mov ip,lr'' seems like a good idea to stick with cc convention.
!    ``prof'' doesn't seem to mind about this!  */
  #define FUNCTION_PROFILER(STREAM,LABELNO)  				    \
  {									    \
!   char temp[20];							    \
!   rtx sym;								    \
! 									    \
!   fprintf ((STREAM), "\tmov\t%s%s, %s%s\n\tbl\t",			    \
! 	   REGISTER_PREFIX, reg_names[12] /* ip */,			    \
! 	   REGISTER_PREFIX, reg_names[14] /* lr */);			    \
!   assemble_name ((STREAM), ARM_MCOUNT_NAME);				    \
!   fputc ('\n', (STREAM));						    \
!   ASM_GENERATE_INTERNAL_LABEL (temp, "LP", (LABELNO));			    \
!   sym = gen_rtx (SYMBOL_REF, Pmode, temp);				    \
!   ASM_OUTPUT_INT ((STREAM), sym);					    \
  }
  
  /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
*************** do {									\
*** 1244,1255 ****
     ??? FIXME: When the trampoline returns, r8 will be clobbered.  */
  #define TRAMPOLINE_TEMPLATE(FILE)				\
  {								\
!   fprintf ((FILE), "\tldr\t%sr8, [%spc, #0]\n",			\
! 	   REGISTER_PREFIX, REGISTER_PREFIX);			\
!   fprintf ((FILE), "\tldr\t%spc, [%spc, #0]\n",			\
! 	   REGISTER_PREFIX, REGISTER_PREFIX);			\
!   fprintf ((FILE), "\t.word\t0\n");				\
!   fprintf ((FILE), "\t.word\t0\n");				\
  }
  
  /* Length in units of the trampoline for entering a nested function.  */
--- 1271,1284 ----
     ??? FIXME: When the trampoline returns, r8 will be clobbered.  */
  #define TRAMPOLINE_TEMPLATE(FILE)				\
  {								\
!   fprintf ((FILE), "\tldr\t%s%s, [%s%s, #0]\n",			\
! 	   REGISTER_PREFIX, reg_names[STATIC_CHAIN_REGNUM],	\
! 	   REGISTER_PREFIX, reg_names[PC_REGNUM]);		\
!   fprintf ((FILE), "\tldr\t%s%s, [%s%s, #0]\n",			\
! 	   REGISTER_PREFIX, reg_names[PC_REGNUM],		\
! 	   REGISTER_PREFIX, reg_names[PC_REGNUM]);		\
!   ASM_OUTPUT_INT ((FILE), const0_rtx);				\
!   ASM_OUTPUT_INT ((FILE), const0_rtx);				\
  }
  
  /* Length in units of the trampoline for entering a nested function.  */
*** gcc/config/arm/aof.h.orig	Tue Apr 27 17:30:28 1999
--- gcc/config/arm/aof.h	Tue Apr 27 17:31:06 1999
*************** do {						\
*** 422,427 ****
--- 422,430 ----
  #define USER_LABEL_PREFIX ""
  #define LOCAL_LABEL_PREFIX ""
  
+ /* AOF does not prefix user function names with an underscore.  */
+ #define ARM_MCOUNT_NAME "_mcount"
+ 
  /* Output of Dispatch Tables */
  
  #define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM,BODY,VALUE,REL)		\


More information about the Gcc-patches mailing list