This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
TMSC320C6x port: return label is being deleted
- From: Adrian Strätling<adrian dot straetling at cs dot tu-chemnitz dot de>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 14 Sep 2004 17:55:17 +0200
- Subject: TMSC320C6x port: return label is being deleted
Hi all,
I'm currently trying to optimize a gcc port for the TI TMS320C6x chips.
My predecessor in this task built a port for gcc 3.3. I updated it to
the 3.5 version to benefit from general development.
Now I have the following problem:
This architecture does not have a specific call instruction, so we had
to produce the following code:
"
push ret_label
move b_label, breg
branch breg
ret_label:
...
"
so the callee can pop the return address from the stack and jump there.
In gcc version 3.3 after jump optimization 'ret_label' is present as a
CODE_LABEL_DELETED_INSN,
but in version 3.5 I can't find it
3.3:
"
(insn 19 17 20 0 0x4021bf78 (set:SI (reg/f:SI 0 a0 [72])
(label_ref:SI [23 deleted])) 0 {movsi} (nil)
(insn_list:REG_LABEL 23 (nil)))
(insn 20 19 21 0 0x4021bf78 (set:SI (reg/f:SI 47 b15)
(plus:SI (reg/f:SI 47 b15)
(const_int -4 [0xfffffffc]))) 5 {*addsi3_prologue} (nil)
(nil))
(insn 21 20 48 0 0x4021bf78 (set:SI (mem:SI (reg/f:SI 47 b15) [0 S4 A32])
(reg/f:SI 0 a0 [72])) 0 {movsi} (nil)
(nil))
(insn 48 21 22 0 (nil) (set (reg:SI 0 a0)
(symbol_ref:SI ("nop"))) 0 {movsi} (nil)
(nil))
(call_insn 22 48 23 0 0x4021bf78 (call (mem:QI (reg:SI 0 a0) [0 S1 A8])
(const_int 0 [0x0])) 3 {*call_internal} (nil)
(expr_list:REG_EH_REGION (const_int 0 [0x0])
(nil))
(nil))
(note 23 22 27 0 "" NOTE_INSN_DELETED_LABEL 5)
"
3.5
"
(insn 41 15 17 1 (set (reg:SI 36 b4)
(label_ref:SI 19)) 2 {*movsi_big} (nil)
(nil))
(insn 17 41 42 1 (set (mem:SI (pre_dec:SI (reg/f:SI 47 b15)) [0 S4 A32])
(reg:SI 36 b4)) 3 {movsi} (nil)
(insn_list:REG_LABEL 19 (nil)))
(insn 42 17 18 1 (set (reg:SI 36 b4)
(symbol_ref:SI ("nop") [flags 0x3] <function_decl 0x402965e4
nop>)) 2 {*movsi_big} (nil)
(nil))
(call_insn 18 42 21 1 (call (mem:QI (reg:SI 36 b4) [0 S1 A8])
(const_int 0 [0x0])) 6 {*call_internal} (nil)
(expr_list:REG_EH_REGION (const_int 0 [0x0])
(nil))
(nil))
"
The differences in 'push' are the result of other changes. I don't think
they matter here.
I have been able to avoid the deletion of the label by changing:
"emit_label (ret_label);"
into
"LABEL_PRESERVE_P( emit_label (ret_label) ) = 1;"
but on the one hand I don't think that's the way it has been meant (no
one else does so) and on the other it only works without optimization.
The scheduler would move the label next to the function label. I guess
it handles it not as a code_label but as a note when it does so.
Does anyone know a solution to this?
Thanks in advance,
greets,
Adrian Strätling