This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PA bootstrap fix
- From: law at redhat dot com
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 29 May 2002 16:54:59 -0600
- Subject: PA bootstrap fix
- Reply-to: law at redhat dot com
The PA was failing to bootstrap because targetm is not available inside
cp/method.c (ASM_OUTPUT_THUNK on the PA calls stuff through targetm).
Given the macro was a few pages long, it seemed simplest to move the
implementation into pa.c where we also happen to have access to targetm :-)
Mainline bootstraps on the PA again.
* pa.h (ASM_OUTPUT_MI_THUNK): Move implementation into pa.c.
* pa.c (pa_asm_output_mi_thunk): New function.
* pa-protos.h (pa_asm_output_mi_thunk): Declare.
Index: pa-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/pa/pa-protos.h,v
retrieving revision 1.12
diff -c -3 -p -r1.12 pa-protos.h
*** pa-protos.h 6 May 2002 16:53:34 -0000 1.12
--- pa-protos.h 29 May 2002 22:47:40 -0000
*************** extern rtx function_arg PARAMS ((CUMULAT
*** 162,165 ****
--- 162,167 ----
extern int function_arg_partial_nregs PARAMS ((CUMULATIVE_ARGS *,
enum machine_mode,
tree, int));
+
+ extern void pa_asm_output_mi_thunk PARAMS ((FILE *, tree, int, tree));
#endif /* TREE_CODE */
Index: pa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/pa/pa.c,v
retrieving revision 1.161
diff -c -3 -p -r1.161 pa.c
*** pa.c 19 May 2002 07:55:41 -0000 1.161
--- pa.c 29 May 2002 22:47:45 -0000
*************** is_function_label_plus_const (op)
*** 6496,6501 ****
--- 6496,6584 ----
&& GET_CODE (XEXP (op, 1)) == CONST_INT);
}
+ /* Output assembly code for a thunk to FUNCTION. */
+
+ void
+ pa_asm_output_mi_thunk (file, thunk_fndecl, delta, function)
+ FILE *file;
+ tree thunk_fndecl;
+ int delta;
+ tree function;
+ {
+ const char *target_name = XSTR (XEXP (DECL_RTL (function), 0), 0);
+ static unsigned int current_thunk_number;
+ char label[16];
+ char *lab;
+ ASM_GENERATE_INTERNAL_LABEL (label, "LTHN", current_thunk_number);
+ lab = (*targetm.strip_name_encoding) (label);
+ target_name = (*targetm.strip_name_encoding) (target_name);
+ /* FIXME: total_code_bytes is not handled correctly in files with
+ mi thunks. */
+ pa_output_function_prologue (file, 0);
+ if (VAL_14_BITS_P (delta))
+ {
+ if (! TARGET_64BIT && ! TARGET_PORTABLE_RUNTIME && flag_pic)
+ {
+ fprintf (file, "\taddil LT%%%s,%%r19\n", lab);
+ fprintf (file, "\tldw RT%%%s(%%r1),%%r22\n", lab);
+ fprintf (file, "\tldw 0(%%sr0,%%r22),%%r22\n");
+ fprintf (file, "\tbb,>=,n %%r22,30,.+16\n");
+ fprintf (file, "\tdepi 0,31,2,%%r22\n");
+ fprintf (file, "\tldw 4(%%sr0,%%r22),%%r19\n");
+ fprintf (file, "\tldw 0(%%sr0,%%r22),%%r22\n");
+ fprintf (file, "\tldsid (%%sr0,%%r22),%%r1\n\tmtsp %%r1,%%sr0\n");
+ fprintf (file, "\tbe 0(%%sr0,%%r22)\n\tldo ");
+ fprintf (file, HOST_WIDE_INT_PRINT_DEC, delta);
+ fprintf (file, "(%%r26),%%r26\n");
+ }
+ else
+ {
+ fprintf (file, "\tb %s\n\tldo ", target_name);
+ fprintf (file, HOST_WIDE_INT_PRINT_DEC, delta);
+ fprintf (file, "(%%r26),%%r26\n");
+ }
+ }
+ else
+ {
+ if (! TARGET_64BIT && ! TARGET_PORTABLE_RUNTIME && flag_pic)
+ {
+ fprintf (file, "\taddil L%%");
+ fprintf (file, HOST_WIDE_INT_PRINT_DEC, delta);
+ fprintf (file, ",%%r26\n\tldo R%%");
+ fprintf (file, HOST_WIDE_INT_PRINT_DEC, delta);
+ fprintf (file, "(%%r1),%%r26\n");
+ fprintf (file, "\taddil LT%%%s,%%r19\n", lab);
+ fprintf (file, "\tldw RT%%%s(%%r1),%%r22\n", lab);
+ fprintf (file, "\tldw 0(%%sr0,%%r22),%%r22\n");
+ fprintf (file, "\tbb,>=,n %%r22,30,.+16\n");
+ fprintf (file, "\tdepi 0,31,2,%%r22\n");
+ fprintf (file, "\tldw 4(%%sr0,%%r22),%%r19\n");
+ fprintf (file, "\tldw 0(%%sr0,%%r22),%%r22\n");
+ fprintf (file, "\tldsid (%%sr0,%%r22),%%r1\n\tmtsp %%r1,%%sr0\n");
+ fprintf (file, "\tbe,n 0(%%sr0,%%r22)\n");
+ }
+ else
+ {
+ fprintf (file, "\taddil L%%");
+ fprintf (file, HOST_WIDE_INT_PRINT_DEC, delta);
+ fprintf (file, ",%%r26\n\tb %s\n\tldo R%%", target_name);
+ fprintf (file, HOST_WIDE_INT_PRINT_DEC, delta);
+ fprintf (file, "(%%r1),%%r26\n");
+ }
+ }
+
+ fprintf (file, "\t.EXIT\n\t.PROCEND\n");
+ if (! TARGET_64BIT && ! TARGET_PORTABLE_RUNTIME && flag_pic)
+ {
+ data_section ();
+ fprintf (file, "\t.align 4\n");
+ ASM_OUTPUT_INTERNAL_LABEL (file, "LTHN", current_thunk_number);
+ fprintf (file, "\t.word P%%%s\n", target_name);
+ function_section (thunk_fndecl);
+ }
+ current_thunk_number++;
+ }
+
/* Returns 1 if the 6 operands specified in OPERANDS are suitable for
use in fmpyadd instructions. */
int
Index: pa.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/pa/pa.h,v
retrieving revision 1.156
diff -c -3 -p -r1.156 pa.h
*** pa.h 19 May 2002 07:55:41 -0000 1.156
--- pa.h 29 May 2002 22:47:46 -0000
*************** struct hppa_args {int words, nargs_proto
*** 864,943 ****
extern struct rtx_def *hppa_compare_op0, *hppa_compare_op1;
extern enum cmp_type hppa_branch_type;
! #define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \
! do { \
! const char *target_name = XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0); \
! static unsigned int current_thunk_number; \
! char label[16]; \
! char *lab; \
! ASM_GENERATE_INTERNAL_LABEL (label, "LTHN", current_thunk_number); \
! lab = (*targetm.strip_name_encoding) (label); \
! target_name = (*targetm.strip_name_encoding) (target_name); \
! /* FIXME: total_code_bytes is not handled correctly in files with \
! mi thunks. */ \
! pa_output_function_prologue (FILE, 0); \
! if (VAL_14_BITS_P (DELTA)) \
! { \
! if (! TARGET_64BIT && ! TARGET_PORTABLE_RUNTIME && flag_pic) \
! { \
! fprintf (FILE, "\taddil LT%%%s,%%r19\n", lab); \
! fprintf (FILE, "\tldw RT%%%s(%%r1),%%r22\n", lab); \
! fprintf (FILE, "\tldw 0(%%sr0,%%r22),%%r22\n"); \
! fprintf (FILE, "\tbb,>=,n %%r22,30,.+16\n"); \
! fprintf (FILE, "\tdepi 0,31,2,%%r22\n"); \
! fprintf (FILE, "\tldw 4(%%sr0,%%r22),%%r19\n"); \
! fprintf (FILE, "\tldw 0(%%sr0,%%r22),%%r22\n"); \
! fprintf (FILE, "\tldsid (%%sr0,%%r22),%%r1\n\tmtsp %%r1,%%sr0\n"); \
! fprintf (FILE, "\tbe 0(%%sr0,%%r22)\n\tldo "); \
! fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, DELTA); \
! fprintf (FILE, "(%%r26),%%r26\n"); \
! } \
! else \
! { \
! fprintf (FILE, "\tb %s\n\tldo ", target_name); \
! fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, DELTA); \
! fprintf (FILE, "(%%r26),%%r26\n"); \
! } \
! } \
! else \
! { \
! if (! TARGET_64BIT && ! TARGET_PORTABLE_RUNTIME && flag_pic) \
! { \
! fprintf (FILE, "\taddil L%%"); \
! fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, DELTA); \
! fprintf (FILE, ",%%r26\n\tldo R%%"); \
! fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, DELTA); \
! fprintf (FILE, "(%%r1),%%r26\n"); \
! fprintf (FILE, "\taddil LT%%%s,%%r19\n", lab); \
! fprintf (FILE, "\tldw RT%%%s(%%r1),%%r22\n", lab); \
! fprintf (FILE, "\tldw 0(%%sr0,%%r22),%%r22\n"); \
! fprintf (FILE, "\tbb,>=,n %%r22,30,.+16\n"); \
! fprintf (FILE, "\tdepi 0,31,2,%%r22\n"); \
! fprintf (FILE, "\tldw 4(%%sr0,%%r22),%%r19\n"); \
! fprintf (FILE, "\tldw 0(%%sr0,%%r22),%%r22\n"); \
! fprintf (FILE, "\tldsid (%%sr0,%%r22),%%r1\n\tmtsp %%r1,%%sr0\n"); \
! fprintf (FILE, "\tbe,n 0(%%sr0,%%r22)\n"); \
! } \
! else \
! { \
! fprintf (FILE, "\taddil L%%"); \
! fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, DELTA); \
! fprintf (FILE, ",%%r26\n\tb %s\n\tldo R%%", target_name); \
! fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, DELTA); \
! fprintf (FILE, "(%%r1),%%r26\n"); \
! } \
! } \
! fprintf (FILE, "\t.EXIT\n\t.PROCEND\n"); \
! if (! TARGET_64BIT && ! TARGET_PORTABLE_RUNTIME && flag_pic) \
! { \
! data_section (); \
! fprintf (FILE, "\t.align 4\n"); \
! ASM_OUTPUT_INTERNAL_LABEL (FILE, "LTHN", current_thunk_number); \
! fprintf (FILE, "\t.word P%%%s\n", target_name); \
! function_section (THUNK_FNDECL); \
! } \
! current_thunk_number++; \
! } while (0)
/* On HPPA, we emit profiling code as rtl via PROFILE_HOOK rather than
as assembly via FUNCTION_PROFILER. Just output a local label.
--- 864,871 ----
extern struct rtx_def *hppa_compare_op0, *hppa_compare_op1;
extern enum cmp_type hppa_branch_type;
! #define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \
! pa_asm_output_mi_thunk (FILE, THUNK_FNDECL, DELTA, FUNCTION);
/* On HPPA, we emit profiling code as rtl via PROFILE_HOOK rather than
as assembly via FUNCTION_PROFILER. Just output a local label.