Commit 2c04f847 by Bill Seurer Committed by Bill Seurer

[PATCH, rs6000] Split up rs6000.c.

The source file rs6000.c has grown to unreasonable size and is being
split up into several smaller source files.  This should improve
compilation speed for building gcc.

This is the first of several patches to do this and moves most of the
prologue/epilogue code to a new source file.

Bootstrapped and tested on powerpc64le-unknown-linux-gnu and
powerpc64-unknown-linux-gnu with no regressions.  Is this ok for trunk?


2019-06-24  Bill Seurer  <seurer@linux.vnet.ibm.com>

	* config/rs6000/rs6000.c (stack_info, rs6000_pic_labelno,
	savres_routine_syms, savres_routine_name, morestack_ref,
	rs6000_init_machine_status, save_reg_p, first_reg_to_save,
	first_fp_reg_to_save, first_altivec_reg_to_save, compute_vrsave_mask,
	compute_save_world_info, is_altivec_return_reg, fixed_reg_p,
	rs6000_savres_strategy, rs6000_stack_info, debug_stack_info,
	rs6000_return_addr, rs6000_decl_ok_for_sibcall,
	rs6000_function_ok_for_sibcall, rs6000_ra_ever_killed,
	rs6000_emit_load_toc_table, rs6000_emit_eh_reg_restore, uses_TOC,
	create_TOC_reference, rs6000_aix_asm_output_dwarf_table_ref,
	rs6000_emit_stack_tie, rs6000_emit_allocate_stack_1,
	get_stack_clash_protection_probe_interval,
	get_stack_clash_protection_guard_size,
	rs6000_emit_probe_stack_range_stack_clash, rs6000_emit_allocate_stack,
	rs6000_emit_probe_stack_range, output_probe_stack_range_1,
	interesting_frame_related_regno, output_probe_stack_range_stack_clash,
	output_probe_stack_range, rs6000_frame_related, generate_set_vrsave,
	gen_frame_set, gen_frame_load, gen_frame_store, emit_frame_save,
	gen_frame_mem_offset, rs6000_savres_routine_name,
	rs6000_savres_routine_sym, rs6000_emit_stack_reset,
	ptr_regno_for_savres, rs6000_emit_savres_rtx,
	rs6000_emit_prologue_move_from_cr, split_stack_arg_pointer_used_p,
	rs6000_global_entry_point_prologue_needed_p,
	rs6000_get_separate_components, rs6000_components_for_bb,
	rs6000_disqualify_components, rs6000_emit_prologue_components,
	rs6000_emit_epilogue_components, rs6000_set_handled_components,
	emit_vrsave_prologue, emit_split_stack_prologue, rs6000_emit_prologue,
	rs6000_output_savres_externs, rs6000_output_function_prologue,
	rs6000_keep_leaf_when_profiled, load_cr_save, restore_saved_cr,
	load_lr_save, restore_saved_lr, add_crlr_cfa_restore,
	offset_below_red_zone_p, emit_cfa_restores, rs6000_emit_epilogue,
	rs6000_output_function_epilogue, gen_add3_const,
	rs6000_expand_split_stack_prologue, rs6000_live_on_entry,
	rs6000_split_stack_space_check, rs6000_save_toc_in_prologue_p): Moved
	to rs6000-logue.c.
	(machine_function): Moved to rs6000.h.
	(rs6000_stack_t, ALTIVEC_REG_BIT, quad_address_offset_p) Moved to
	rs6000-internal.h.
	* config/rs6000/rs6000-logue.c(stack_info, rs6000_pic_labelno,
	savres_routine_syms, savres_routine_name, morestack_ref,
	rs6000_init_machine_status, save_reg_p, first_reg_to_save,
	first_fp_reg_to_save, first_altivec_reg_to_save, compute_vrsave_mask,
	compute_save_world_info, is_altivec_return_reg, fixed_reg_p,
	rs6000_savres_strategy, rs6000_stack_info, debug_stack_info,
	rs6000_return_addr, rs6000_decl_ok_for_sibcall,
	rs6000_function_ok_for_sibcall, rs6000_ra_ever_killed,
	rs6000_emit_load_toc_table, rs6000_emit_eh_reg_restore, uses_TOC,
	create_TOC_reference, rs6000_aix_asm_output_dwarf_table_ref,
	rs6000_emit_stack_tie, rs6000_emit_allocate_stack_1,
	get_stack_clash_protection_probe_interval,
	get_stack_clash_protection_guard_size,
	rs6000_emit_probe_stack_range_stack_clash, rs6000_emit_allocate_stack,
	rs6000_emit_probe_stack_range, output_probe_stack_range_1,
	interesting_frame_related_regno, output_probe_stack_range_stack_clash,
	output_probe_stack_range, rs6000_frame_related, generate_set_vrsave,
	gen_frame_set, gen_frame_load, gen_frame_store, emit_frame_save,
	gen_frame_mem_offset, rs6000_savres_routine_name,
	rs6000_savres_routine_sym, rs6000_emit_stack_reset,
	ptr_regno_for_savres, rs6000_emit_savres_rtx,
	rs6000_emit_prologue_move_from_cr, split_stack_arg_pointer_used_p,
	rs6000_global_entry_point_prologue_needed_p,
	rs6000_get_separate_components, rs6000_components_for_bb,
	rs6000_disqualify_components, rs6000_emit_prologue_components,
	rs6000_emit_epilogue_components, rs6000_set_handled_components,
	emit_vrsave_prologue, emit_split_stack_prologue, rs6000_emit_prologue,
	rs6000_output_savres_externs, rs6000_output_function_prologue,
	rs6000_keep_leaf_when_profiled, load_cr_save, restore_saved_cr,
	load_lr_save, restore_saved_lr, add_crlr_cfa_restore,
	offset_below_red_zone_p, emit_cfa_restores, rs6000_emit_epilogue,
	rs6000_output_function_epilogue, gen_add3_const,
	rs6000_expand_split_stack_prologue, rs6000_live_on_entry,
	rs6000_split_stack_space_check, rs6000_save_toc_in_prologue_p): Moved
	to here from rs6000.c.
	* config/rs6000/rs6000.h (machine_function): Moved to here from rs6000.c.
	* config/rs6000/rs6000-internal.h: (rs6000_stack_t, ALTIVEC_REG_BIT,
	quad_address_offset_p) Moved to here from rs6000.c.
	* config/rs6000/t-rs6000: Add new source file rs6000-logue.c.
	* config/config.gcc: Add new source file rs6000-logue.c to garbage
	collector.

From-SVN: r272658
parent a4cc2828
2019-06-24 Bill Seurer <seurer@linux.vnet.ibm.com>
* config/rs6000/rs6000.c (stack_info, rs6000_pic_labelno,
savres_routine_syms, savres_routine_name, morestack_ref,
rs6000_init_machine_status, save_reg_p, first_reg_to_save,
first_fp_reg_to_save, first_altivec_reg_to_save, compute_vrsave_mask,
compute_save_world_info, is_altivec_return_reg, fixed_reg_p,
rs6000_savres_strategy, rs6000_stack_info, debug_stack_info,
rs6000_return_addr, rs6000_decl_ok_for_sibcall,
rs6000_function_ok_for_sibcall, rs6000_ra_ever_killed,
rs6000_emit_load_toc_table, rs6000_emit_eh_reg_restore, uses_TOC,
create_TOC_reference, rs6000_aix_asm_output_dwarf_table_ref,
rs6000_emit_stack_tie, rs6000_emit_allocate_stack_1,
get_stack_clash_protection_probe_interval,
get_stack_clash_protection_guard_size,
rs6000_emit_probe_stack_range_stack_clash, rs6000_emit_allocate_stack,
rs6000_emit_probe_stack_range, output_probe_stack_range_1,
interesting_frame_related_regno, output_probe_stack_range_stack_clash,
output_probe_stack_range, rs6000_frame_related, generate_set_vrsave,
gen_frame_set, gen_frame_load, gen_frame_store, emit_frame_save,
gen_frame_mem_offset, rs6000_savres_routine_name,
rs6000_savres_routine_sym, rs6000_emit_stack_reset,
ptr_regno_for_savres, rs6000_emit_savres_rtx,
rs6000_emit_prologue_move_from_cr, split_stack_arg_pointer_used_p,
rs6000_global_entry_point_prologue_needed_p,
rs6000_get_separate_components, rs6000_components_for_bb,
rs6000_disqualify_components, rs6000_emit_prologue_components,
rs6000_emit_epilogue_components, rs6000_set_handled_components,
emit_vrsave_prologue, emit_split_stack_prologue, rs6000_emit_prologue,
rs6000_output_savres_externs, rs6000_output_function_prologue,
rs6000_keep_leaf_when_profiled, load_cr_save, restore_saved_cr,
load_lr_save, restore_saved_lr, add_crlr_cfa_restore,
offset_below_red_zone_p, emit_cfa_restores, rs6000_emit_epilogue,
rs6000_output_function_epilogue, gen_add3_const,
rs6000_expand_split_stack_prologue, rs6000_live_on_entry,
rs6000_split_stack_space_check, rs6000_save_toc_in_prologue_p): Moved
to rs6000-logue.c.
(machine_function): Moved to rs6000.h.
(rs6000_stack_t, ALTIVEC_REG_BIT, quad_address_offset_p) Moved to
rs6000-internal.h.
* config/rs6000/rs6000-logue.c(stack_info, rs6000_pic_labelno,
savres_routine_syms, savres_routine_name, morestack_ref,
rs6000_init_machine_status, save_reg_p, first_reg_to_save,
first_fp_reg_to_save, first_altivec_reg_to_save, compute_vrsave_mask,
compute_save_world_info, is_altivec_return_reg, fixed_reg_p,
rs6000_savres_strategy, rs6000_stack_info, debug_stack_info,
rs6000_return_addr, rs6000_decl_ok_for_sibcall,
rs6000_function_ok_for_sibcall, rs6000_ra_ever_killed,
rs6000_emit_load_toc_table, rs6000_emit_eh_reg_restore, uses_TOC,
create_TOC_reference, rs6000_aix_asm_output_dwarf_table_ref,
rs6000_emit_stack_tie, rs6000_emit_allocate_stack_1,
get_stack_clash_protection_probe_interval,
get_stack_clash_protection_guard_size,
rs6000_emit_probe_stack_range_stack_clash, rs6000_emit_allocate_stack,
rs6000_emit_probe_stack_range, output_probe_stack_range_1,
interesting_frame_related_regno, output_probe_stack_range_stack_clash,
output_probe_stack_range, rs6000_frame_related, generate_set_vrsave,
gen_frame_set, gen_frame_load, gen_frame_store, emit_frame_save,
gen_frame_mem_offset, rs6000_savres_routine_name,
rs6000_savres_routine_sym, rs6000_emit_stack_reset,
ptr_regno_for_savres, rs6000_emit_savres_rtx,
rs6000_emit_prologue_move_from_cr, split_stack_arg_pointer_used_p,
rs6000_global_entry_point_prologue_needed_p,
rs6000_get_separate_components, rs6000_components_for_bb,
rs6000_disqualify_components, rs6000_emit_prologue_components,
rs6000_emit_epilogue_components, rs6000_set_handled_components,
emit_vrsave_prologue, emit_split_stack_prologue, rs6000_emit_prologue,
rs6000_output_savres_externs, rs6000_output_function_prologue,
rs6000_keep_leaf_when_profiled, load_cr_save, restore_saved_cr,
load_lr_save, restore_saved_lr, add_crlr_cfa_restore,
offset_below_red_zone_p, emit_cfa_restores, rs6000_emit_epilogue,
rs6000_output_function_epilogue, gen_add3_const,
rs6000_expand_split_stack_prologue, rs6000_live_on_entry,
rs6000_split_stack_space_check, rs6000_save_toc_in_prologue_p): Moved
to here from rs6000.c.
* config/rs6000/rs6000.h (machine_function): Moved to here from rs6000.c.
* config/rs6000/rs6000-internal.h: (rs6000_stack_t, ALTIVEC_REG_BIT,
quad_address_offset_p) Moved to here from rs6000.c.
* config/rs6000/t-rs6000: Add new source file rs6000-logue.c.
* config/config.gcc: Add new source file rs6000-logue.c to garbage
collector.
2019-06-25 Martin Liska <mliska@suse.cz>
* hash-table.c (hashtab_chk_error): Move here from ...
......
......@@ -499,7 +499,7 @@ or1k*-*-*)
;;
powerpc*-*-*)
cpu_type=rs6000
extra_objs="rs6000-string.o rs6000-p8swap.o"
extra_objs="rs6000-string.o rs6000-p8swap.o rs6000-logue.o"
extra_headers="ppc-asm.h altivec.h htmintrin.h htmxlintrin.h"
extra_headers="${extra_headers} bmi2intrin.h bmiintrin.h"
extra_headers="${extra_headers} xmmintrin.h mm_malloc.h emmintrin.h"
......@@ -524,7 +524,7 @@ riscv*)
;;
rs6000*-*-*)
extra_options="${extra_options} g.opt fused-madd.opt rs6000/rs6000-tables.opt"
extra_objs="rs6000-string.o rs6000-p8swap.o"
extra_objs="rs6000-string.o rs6000-p8swap.o rs6000-logue.o"
;;
sparc*-*-*)
cpu_type=sparc
......@@ -2693,6 +2693,7 @@ powerpc*-*-linux*)
extra_options="${extra_options} rs6000/sysv4.opt"
tmake_file="${tmake_file} rs6000/t-fprules rs6000/t-ppccomm"
extra_objs="$extra_objs rs6000-linux.o"
target_gtfiles="$target_gtfiles \$(srcdir)/config/rs6000/rs6000-logue.c"
case ${target} in
powerpc*le-*-*)
tm_file="${tm_file} rs6000/sysv4le.h" ;;
......
/* Internal to rs6000 type, variable, and function declarations and
definitons shared between the various rs6000 source files.
Copyright (C) 1991-2019 Free Software Foundation, Inc.
Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 3, or (at your
option) any later version.
GCC is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#ifndef GCC_RS6000_INTERNAL_H
#define GCC_RS6000_INTERNAL_H
/* Structure used to define the rs6000 stack */
typedef struct rs6000_stack {
int reload_completed; /* stack info won't change from here on */
int first_gp_reg_save; /* first callee saved GP register used */
int first_fp_reg_save; /* first callee saved FP register used */
int first_altivec_reg_save; /* first callee saved AltiVec register used */
int lr_save_p; /* true if the link reg needs to be saved */
int cr_save_p; /* true if the CR reg needs to be saved */
unsigned int vrsave_mask; /* mask of vec registers to save */
int push_p; /* true if we need to allocate stack space */
int calls_p; /* true if the function makes any calls */
int world_save_p; /* true if we're saving *everything*:
r13-r31, cr, f14-f31, vrsave, v20-v31 */
enum rs6000_abi abi; /* which ABI to use */
int gp_save_offset; /* offset to save GP regs from initial SP */
int fp_save_offset; /* offset to save FP regs from initial SP */
int altivec_save_offset; /* offset to save AltiVec regs from initial SP */
int lr_save_offset; /* offset to save LR from initial SP */
int cr_save_offset; /* offset to save CR from initial SP */
int vrsave_save_offset; /* offset to save VRSAVE from initial SP */
int varargs_save_offset; /* offset to save the varargs registers */
int ehrd_offset; /* offset to EH return data */
int ehcr_offset; /* offset to EH CR field data */
int reg_size; /* register size (4 or 8) */
HOST_WIDE_INT vars_size; /* variable save area size */
int parm_size; /* outgoing parameter size */
int save_size; /* save area size */
int fixed_size; /* fixed size of stack frame */
int gp_size; /* size of saved GP registers */
int fp_size; /* size of saved FP registers */
int altivec_size; /* size of saved AltiVec registers */
int cr_size; /* size to hold CR if not in fixed area */
int vrsave_size; /* size to hold VRSAVE */
int altivec_padding_size; /* size of altivec alignment padding */
HOST_WIDE_INT total_size; /* total bytes allocated for stack */
int savres_strategy;
} rs6000_stack_t;
extern int need_toc_init;
extern char toc_label_name[10];
extern int rs6000_pic_labelno;
extern section *toc_section;
#ifdef USING_ELFOS_H
extern const char *rs6000_machine;
#endif
/* The VRSAVE bitmask puts bit %v0 as the most significant bit. */
#define ALTIVEC_REG_BIT(REGNO) (0x80000000 >> ((REGNO) - FIRST_ALTIVEC_REGNO))
/* Declare functions in rs6000-logue.c or called in rs6000.c
from rs6000-logue.c */
extern int uses_TOC (void);
extern bool rs6000_global_entry_point_needed_p (void);
extern void rs6000_output_function_prologue (FILE *file);
extern void rs6000_output_function_epilogue (FILE *file);
extern bool rs6000_function_ok_for_sibcall (tree decl, tree exp);
extern sbitmap rs6000_get_separate_components (void);
extern sbitmap rs6000_components_for_bb (basic_block bb);
extern void rs6000_disqualify_components (sbitmap components, edge e,
sbitmap edge_components,
bool /*is_prologue*/);
extern void rs6000_emit_prologue_components (sbitmap components);
extern void rs6000_emit_epilogue_components (sbitmap components);
extern void rs6000_set_handled_components (sbitmap components);
extern rs6000_stack_t * rs6000_stack_info (void);
extern rtx create_TOC_reference (rtx symbol, rtx largetoc_reg);
extern rtx rs6000_got_sym (void);
extern struct machine_function *rs6000_init_machine_status (void);
extern bool save_reg_p (int reg);
extern const char * rs6000_machine_from_flags (void);
extern void emit_asm_machine (void);
extern bool rs6000_global_entry_point_prologue_needed_p (void);
/* Return true if the OFFSET is valid for the quad address instructions that
use d-form (register + offset) addressing. */
static inline bool
quad_address_offset_p (HOST_WIDE_INT offset)
{
return (IN_RANGE (offset, -32768, 32767) && ((offset) & 0xf) == 0);
}
#endif
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -2486,6 +2486,40 @@ enum rs6000_builtin_type_index
extern GTY(()) tree rs6000_builtin_types[RS6000_BTI_MAX];
extern GTY(()) tree rs6000_builtin_decls[RS6000_BUILTIN_COUNT];
#ifndef USED_FOR_TARGET
/* A C structure for machine-specific, per-function data.
This is added to the cfun structure. */
typedef struct GTY(()) machine_function
{
/* Flags if __builtin_return_address (n) with n >= 1 was used. */
int ra_needs_full_frame;
/* Flags if __builtin_return_address (0) was used. */
int ra_need_lr;
/* Cache lr_save_p after expansion of builtin_eh_return. */
int lr_save_state;
/* Whether we need to save the TOC to the reserved stack location in the
function prologue. */
bool save_toc_in_prologue;
/* Offset from virtual_stack_vars_rtx to the start of the ABI_V4
varargs save area. */
HOST_WIDE_INT varargs_save_offset;
/* Alternative internal arg pointer for -fsplit-stack. */
rtx split_stack_arg_pointer;
bool split_stack_argp_used;
/* Flag if r2 setup is needed with ELFv2 ABI. */
bool r2_setup_needed;
/* The number of components we use for separate shrink-wrapping. */
int n_components;
/* The components already handled by separate shrink-wrapping, which should
not be considered by the prologue and epilogue. */
bool gpr_is_wrapped_separately[32];
bool fpr_is_wrapped_separately[32];
bool lr_is_wrapped_separately;
bool toc_is_wrapped_separately;
} machine_function;
#endif
#define TARGET_SUPPORTS_WIDE_INT 1
#if (GCC_VERSION >= 3000)
......
......@@ -39,6 +39,10 @@ rs6000-d.o: $(srcdir)/config/rs6000/rs6000-d.c
$(COMPILE) $<
$(POSTCOMPILE)
rs6000-logue.o: $(srcdir)/config/rs6000/rs6000-logue.c
$(COMPILE) $<
$(POSTCOMPILE)
$(srcdir)/config/rs6000/rs6000-tables.opt: $(srcdir)/config/rs6000/genopt.sh \
$(srcdir)/config/rs6000/rs6000-cpus.def
$(SHELL) $(srcdir)/config/rs6000/genopt.sh $(srcdir)/config/rs6000 > \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment