How to update reg_dead notes

Georg-Johann Lay avr@gjlay.de
Tue Feb 24 11:41:00 GMT 2015


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