This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: sysv/ms_abi attribute fix, part 2, avoid caching of call used in dataflow
Jan Hubicka wrote:
>> Jan Hubicka <hubicka@ucw.cz> writes:
>>
>>
>>> Kenny, perhaps cleaner approach would be to make df_invalidated_by_call
>>> regs_invalidated_by_call_regset initialized by regcalss's init_regs
>>> where all the other stuff is initialized. If this is preferred
>>> solution, I will prepare updated patch.
>>>
>> I agree that we should do this via init_regs.
>>
> Hi,
> this is init_regs version. Bootstrapped/regtested i686-linux, OK?
>
> Honza
>
>
This is fine with me. Since i am both a df reviewer and a register
allocation reviewer i think i can approve all of this patch.
kenny
> * df-scan.c (persistent_obstack, df_invalidated_by_call): Remove.
> (df_scan_start_dump, df_get_call_refs, df_hard_reg_init): Rename
> df_invalidated_by_call to invalidated_by_call_regset.
> * df.h (df_invalidated_by_call): Remove.
> * regclass.c (regs_invalidated_by_call_regset, persistent_obstack): New
> variables.
> (init_reg_sets_1): Initialize regs_invalidated_by_call_regset.
> (globalize_reg): Likewise.
> * df-problems.c (df_rd_local_compute, df_lr_confluence_n,
> df_byte_lr_alloc): Rename df_invalidated_by_call to
> invalidated_by_call_regset.
> * basic-block.h (regs_invalidated_by_call_regset): Declare.
> Index: df-scan.c
> ===================================================================
> *** df-scan.c (revision 142791)
> --- df-scan.c (working copy)
> *************** along with GCC; see the file COPYING3.
> *** 75,94 ****
> free (V); \
> } while (0)
>
> - /* The bitmap_obstack is used to hold some static variables that
> - should not be reset after each function is compiled. */
> -
> - static bitmap_obstack persistent_obstack;
> -
> /* The set of hard registers in eliminables[i].from. */
>
> static HARD_REG_SET elim_reg_set;
>
> - /* This is a bitmap copy of regs_invalidated_by_call so that we can
> - easily add it into bitmaps, etc. */
> -
> - bitmap df_invalidated_by_call = NULL;
> -
> /* Initialize ur_in and ur_out as if all hard registers were partially
> available. */
>
> --- 75,84 ----
> *************** df_scan_start_dump (FILE *file ATTRIBUTE
> *** 436,442 ****
> rtx insn;
>
> fprintf (file, ";; invalidated by call \t");
> ! df_print_regset (file, df_invalidated_by_call);
> fprintf (file, ";; hardware regs used \t");
> df_print_regset (file, df->hardware_regs_used);
> fprintf (file, ";; regular block artificial uses \t");
> --- 426,432 ----
> rtx insn;
>
> fprintf (file, ";; invalidated by call \t");
> ! df_print_regset (file, regs_invalidated_by_call_regset);
> fprintf (file, ";; hardware regs used \t");
> df_print_regset (file, df->hardware_regs_used);
> fprintf (file, ";; regular block artificial uses \t");
> *************** df_get_call_refs (struct df_collection_r
> *** 3391,3397 ****
> }
>
> is_sibling_call = SIBLING_CALL_P (insn_info->insn);
> ! EXECUTE_IF_SET_IN_BITMAP (df_invalidated_by_call, 0, ui, bi)
> {
> if (!global_regs[ui]
> && (!bitmap_bit_p (defs_generated, ui))
> --- 3381,3387 ----
> }
>
> is_sibling_call = SIBLING_CALL_P (insn_info->insn);
> ! EXECUTE_IF_SET_IN_BITMAP (regs_invalidated_by_call_regset, 0, ui, bi)
> {
> if (!global_regs[ui]
> && (!bitmap_bit_p (defs_generated, ui))
> *************** df_hard_reg_init (void)
> *** 4121,4128 ****
> if (initialized)
> return;
>
> - bitmap_obstack_initialize (&persistent_obstack);
> -
> /* Record which registers will be eliminated. We use this in
> mark_used_regs. */
> CLEAR_HARD_REG_SET (elim_reg_set);
> --- 4111,4116 ----
> *************** df_hard_reg_init (void)
> *** 4134,4147 ****
> SET_HARD_REG_BIT (elim_reg_set, FRAME_POINTER_REGNUM);
> #endif
>
> - df_invalidated_by_call = BITMAP_ALLOC (&persistent_obstack);
> -
> - /* Inconveniently, this is only readily available in hard reg set
> - form. */
> - for (i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
> - if (TEST_HARD_REG_BIT (regs_invalidated_by_call, i))
> - bitmap_set_bit (df_invalidated_by_call, i);
> -
> initialized = true;
> }
>
> --- 4122,4127 ----
> Index: df.h
> ===================================================================
> *** df.h (revision 142791)
> --- df.h (working copy)
> *************** struct df
> *** 762,772 ****
>
> extern bitmap_obstack df_bitmap_obstack;
>
> - /* This is a bitmap copy of regs_invalidated_by_call so that we can
> - easily add it into bitmaps, etc. */
> -
> - extern bitmap df_invalidated_by_call;
> -
>
> /* One of these structures is allocated for every basic block. */
> struct df_scan_bb_info
> --- 762,767 ----
> Index: regclass.c
> ===================================================================
> *** regclass.c (revision 142791)
> --- regclass.c (working copy)
> *************** char global_regs[FIRST_PSEUDO_REGISTER];
> *** 145,150 ****
> --- 145,160 ----
>
> HARD_REG_SET regs_invalidated_by_call;
>
> + /* Same information as REGS_INVALIDATED_BY_CALL but in regset form to be used
> + in dataflow more conveniently. */
> +
> + regset regs_invalidated_by_call_regset;
> +
> + /* The bitmap_obstack is used to hold some static variables that
> + should not be reset after each function is compiled. */
> +
> + static bitmap_obstack persistent_obstack;
> +
> /* Table of register numbers in the order in which to try to use them. */
> #ifdef REG_ALLOC_ORDER
> int reg_alloc_order[FIRST_PSEUDO_REGISTER] = REG_ALLOC_ORDER;
> *************** init_reg_sets_1 (void)
> *** 568,573 ****
> --- 578,590 ----
> CLEAR_HARD_REG_SET (call_fixed_reg_set);
> CLEAR_HARD_REG_SET (regs_invalidated_by_call);
> CLEAR_HARD_REG_SET (losing_caller_save_reg_set);
> + if (!regs_invalidated_by_call_regset)
> + {
> + bitmap_obstack_initialize (&persistent_obstack);
> + regs_invalidated_by_call_regset = ALLOC_REG_SET (&persistent_obstack);
> + }
> + else
> + CLEAR_REG_SET (regs_invalidated_by_call_regset);
>
> memcpy (call_fixed_regs, fixed_regs, sizeof call_fixed_regs);
>
> *************** init_reg_sets_1 (void)
> *** 602,608 ****
> if (i == STACK_POINTER_REGNUM)
> ;
> else if (global_regs[i])
> ! SET_HARD_REG_BIT (regs_invalidated_by_call, i);
> else if (i == FRAME_POINTER_REGNUM)
> ;
> #if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
> --- 619,628 ----
> if (i == STACK_POINTER_REGNUM)
> ;
> else if (global_regs[i])
> ! {
> ! SET_HARD_REG_BIT (regs_invalidated_by_call, i);
> ! SET_REGNO_REG_SET (regs_invalidated_by_call_regset, i);
> ! }
> else if (i == FRAME_POINTER_REGNUM)
> ;
> #if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
> *************** init_reg_sets_1 (void)
> *** 618,624 ****
> ;
> #endif
> else if (CALL_REALLY_USED_REGNO_P (i))
> ! SET_HARD_REG_BIT (regs_invalidated_by_call, i);
> }
>
> /* Preserve global registers if called more than once. */
> --- 638,647 ----
> ;
> #endif
> else if (CALL_REALLY_USED_REGNO_P (i))
> ! {
> ! SET_HARD_REG_BIT (regs_invalidated_by_call, i);
> ! SET_REGNO_REG_SET (regs_invalidated_by_call_regset, i);
> ! }
> }
>
> /* Preserve global registers if called more than once. */
> *************** globalize_reg (int i)
> *** 912,918 ****
> appropriate regs_invalidated_by_call bit, even if it's already
> set in fixed_regs. */
> if (i != STACK_POINTER_REGNUM)
> ! SET_HARD_REG_BIT (regs_invalidated_by_call, i);
>
> /* If already fixed, nothing else to do. */
> if (fixed_regs[i])
> --- 935,944 ----
> appropriate regs_invalidated_by_call bit, even if it's already
> set in fixed_regs. */
> if (i != STACK_POINTER_REGNUM)
> ! {
> ! SET_HARD_REG_BIT (regs_invalidated_by_call, i);
> ! SET_REGNO_REG_SET (regs_invalidated_by_call_regset, i);
> ! }
>
> /* If already fixed, nothing else to do. */
> if (fixed_regs[i])
> Index: df-problems.c
> ===================================================================
> *** df-problems.c (revision 142791)
> --- df-problems.c (working copy)
> *************** df_rd_local_compute (bitmap all_blocks)
> *** 443,449 ****
> }
>
> /* Set up the knockout bit vectors to be applied across EH_EDGES. */
> ! EXECUTE_IF_SET_IN_BITMAP (df_invalidated_by_call, 0, regno, bi)
> {
> if (DF_DEFS_COUNT (regno) > DF_SPARSE_THRESHOLD)
> bitmap_set_bit (sparse_invalidated, regno);
> --- 443,449 ----
> }
>
> /* Set up the knockout bit vectors to be applied across EH_EDGES. */
> ! EXECUTE_IF_SET_IN_BITMAP (regs_invalidated_by_call_regset, 0, regno, bi)
> {
> if (DF_DEFS_COUNT (regno) > DF_SPARSE_THRESHOLD)
> bitmap_set_bit (sparse_invalidated, regno);
> *************** df_lr_confluence_n (edge e)
> *** 975,981 ****
> /* ??? Abnormal call edges ignored for the moment, as this gets
> confused by sibling call edges, which crashes reg-stack. */
> if (e->flags & EDGE_EH)
> ! bitmap_ior_and_compl_into (op1, op2, df_invalidated_by_call);
> else
> bitmap_ior_into (op1, op2);
>
> --- 975,981 ----
> /* ??? Abnormal call edges ignored for the moment, as this gets
> confused by sibling call edges, which crashes reg-stack. */
> if (e->flags & EDGE_EH)
> ! bitmap_ior_and_compl_into (op1, op2, regs_invalidated_by_call_regset);
> else
> bitmap_ior_into (op1, op2);
>
> *************** df_byte_lr_alloc (bitmap all_blocks ATTR
> *** 2542,2548 ****
> df_byte_lr_expand_bitmap (problem_data->hardware_regs_used,
> df->hardware_regs_used);
> df_byte_lr_expand_bitmap (problem_data->invalidated_by_call,
> ! df_invalidated_by_call);
>
> EXECUTE_IF_SET_IN_BITMAP (df_byte_lr->out_of_date_transfer_functions, 0, bb_index, bi)
> {
> --- 2542,2548 ----
> df_byte_lr_expand_bitmap (problem_data->hardware_regs_used,
> df->hardware_regs_used);
> df_byte_lr_expand_bitmap (problem_data->invalidated_by_call,
> ! regs_invalidated_by_call_regset);
>
> EXECUTE_IF_SET_IN_BITMAP (df_byte_lr->out_of_date_transfer_functions, 0, bb_index, bi)
> {
> Index: basic-block.h
> ===================================================================
> *** basic-block.h (revision 142791)
> --- basic-block.h (working copy)
> *************** typedef bitmap_iterator reg_set_iterator
> *** 106,111 ****
> --- 106,116 ----
> #define EXECUTE_IF_AND_IN_REG_SET(REGSET1, REGSET2, MIN, REGNUM, RSI) \
> EXECUTE_IF_AND_IN_BITMAP (REGSET1, REGSET2, MIN, REGNUM, RSI) \
>
> + /* Same information as REGS_INVALIDATED_BY_CALL but in regset form to be used
> + in dataflow more conveniently. */
> +
> + extern regset regs_invalidated_by_call_regset;
> +
> /* Type we use to hold basic block counters. Should be at least
> 64bit. Although a counter cannot be negative, we use a signed
> type, because erroneous negative counts can be generated when the
>