This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: TMSC320C6x port: return label is being deleted


Graham Stott wrote:

Hi,

--- Adrian Strätling <adrian.straetling@cs.tu-chemnitz.de> wrote:

can I somehow attach the label to the call insn, so that the output function can get the label number and print it?


Not you are looking at it from the wrong angle.



I tried:
"
insn = gen_rtx_CALL (VOIDmode, mem, const0_rtx);
emit_call_insn(insn);
emit_label(ret_label);
REG_NOTES (insn) = gen_rtx_INSN_LIST (REG_LABEL, ret_label, REG_NOTES(insn));
LABEL_NUSES(ret_label)++;
"


You don't need/want all the stuff after after your emit_call_insn



which results in RTL:
"
(insn 17 15 18 2 (set (mem:SI (pre_dec:SI (reg/f:SI 47 b15)) [0 S4 A32])
       (label_ref:SI 19)) -1 (nil)
   (insn_list:REG_LABEL 19 (nil)))

(call_insn 18 17 19 2 (call (mem:QI (symbol_ref:SI ("nop") [flags 0x3] <function_decl 0x401d45e4 nop>) [0 S1 A8])
(const_int 0 [0x0])) -1 (nil)
(expr_list:REG_EH_REGION (const_int 0 [0x0])
(nil))
(nil))


(code_label 19 18 34 3 5 "" [1 uses])
"

It seems I have to emit the label to get the REFs right.
However, I miss the the "REG_LABEL  19" in the insn list of the call insn.

Another approach would be to walk the dependency list at the time of output, but I'd rather prefer the first one.


No you are making life hard for yourself it;s much easier that you think
do it all in your define_insn for the call.

In your define_insn for your call you use something like.
(define_insn "..."
 []
 ""
{
 rtx label = gen_label_rtx ();

 output your call sequence
 ..

now output the label
return "";
}


See how the rest of the compiler doesn't know or care
about these labels.



Thanks.
This is a solution for the problem, but I'd really like to find a better (faster) one.
Pleas, let me explain why I do not really want to do it that way. :)


This call sequence would look like:
  mvkl   L5   a0      ; move low part of return address
|| mvkl   foo  b0      ; move low part of function address
  mvkh   L5   a0      ; move high part of return address
|| mvkh   foo  b0      ; move high part of function address
  b      b0           ; call function
  stw    a0   *--b15  ; push return address onto stack (delay slot 1)
  nop    4            ; delay slots 2 - 5  (banch has 5)
L5:

This is the shortest sequence I can momentarily think of (6 insns, 8 cycles).
The architecture theoretically supports 8 parallel insns (||) per cycle (that makes 64 possible instructions instead of the 6). If all instructions are separate rtl insn, the scheduler can group them in a way so that more than one task can be done simultaneously, though of course there are a lot of constraints.


If I follow my previous thoughts, I need a way to tag information to particular insns, preferably a buit-in one.

I would also like passing some scheduling details and I guessed I could do that similarly. For instance: The cpu_unit the scheduler assigns to each insn should appear in the output. If that would not be possible, I had to recalculate this units myself, as the assembler I wrote does not do that either.
A possible solution would be to build up a private data structure of some kind to connect the needed info to the UID of the insn, but I would prefer an easier way.


Thanks for your patience ;-)

greets,
Adrian




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]