On Mon, Nov 9, 2015 at 2:20 PM, Bin.Cheng <amker.ch...@gmail.com> 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); > > 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 > > 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]))) > > 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_*?
Seems we need to handle JUMP_TABLE_DATA in emit_pattern_after_noloc explicitly. Anyway jump_table_data is used as an "insn". Thanks, bin