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]

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


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