summaryrefslogtreecommitdiff
path: root/gcc/rtl.c
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2015-06-14 20:25:40 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2015-06-14 20:25:40 +0000
commit03acb8618fa6dd16a19776a6758f22e861a6987e (patch)
tree5c9473ab1cc9660cc825b2a8b95569ab4d1e7cc6 /gcc/rtl.c
parent3896580a552e4d1531193a987446598d47938c4a (diff)
downloadgcc-03acb8618fa6dd16a19776a6758f22e861a6987e.tar.gz
gcc/
* rtl.h (classify_insn): Declare. * emit-rtl.c (classify_insn): Move to... * rtl.c: ...here and add generator support. * gensupport.h (get_emit_function, needs_barrier_p): Declare. * gensupport.c (get_emit_function, needs_barrier_p): New functions. * genemit.c (gen_emit_seq): New function. (gen_expand, gen_split): Use it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@224470 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/rtl.c')
-rw-r--r--gcc/rtl.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/gcc/rtl.c b/gcc/rtl.c
index 6341b69c60d..346155e9faf 100644
--- a/gcc/rtl.c
+++ b/gcc/rtl.c
@@ -657,6 +657,54 @@ rtx_equal_p (const_rtx x, const_rtx y)
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)
{