How to update reg_dead notes
Georg-Johann Lay
avr@gjlay.de
Tue Feb 24 15:59:00 GMT 2015
Am 02/24/2015 um 02:11 PM schrieb Kenneth Zadeck:
> 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?
Hi, thanks for answering.
> 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.
Currently there are no port-specific passes. The only port-specific passes are
the new passes which I am trying to add in order to keep REG_DEAD notes up to date.
> 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
Okay, here we go. I configured avr-gcc from recent 4.9-branch with
--enable-checking=all on x86-linux-gnu:
$ ../../gcc.gnu.org/gcc-4_9-branch/configure --target=avr
--prefix=/local/gnu/install/gcc-4.9 --disable-nls --with-dwarf2
--enable-target-optspace=yes --with-gnu-ld --with-gnu-as
--enable-languages=c,c++ --enable-checking=all
The passes are added by means of the attached patch and installed right before
passes which might use avr.c:reg_unused_after, i.e. passes that query for
(minimum) insn lengths: .bbro, .compgotos, .shorten and .final.
The compiler crashes when it builds libgcc. The test case is attached as
libgcc2-addvsi3.c and compiled as
$ path-to-xgcc/xgcc -B path-to-xgcc -S libgcc2-addvsi3.c
The crash message (same with optimization) is for the pass which has been added
just before .shorten:
libgcc2-addvsi3.c: In function '__addvhi3':
libgcc2-addvsi3.c:1514:1: internal compiler error: in df_refs_verify, at
df-scan.c:4323
}
^
0x82dfe8a df_refs_verify
../../../gcc.gnu.org/gcc-4_9-branch/gcc/df-scan.c:4323
0x82e7b34 df_insn_refs_verify
../../../gcc.gnu.org/gcc-4_9-branch/gcc/df-scan.c:4414
0x82e9906 df_bb_verify
../../../gcc.gnu.org/gcc-4_9-branch/gcc/df-scan.c:4441
0x82e9d8e df_scan_verify()
../../../gcc.gnu.org/gcc-4_9-branch/gcc/df-scan.c:4573
0x82d3787 df_verify()
../../../gcc.gnu.org/gcc-4_9-branch/gcc/df-core.c:1862
0x82d3809 df_analyze_1
../../../gcc.gnu.org/gcc-4_9-branch/gcc/df-core.c:1250
0x896188b avr_pass_recompute_notes::execute()
../../../gcc.gnu.org/gcc-4_9-branch/gcc/config/avr/avr.c:317
Please submit a full bug report,
Johann
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add-dead-notes-passes.diff
Type: text/x-patch
Size: 3899 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20150224/48705d80/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libgcc2-addvsi3.c
Type: text/x-csrc
Size: 41897 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20150224/48705d80/attachment-0001.bin>
More information about the Gcc
mailing list