JUMP_LABEL(X) is not always an insn, but often is.  Add a variant that
adds a checked cast.

gcc/
        * rtl.h (JUMP_LABEL_AS_INSN): New.
---
 gcc/rtl.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/rtl.h b/gcc/rtl.h
index 1f1caaf..7a8e592 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1681,6 +1681,11 @@ enum label_kind
    be set to simple_return_rtx, a SIMPLE_RETURN.  */
 #define JUMP_LABEL(INSN)   XCEXP (INSN, 7, JUMP_INSN)
 
+inline rtx_insn *JUMP_LABEL_AS_INSN (rtx_insn *insn)
+{
+  return as_a_nullable <rtx_insn *> (JUMP_LABEL (insn));
+}
+
 /* Once basic blocks are found, each CODE_LABEL starts a chain that
    goes through all the LABEL_REFs that jump to that label.  The chain
    eventually winds up at the CODE_LABEL: it is circular.  */
-- 
1.8.5.3

Reply via email to