This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
How to take the address of a label_ref?
- From: Adrian von Bidder <avbidder at acter dot ch>
- To: gcc <gcc at gcc dot gnu dot org>
- Date: Wed, 21 Nov 2001 08:37:50 +0100
- Subject: How to take the address of a label_ref?
Heyho!
[arm backend, though I'd think there'd be a general solution]
How do I, in the machine description, get the address of a label_ref
near the pc into a register?
(set (match_dup 1) (label_ref (match_operand 0 "" ""))) is probably not
valid - it gives an unrecognized pattern on ARM. So I defined
(define_insn "*thumb_adr"
[(set (match_operand:SI 0 "s_register_operand" "=l")
(label_ref (match_operand 1 "" "")))]
"TARGET_THUMB"
"adr\\t%0, %a1"
[(set_attr "length" "2")]
)
to catch this. Being still very new to gcc hacking I wonder if this is
ther Right Way[td] to do this. I saw there is a addressof, but this
seems to take only memory references, not labels.
greets from Zürich
-- vbi