This is the mail archive of the gcc-patches@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]

IA-64 patch for large thunk deltas


This fixes a bug where a large vtable could lead to assembler errors for
out-of-range operands.

2000-07-20  Jim Wilson  <wilson@cygnus.com>

	* config/ia64/ia64.h (ASM_OUTPUT_MI_THUNK): Handle DELTA values
	larger than 14 bits.

Index: ia64.h
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/config/ia64/ia64.h,v
retrieving revision 1.73
diff -p -r1.73 ia64.h
*** ia64.h	2000/07/19 23:08:22	1.73
--- ia64.h	2000/07/20 20:26:17
*************** do {									\
*** 1486,1497 ****
  /* A C compound statement that outputs the assembler code for a thunk function,
     used to implement C++ virtual function calls with multiple inheritance.  */
  
- /* ??? This only supports deltas up to 14 bits.  If we need more, then we
-    must load the delta into a register first.  */
- 
  #define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \
  do {									\
!   fprintf (FILE, "\tadd r32 = %d, r32\n", (DELTA));			\
    fprintf (FILE, "\tbr ");						\
    assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0));	\
    fprintf (FILE, "\n");							\
--- 1486,1504 ----
  /* A C compound statement that outputs the assembler code for a thunk function,
     used to implement C++ virtual function calls with multiple inheritance.  */
  
  #define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \
  do {									\
!   if (CONST_OK_FOR_I (DELTA))						\
!     fprintf (FILE, "\tadds r32 = %d, r32\n", (DELTA));			\
!   else									\
!     {									\
!       if (CONST_OK_FOR_J (DELTA))					\
!         fprintf (FILE, "\taddl r2 = %d, r0\n", (DELTA));		\
!       else								\
! 	fprintf (FILE, "\tmovl r2 = %d\n", (DELTA));			\
!       fprintf (FILE, "\t;;\n");						\
!       fprintf (FILE, "\tadd r32 = r2, r32\n");				\
!     }									\
    fprintf (FILE, "\tbr ");						\
    assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0));	\
    fprintf (FILE, "\n");							\

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