Hello,

I'm trying to get to a point where the CFG is useable even in the
delay-slot filling pass (dbr_schedule) and I'm currently stuck on a
transformation that the PA port does if -mno-big-switch is in effect.

With !TARGET_BIG_SWITCH, the PA port "explodes" a JUMP_TABLE_DATA to
real code, i.e. actual jumps (see the example at the end of this
mail).

The problem is that the new code with the explicit jumps is not inside
a basic block: It's substituted in the place where the JUMP_TABLE_DATA
rtx was. It is important to maintain this exact order of the code
because the casesi0 jump_insn is not a jump to a label but a jump to
an absolute distance measured from the CODE_LABEL before the
JUMP_TABLE_DATA, so the length of the explicit jump_insns must be
constant.

I have no idea how to maintain the CFG and "freeze" the exploded code
to protect it from being changed by following passes. Having the code
not inside basic blocks breaks verify_flow_info, and hides the insns
that fill the delay slots from the DF machinery and from the analysis
code in sched-deps.c.

Exploding the jump tables only happens with !TARGET_BIG_SWITCH. The
reason to explode the jump table is because it makes the delay slots
of the explicit jump_insns visible to the dbr_schedule pass.

But TARGET_BIG_SWITCH has been the default since GCC 4.0, see
http://gcc.gnu.org/ml/gcc-patches/2004-02/msg02401.html

Are there any reasons against removing !TARGET_BIG_SWITCH support? It
would really help if this code can go away...

Ciao!
Steven



from the .expand dump:
(note 317 8 9 4 [bb 4] NOTE_INSN_BASIC_BLOCK)
(jump_insn 9 317 10 4 (set (pc)
        (mem:SI (plus:SI (mult:SI (reg:SI 97)
                    (const_int 4 [0x4]))
                (label_ref 10)) [0 S4 A32])) t.c:15 -1
     (nil)
 -> 10)
(code_label 10 9 11 4 "" [1 uses])
(jump_table_data 11 10 12 (addr_vec:DI [
            (label_ref:SI 13)
            (label_ref:SI 16)
            (label_ref:SI 19)
            (label_ref:SI 22)
            (label_ref:SI 25)
            (label_ref:SI 28)
            (label_ref:SI 31)
...
            (label_ref:SI 307)
            (label_ref:SI 310)
        ]))
(barrier 12 11 13)


After the machine dependent reorg patch:

(note 317 8 9 [bb 3] NOTE_INSN_BASIC_BLOCK)
(jump_insn 9 317 10 (set (pc)
        (mem:SI (plus:SI (mult:SI (reg:SI 26 %r26 [97])
                    (const_int 4 [0x4]))
                (label_ref 10)) [0 S4 A32])) t.c:15 193 {casesi0}
     (expr_list:REG_DEAD (reg:SI 26 %r26 [97])
        (nil))
 -> 10)
(code_label 10 9 328 4 "" [1 uses])
(insn 328 10 329 (const_int 1 [0x1]) 212 {begin_brtab}
     (nil))
(code_label 329 328 330 104 "" [1 uses])
(jump_insn 330 329 331 (parallel [
            (set (pc)
                (label_ref 13))
            (const_int 0 [0])
        ]) 192 {short_jump}
     (nil)
 -> 13)
(barrier 331 330 332)
(code_label 332 331 333 105 "" [1 uses])
(jump_insn 333 332 334 (parallel [
            (set (pc)
                (label_ref 16))
            (const_int 0 [0])
        ]) 192 {short_jump}
     (nil)
 -> 16)
(barrier 334 333 335)
...
(barrier 625 624 626)
(code_label 626 625 627 203 "" [1 uses])
(jump_insn 627 626 629 (parallel [
            (set (pc)
                (label_ref 310))
            (const_int 0 [0])
        ]) 192 {short_jump}
     (nil)
 -> 310)
(insn 629 627 628 (const_int 2 [0x2]) 213 {end_brtab}
     (nil))

Reply via email to