How to update reg_dead notes

Kenneth Zadeck zadeck@naturalbridge.com
Tue Feb 24 13:11:00 GMT 2015


It is generally as easy as just adding the problem and calling 
df_analyze.  You tend to get into trouble if the rtl is not good, i.e. 
there is improper sharing or other violations of the canonical rtl 
rules.  DF does not like improperly shared rtl and it has not been 
uncommon for port specific passes to play loose with these rules.   I 
would suggest that first you try a build where you turn on all of the 
rtl checking and see if that comes out clean.

Kenny

On 02/24/2015 06:41 AM, Georg-Johann Lay wrote:
> Hi, in order to fix PR64331 I tried to implement new target-specific 
> passes whose sole purpose is to recompute REG_DEAD notes.
>
> The avr BE relies on correct dead notes which are used in 
> avr.c:reg_unused_after which uses dead_or_set_p.  avr BE needs correct 
> dead notes in ADJUST_INSN_LENGTH, get_attr_length, 
> get_attr_min_length, etc.
>
> After trying for more than one day I am really frustrated; each 
> approach ended up in seg_faults somewhere in df.
>
> Following the source comments in df-core.c, recomputing dead notes 
> should be as easy as
>
>
>   df_note_add_problem ();
>   df_analyze ();
>
> in the execute() method of the new pass.
>
>
> As this (and many many other tries using df_scan_alloc, df_scan_blocks 
> df_finish_pass, df_insn_rescan_all, etc.) always crashes the compiler, 
> I must do something completely wrong...
>
> Could you give me some advice on correct usage of df or even more 
> preferred point me to a comprehensible documentation of df which is 
> more complete than in df-core.c?
>
> Internals don't treat df, and the source comments are not really 
> helpful, e.g. the complete documentation of df_analyze is /* Analyze 
> dataflow info.  */.  Not a single word about prerequisites (except 
> that it must run after df_init and before df_finish and needs correct 
> cfg).
>
> One example of a crash is that df->insns[uid] is being accessed and 
> dereferenced where uid is a valid uid but df->insns[uid] is NULL.
>
> df-core.c mentions "given instances of df".  How do I get one? The 
> only instance I can find is the global struct df_f *df.  Does this 
> mean one has to mess around with that global variable?
>
>



More information about the Gcc mailing list