Commit 6b8068d6 by Trevor Saunders Committed by Trevor Saunders

remove some usage of expr_list from read_rtx

gcc/ChangeLog:

2015-07-12  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* gensupport.c (rtx_handle_directive): Adjust.
	* read-rtl.c (apply_iterators): Take vector to add rtxs to
	instead of expr list rtx.
	(add_define_attr_for_define_subst): Likewise.
	(add_define_subst_attr): Likewise.
	(read_subst_mapping): Likewise.
	(read_rtx): Likewise.
	* rtl.h (read_rtx): Adjust.

From-SVN: r225833
parent 0467e3eb
2015-07-12 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
* gensupport.c (rtx_handle_directive): Adjust.
* read-rtl.c (apply_iterators): Take vector to add rtxs to
instead of expr list rtx.
(add_define_attr_for_define_subst): Likewise.
(add_define_subst_attr): Likewise.
(read_subst_mapping): Likewise.
(read_rtx): Likewise.
* rtl.h (read_rtx): Adjust.
2015-07-15 Kyrylo Tkachov <kyrylo.tkachov@arm.com> 2015-07-15 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* config/aarch64/aarch64.md (*csinc2<mode>_insn): Use cinc mnemonic. * config/aarch64/aarch64.md (*csinc2<mode>_insn): Use cinc mnemonic.
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "errors.h" #include "errors.h"
#include "read-md.h" #include "read-md.h"
#include "gensupport.h" #include "gensupport.h"
#include "vec.h"
#define MAX_OPERANDS 40 #define MAX_OPERANDS 40
...@@ -2248,11 +2249,14 @@ process_define_subst (void) ...@@ -2248,11 +2249,14 @@ process_define_subst (void)
static void static void
rtx_handle_directive (int lineno, const char *rtx_name) rtx_handle_directive (int lineno, const char *rtx_name)
{ {
rtx queue, x; auto_vec<rtx, 32> subrtxs;
if (!read_rtx (rtx_name, &subrtxs))
return;
if (read_rtx (rtx_name, &queue)) rtx x;
for (x = queue; x; x = XEXP (x, 1)) unsigned int i;
process_rtx (XEXP (x, 0), lineno); FOR_EACH_VEC_ELT (subrtxs, i, x)
process_rtx (x, lineno);
} }
/* Comparison function for the mnemonic hash table. */ /* Comparison function for the mnemonic hash table. */
......
...@@ -506,7 +506,7 @@ add_current_iterators (void **slot, void *data ATTRIBUTE_UNUSED) ...@@ -506,7 +506,7 @@ add_current_iterators (void **slot, void *data ATTRIBUTE_UNUSED)
Build a list of expanded rtxes in the EXPR_LIST pointed to by QUEUE. */ Build a list of expanded rtxes in the EXPR_LIST pointed to by QUEUE. */
static void static void
apply_iterators (rtx original, rtx *queue) apply_iterators (rtx original, vec<rtx> *queue)
{ {
unsigned int i; unsigned int i;
const char *condition; const char *condition;
...@@ -519,8 +519,7 @@ apply_iterators (rtx original, rtx *queue) ...@@ -519,8 +519,7 @@ apply_iterators (rtx original, rtx *queue)
{ {
/* Raise an error if any attributes were used. */ /* Raise an error if any attributes were used. */
apply_attribute_uses (); apply_attribute_uses ();
XEXP (*queue, 0) = original; queue->safe_push (original);
XEXP (*queue, 1) = NULL_RTX;
return; return;
} }
...@@ -572,8 +571,7 @@ apply_iterators (rtx original, rtx *queue) ...@@ -572,8 +571,7 @@ apply_iterators (rtx original, rtx *queue)
} }
} }
/* Add the new rtx to the end of the queue. */ /* Add the new rtx to the end of the queue. */
XEXP (*queue, 0) = x; queue->safe_push (x);
XEXP (*queue, 1) = NULL_RTX;
/* Lexicographically increment the iterator value sequence. /* Lexicographically increment the iterator value sequence.
That is, cycle through iterator values, starting from the right, That is, cycle through iterator values, starting from the right,
...@@ -590,10 +588,6 @@ apply_iterators (rtx original, rtx *queue) ...@@ -590,10 +588,6 @@ apply_iterators (rtx original, rtx *queue)
break; break;
iterator->current_value = iterator->values; iterator->current_value = iterator->values;
} }
/* At least one more rtx to go. Allocate room for it. */
XEXP (*queue, 1) = rtx_alloc (EXPR_LIST);
queue = &XEXP (*queue, 1);
} }
} }
...@@ -945,7 +939,7 @@ read_mapping (struct iterator_group *group, htab_t table) ...@@ -945,7 +939,7 @@ read_mapping (struct iterator_group *group, htab_t table)
define_subst ATTR_NAME should be applied. This attribute is set and define_subst ATTR_NAME should be applied. This attribute is set and
defined implicitly and automatically. */ defined implicitly and automatically. */
static void static void
add_define_attr_for_define_subst (const char *attr_name, rtx *queue) add_define_attr_for_define_subst (const char *attr_name, vec<rtx> *queue)
{ {
rtx const_str, return_rtx; rtx const_str, return_rtx;
...@@ -960,14 +954,13 @@ add_define_attr_for_define_subst (const char *attr_name, rtx *queue) ...@@ -960,14 +954,13 @@ add_define_attr_for_define_subst (const char *attr_name, rtx *queue)
XSTR (return_rtx, 1) = xstrdup ("no,yes"); XSTR (return_rtx, 1) = xstrdup ("no,yes");
XEXP (return_rtx, 2) = const_str; XEXP (return_rtx, 2) = const_str;
XEXP (*queue, 0) = return_rtx; queue->safe_push (return_rtx);
XEXP (*queue, 1) = NULL_RTX;
} }
/* This routine generates DEFINE_SUBST_ATTR expression with operands /* This routine generates DEFINE_SUBST_ATTR expression with operands
ATTR_OPERANDS and places it to QUEUE. */ ATTR_OPERANDS and places it to QUEUE. */
static void static void
add_define_subst_attr (const char **attr_operands, rtx *queue) add_define_subst_attr (const char **attr_operands, vec<rtx> *queue)
{ {
rtx return_rtx; rtx return_rtx;
int i; int i;
...@@ -978,8 +971,7 @@ add_define_subst_attr (const char **attr_operands, rtx *queue) ...@@ -978,8 +971,7 @@ add_define_subst_attr (const char **attr_operands, rtx *queue)
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
XSTR (return_rtx, i) = xstrdup (attr_operands[i]); XSTR (return_rtx, i) = xstrdup (attr_operands[i]);
XEXP (*queue, 0) = return_rtx; queue->safe_push (return_rtx);
XEXP (*queue, 1) = NULL_RTX;
} }
/* Read define_subst_attribute construction. It has next form: /* Read define_subst_attribute construction. It has next form:
...@@ -992,18 +984,17 @@ add_define_subst_attr (const char **attr_operands, rtx *queue) ...@@ -992,18 +984,17 @@ add_define_subst_attr (const char **attr_operands, rtx *queue)
static void static void
read_subst_mapping (htab_t subst_iters_table, htab_t subst_attrs_table, read_subst_mapping (htab_t subst_iters_table, htab_t subst_attrs_table,
rtx *queue) vec<rtx> *queue)
{ {
struct mapping *m; struct mapping *m;
struct map_value **end_ptr; struct map_value **end_ptr;
const char *attr_operands[4]; const char *attr_operands[4];
rtx * queue_elem = queue;
int i; int i;
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
attr_operands[i] = read_string (false); attr_operands[i] = read_string (false);
add_define_subst_attr (attr_operands, queue_elem); add_define_subst_attr (attr_operands, queue);
bind_subst_iter_and_attr (attr_operands[1], attr_operands[0]); bind_subst_iter_and_attr (attr_operands[1], attr_operands[0]);
...@@ -1015,11 +1006,7 @@ read_subst_mapping (htab_t subst_iters_table, htab_t subst_attrs_table, ...@@ -1015,11 +1006,7 @@ read_subst_mapping (htab_t subst_iters_table, htab_t subst_attrs_table,
end_ptr = add_map_value (end_ptr, 1, ""); end_ptr = add_map_value (end_ptr, 1, "");
end_ptr = add_map_value (end_ptr, 2, ""); end_ptr = add_map_value (end_ptr, 2, "");
/* Add element to the queue. */ add_define_attr_for_define_subst (attr_operands[1], queue);
XEXP (*queue, 1) = rtx_alloc (EXPR_LIST);
queue_elem = &XEXP (*queue, 1);
add_define_attr_for_define_subst (attr_operands[1], queue_elem);
} }
m = add_mapping (&substs, subst_attrs_table, attr_operands[0]); m = add_mapping (&substs, subst_attrs_table, attr_operands[0]);
...@@ -1050,15 +1037,15 @@ check_code_iterator (struct mapping *iterator) ...@@ -1050,15 +1037,15 @@ check_code_iterator (struct mapping *iterator)
store the list of rtxes as an EXPR_LIST in *X. */ store the list of rtxes as an EXPR_LIST in *X. */
bool bool
read_rtx (const char *rtx_name, rtx *x) read_rtx (const char *rtx_name, vec<rtx> *rtxen)
{ {
static rtx queue_head; static bool initialized = false;
/* Do one-time initialization. */ /* Do one-time initialization. */
if (queue_head == 0) if (!initialized)
{ {
initialize_iterators (); initialize_iterators ();
queue_head = rtx_alloc (EXPR_LIST); initialized = true;
} }
/* Handle various rtx-related declarations that aren't themselves /* Handle various rtx-related declarations that aren't themselves
...@@ -1100,19 +1087,17 @@ read_rtx (const char *rtx_name, rtx *x) ...@@ -1100,19 +1087,17 @@ read_rtx (const char *rtx_name, rtx *x)
} }
if (strcmp (rtx_name, "define_subst_attr") == 0) if (strcmp (rtx_name, "define_subst_attr") == 0)
{ {
read_subst_mapping (substs.iterators, substs.attrs, &queue_head); read_subst_mapping (substs.iterators, substs.attrs, rtxen);
*x = queue_head;
/* READ_SUBST_MAPPING could generate a new DEFINE_ATTR. Return /* READ_SUBST_MAPPING could generate a new DEFINE_ATTR. Return
TRUE to process it. */ TRUE to process it. */
return true; return true;
} }
apply_iterators (read_rtx_code (rtx_name), &queue_head); apply_iterators (read_rtx_code (rtx_name), rtxen);
iterator_uses.truncate (0); iterator_uses.truncate (0);
attribute_uses.truncate (0); attribute_uses.truncate (0);
*x = queue_head;
return true; return true;
} }
......
...@@ -3613,7 +3613,7 @@ extern void init_varasm_once (void); ...@@ -3613,7 +3613,7 @@ extern void init_varasm_once (void);
extern rtx make_debug_expr_from_rtl (const_rtx); extern rtx make_debug_expr_from_rtl (const_rtx);
/* In read-rtl.c */ /* In read-rtl.c */
extern bool read_rtx (const char *, rtx *); extern bool read_rtx (const char *, vec<rtx> *);
/* In alias.c */ /* In alias.c */
extern rtx canon_rtx (rtx); extern rtx canon_rtx (rtx);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment