return NULL_RTX;
}
\f
-/* Return an indication of which type of insn should have X as a body.
- The value is CODE_LABEL, INSN, CALL_INSN or JUMP_INSN. */
-
-static enum rtx_code
-classify_insn (rtx x)
-{
- if (LABEL_P (x))
- return CODE_LABEL;
- if (GET_CODE (x) == CALL)
- return CALL_INSN;
- if (ANY_RETURN_P (x))
- return JUMP_INSN;
- if (GET_CODE (x) == SET)
- {
- if (SET_DEST (x) == pc_rtx)
- return JUMP_INSN;
- else if (GET_CODE (SET_SRC (x)) == CALL)
- return CALL_INSN;
- else
- return INSN;
- }
- if (GET_CODE (x) == PARALLEL)
- {
- int j;
- for (j = XVECLEN (x, 0) - 1; j >= 0; j--)
- if (GET_CODE (XVECEXP (x, 0, j)) == CALL)
- return CALL_INSN;
- else if (GET_CODE (XVECEXP (x, 0, j)) == SET
- && SET_DEST (XVECEXP (x, 0, j)) == pc_rtx)
- return JUMP_INSN;
- else if (GET_CODE (XVECEXP (x, 0, j)) == SET
- && GET_CODE (SET_SRC (XVECEXP (x, 0, j))) == CALL)
- return CALL_INSN;
- }
- return INSN;
-}
-
/* Emit the rtl pattern X as an appropriate kind of insn.
If X is a label, it is simply added into the insn chain. */
}
printf (")");
}
+
+/* Output code to emit the instruction patterns in VEC, with each element
+ becoming a separate instruction. USED is as for gen_exp. */
+
+static void
+gen_emit_seq (rtvec vec, char *used)
+{
+ for (int i = 0, len = GET_NUM_ELEM (vec); i < len; ++i)
+ {
+ rtx next = RTVEC_ELT (vec, i);
+ printf (" %s (", get_emit_function (next));
+ gen_exp (next, DEFINE_EXPAND, used);
+ printf (");\n");
+ if (needs_barrier_p (next))
+ printf (" emit_barrier ();");
+ }
+}
\f
/* Generate the `gen_...' function for a DEFINE_INSN. */
printf (" }\n");
}
- /* Output code to construct the rtl for the instruction bodies.
- Use emit_insn to add them to the sequence being accumulated.
- But don't do this if the user's code has set `no_more' nonzero. */
-
used = XCNEWVEC (char, stats.num_operand_vars);
-
- for (i = 0; i < XVECLEN (expand, 1); i++)
- {
- rtx next = XVECEXP (expand, 1, i);
- if ((GET_CODE (next) == SET && GET_CODE (SET_DEST (next)) == PC)
- || (GET_CODE (next) == PARALLEL
- && ((GET_CODE (XVECEXP (next, 0, 0)) == SET
- && GET_CODE (SET_DEST (XVECEXP (next, 0, 0))) == PC)
- || ANY_RETURN_P (XVECEXP (next, 0, 0))))
- || ANY_RETURN_P (next))
- printf (" emit_jump_insn (");
- else if ((GET_CODE (next) == SET && GET_CODE (SET_SRC (next)) == CALL)
- || GET_CODE (next) == CALL
- || (GET_CODE (next) == PARALLEL
- && GET_CODE (XVECEXP (next, 0, 0)) == SET
- && GET_CODE (SET_SRC (XVECEXP (next, 0, 0))) == CALL)
- || (GET_CODE (next) == PARALLEL
- && GET_CODE (XVECEXP (next, 0, 0)) == CALL))
- printf (" emit_call_insn (");
- else if (LABEL_P (next))
- printf (" emit_label (");
- else if (GET_CODE (next) == MATCH_OPERAND
- || GET_CODE (next) == MATCH_DUP
- || GET_CODE (next) == MATCH_OPERATOR
- || GET_CODE (next) == MATCH_OP_DUP
- || GET_CODE (next) == MATCH_PARALLEL
- || GET_CODE (next) == MATCH_PAR_DUP
- || GET_CODE (next) == PARALLEL)
- printf (" emit (");
- else
- printf (" emit_insn (");
- gen_exp (next, DEFINE_EXPAND, used);
- printf (");\n");
- if (GET_CODE (next) == SET && GET_CODE (SET_DEST (next)) == PC
- && GET_CODE (SET_SRC (next)) == LABEL_REF)
- printf (" emit_barrier ();");
- }
-
+ gen_emit_seq (XVEC (expand, 1), used);
XDELETEVEC (used);
/* Call `get_insns' to extract the list of all the
printf (" (void) operand%d;\n", i);
}
- /* Output code to construct the rtl for the instruction bodies.
- Use emit_insn to add them to the sequence being accumulated.
- But don't do this if the user's code has set `no_more' nonzero. */
-
- for (i = 0; i < XVECLEN (split, 2); i++)
- {
- rtx next = XVECEXP (split, 2, i);
- if ((GET_CODE (next) == SET && GET_CODE (SET_DEST (next)) == PC)
- || (GET_CODE (next) == PARALLEL
- && GET_CODE (XVECEXP (next, 0, 0)) == SET
- && GET_CODE (SET_DEST (XVECEXP (next, 0, 0))) == PC)
- || ANY_RETURN_P (next))
- printf (" emit_jump_insn (");
- else if ((GET_CODE (next) == SET && GET_CODE (SET_SRC (next)) == CALL)
- || GET_CODE (next) == CALL
- || (GET_CODE (next) == PARALLEL
- && GET_CODE (XVECEXP (next, 0, 0)) == SET
- && GET_CODE (SET_SRC (XVECEXP (next, 0, 0))) == CALL)
- || (GET_CODE (next) == PARALLEL
- && GET_CODE (XVECEXP (next, 0, 0)) == CALL))
- printf (" emit_call_insn (");
- else if (LABEL_P (next))
- printf (" emit_label (");
- else if (GET_CODE (next) == MATCH_OPERAND
- || GET_CODE (next) == MATCH_OPERATOR
- || GET_CODE (next) == MATCH_PARALLEL
- || GET_CODE (next) == MATCH_OP_DUP
- || GET_CODE (next) == MATCH_DUP
- || GET_CODE (next) == PARALLEL)
- printf (" emit (");
- else
- printf (" emit_insn (");
- gen_exp (next, GET_CODE (split), used);
- printf (");\n");
- if (GET_CODE (next) == SET && GET_CODE (SET_DEST (next)) == PC
- && GET_CODE (SET_SRC (next)) == LABEL_REF)
- printf (" emit_barrier ();");
- }
+ gen_emit_seq (XVEC (split, 2), used);
/* Call `get_insns' to make a list of all the
insns emitted within this gen_... function. */
return 1;
}
+/* Return an indication of which type of insn should have X as a body.
+ In generator files, this can be UNKNOWN if the answer is only known
+ at (GCC) runtime. Otherwise the value is CODE_LABEL, INSN, CALL_INSN
+ or JUMP_INSN. */
+
+enum rtx_code
+classify_insn (rtx x)
+{
+ if (LABEL_P (x))
+ return CODE_LABEL;
+ if (GET_CODE (x) == CALL)
+ return CALL_INSN;
+ if (ANY_RETURN_P (x))
+ return JUMP_INSN;
+ if (GET_CODE (x) == SET)
+ {
+ if (GET_CODE (SET_DEST (x)) == PC)
+ return JUMP_INSN;
+ else if (GET_CODE (SET_SRC (x)) == CALL)
+ return CALL_INSN;
+ else
+ return INSN;
+ }
+ if (GET_CODE (x) == PARALLEL)
+ {
+ int j;
+ for (j = XVECLEN (x, 0) - 1; j >= 0; j--)
+ if (GET_CODE (XVECEXP (x, 0, j)) == CALL)
+ return CALL_INSN;
+ else if (GET_CODE (XVECEXP (x, 0, j)) == SET
+ && GET_CODE (SET_DEST (XVECEXP (x, 0, j))) == PC)
+ return JUMP_INSN;
+ else if (GET_CODE (XVECEXP (x, 0, j)) == SET
+ && GET_CODE (SET_SRC (XVECEXP (x, 0, j))) == CALL)
+ return CALL_INSN;
+ }
+#ifdef GENERATOR_FILE
+ if (GET_CODE (x) == MATCH_OPERAND
+ || GET_CODE (x) == MATCH_OPERATOR
+ || GET_CODE (x) == MATCH_PARALLEL
+ || GET_CODE (x) == MATCH_OP_DUP
+ || GET_CODE (x) == MATCH_DUP
+ || GET_CODE (x) == PARALLEL)
+ return UNKNOWN;
+#endif
+ return INSN;
+}
+
void
dump_rtx_statistics (void)
{