===================================================================
@@ -118,6 +118,46 @@ init_recog (void)
}
+/* Return true if labels in asm operands BODY are LABEL_REFs. */
+
+static bool
+asm_labels_ok (rtx body)
+{
+ rtx first, asmop = NULL;
+ int i;
+
+ if (asm_noperands (body) <= 0)
+ return true;
+
+ switch (GET_CODE (body))
+ {
+ case ASM_OPERANDS:
+ asmop = body;
+ break;
+
+ case SET:
+ asmop = SET_SRC (body);
+ break;
+
+ case PARALLEL:
+ first = XVECEXP (body, 0, 0);
+ if (GET_CODE (first) != SET)
+ return true;
+ asmop = SET_SRC (first);
+ break;
+ default:
+ gcc_unreachable ();
+ break;
+ }
+
+ gcc_assert (GET_CODE (asmop) == ASM_OPERANDS);
+
+ for (i = 0; i < ASM_OPERANDS_LABEL_LENGTH (asmop); i++)
+ if (GET_CODE (ASM_OPERANDS_LABEL (asmop, i)) != LABEL_REF)
+ return false;
+ return true;
+}
+
/* Check that X is an insn-body for an `asm' with operands
and that the operands mentioned in it are legitimate. */
@@ -129,6 +169,9 @@ check_asm_operands (rtx x)
const char **constraints;
int i;
+ if (!asm_labels_ok (x))
+ return 0;
+
/* Post-reload, be more strict with things. */
if (reload_completed)
{