How to update reg_dead notes

Kenneth Zadeck zadeck@naturalbridge.com
Wed Feb 25 19:05:00 GMT 2015


it is a good policy to do a run with full checking every once in a 
while.   it is easy to have some garbage sneak in.    df is particularly 
sensitive to bad rtl so that was my first suggestion.    i had forgotten 
that df (as well as a lot of the infrastructure) does not work very late.
On 02/25/2015 01:54 PM, Georg-Johann Lay wrote:
> Am 02/24/2015 um 07:33 PM schrieb Kenneth Zadeck:
>> when i suggested that you do a build with all of the checking turned 
>> on, i
>> wanted you to this without you new code in it.    there is a good 
>> possibility
>> that the problem is that your port is generating bad rtl.
>
> Ah, ok.  This actually revealed an ice-checking; but that was not 
> related to the df problems...
>
> I think the problem was that I tried to run passes needing df after 
> free_cfg.
>
> My current solution works so far: It fixes the test case (correct code 
> + insn lengths) and it did not ICE up to now.
>
> Stuff is running a bit slow with all checks on so building and running 
> tests will take a while...
>
> FYI, you find my current patch attached.
>
> Thanks for your help and time,
>
> Johann
>
>
>
> Index: config/avr/avr.c
> ===================================================================
> --- config/avr/avr.c    (revision 220963)
> +++ config/avr/avr.c    (working copy)
> @@ -51,6 +51,8 @@
>  #include "target-def.h"
>  #include "params.h"
>  #include "df.h"
> +#include "context.h"
> +#include "tree-pass.h"
>
>  /* Maximal allowed offset for an address in the LD command */
>  #define MAX_LD_OFFSET(MODE) (64 - (signed)GET_MODE_SIZE (MODE))
> @@ -285,6 +287,58 @@ avr_to_int_mode (rtx x)
>  }
>
>
> +static const pass_data avr_pass_data_recompute_notes =
> +{
> +  RTL_PASS, /* type */
> +  "avr-xx", /* name (will be patched) */
> +  OPTGROUP_NONE, /* optinfo_flags */
> +  false, /* has_gate */
> +  true, /* has_execute */
> +  TV_DF_SCAN, /* tv_id */
> +  0, /* properties_required */
> +  0, /* properties_provided */
> +  0, /* properties_destroyed */
> +  0, /* todo_flags_start */
> +  (TODO_df_finish | TODO_verify_rtl_sharing
> +   | TODO_verify_flow ), /* todo_flags_finish */
> +};
> +
> +
> +class avr_pass_recompute_notes : public rtl_opt_pass
> +{
> +public:
> +  avr_pass_recompute_notes (gcc::context *ctxt, const char *pass_name)
> +    : rtl_opt_pass (avr_pass_data_recompute_notes, ctxt)
> +  {
> +    name = pass_name;
> +  }
> +
> +  unsigned int execute ()
> +  {
> +    df_note_add_problem ();
> +    df_analyze ();
> +
> +    return 0;
> +  }
> +}; // avr_pass_recompute_notes
> +
> +
> +static void
> +avr_register_passes (void)
> +{
> +  /* This avr-specific pass (re)computes insn notes, in particular 
> REG_DEAD
> +     notes which are used by `avr.c::reg_unused_after' and branch offset
> +     computations.  These notes must be correct, i.e. there must be no
> +     dangling REG_DEAD notes; otherwise wrong code might result, cf. 
> PR64331.
> +
> +     DF needs (correct) CFG, hence right before free_cfg is the last
> +     opportunity to rectify notes.  */
> +
> +  register_pass (new avr_pass_recompute_notes (g, "avr-notes-free-cfg"),
> +                 PASS_POS_INSERT_BEFORE, "*free_cfg", 1);
> +}
> +
> +
>  /* Implement `TARGET_OPTION_OVERRIDE'.  */
>
>  static void
> @@ -346,6 +400,11 @@ avr_option_override (void)
>    init_machine_status = avr_init_machine_status;
>
>    avr_log_set_avr_log();
> +
> +  /* Register some avr-specific pass(es).  There is no canonical 
> place for
> +     pass registration.  This function is convenient.  */
> +
> +  avr_register_passes ();
>  }
>
>  /* Function to set up the backend function structure.  */
>



More information about the Gcc mailing list