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.