How to generate jump_table_data in rtl optimizers
Jeff Law
law@redhat.com
Mon Nov 9 09:10:00 GMT 2015
On 11/08/2015 11:20 PM, Bin.Cheng wrote:
> Hi,
> I used below code snippet to generate jump_table_data:
>
> //setup label refs
> start_sequence ();
> emit_jump_table_data(gen_rtx_
> ADDR_DIFF_VEC (CASE_VECTOR_MODE,
>
> base_label_ref,
>
> label_refs...))
> insns = get_insns ();
> end_sequence ();
> split_edge_and_insert (edge, insns);
Don't put it onto a sequence and see if that helps.
>
> But later on GCC exited with below error message:
>
> xxx.c:15:1: error: unrecognizable insn:
> }
> ^
> (insn 187 109 113 3 (jump_table_data 185 0 0 (addr_diff_vec:DI
> (label_ref:DI 184)
> [
> (label_ref:DI 178)
> (label_ref:DI 179)
> (label_ref:DI 180)
> (label_ref:DI 181)
> (label_ref:DI 182)
> (label_ref:DI 183)
> (label_ref:DI 184)
> ]
> (const_int 0 [0])
> (const_int 0 [0]))) -1
> (nil))
> xxx.c:15:1: internal compiler error: in extract_insn, at recog.c:2286
You don't want the outer insn.
>
> Seems what GCC expecting is as below:
>
> (jump_table_data 185 0 0 (addr_diff_vec:DI (label_ref:DI 184)
> [
> (label_ref:DI 178)
> (label_ref:DI 179)
> (label_ref:DI 180)
> (label_ref:DI 181)
> (label_ref:DI 182)
> (label_ref:DI 183)
> (label_ref:DI 184)
> ]
> (const_int 0 [0])
> (const_int 0 [0])))
Right.
/
>
> The outer insn structure is created in emit_insn_after and make_insn_raw.
>
> I looked into stmt.c:emit_case_dispatch_table, seems GCC used
> record_insns there, and it only inserts insn to list, and does not
> create the outer insn structure.
>
> Since record_insns/record_insns_nobb are deprecated according to
> comments, my question is how to generate jump_table_data then? Is
> jump_table_data not supported in emit_insn_*?
I presume you mean reorder_insns not record_insns :-)
I'd start by using reorder_insns to make sure you have your other logic
right, then look to eliminate its use.
jeff
More information about the Gcc
mailing list