aboutsummaryrefslogtreecommitdiff
path: root/gcc/read-rtl.c
diff options
context:
space:
mode:
authorTrevor Saunders <tbsaunde+gcc@tbsaunde.org>2015-07-15 14:38:13 +0000
committerTrevor Saunders <tbsaunde@gcc.gnu.org>2015-07-15 14:38:13 +0000
commit6b8068d653b2fc19de7839d64fc6e19dc420dc30 (patch)
tree17d6c9dac4cfb44b97a64bf9d87934b9eb70eb03 /gcc/read-rtl.c
parent0467e3ebef7688c50fb0141b10c8b5e7e4dbbcdf (diff)
downloadgcc-6b8068d653b2fc19de7839d64fc6e19dc420dc30.zip
gcc-6b8068d653b2fc19de7839d64fc6e19dc420dc30.tar.gz
gcc-6b8068d653b2fc19de7839d64fc6e19dc420dc30.tar.bz2
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
Diffstat (limited to 'gcc/read-rtl.c')
-rw-r--r--gcc/read-rtl.c47
1 files changed, 16 insertions, 31 deletions
diff --git a/gcc/read-rtl.c b/gcc/read-rtl.c
index e8c849f..0f9e618 100644
--- a/gcc/read-rtl.c
+++ b/gcc/read-rtl.c
@@ -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. */
static void
-apply_iterators (rtx original, rtx *queue)
+apply_iterators (rtx original, vec<rtx> *queue)
{
unsigned int i;
const char *condition;
@@ -519,8 +519,7 @@ apply_iterators (rtx original, rtx *queue)
{
/* Raise an error if any attributes were used. */
apply_attribute_uses ();
- XEXP (*queue, 0) = original;
- XEXP (*queue, 1) = NULL_RTX;
+ queue->safe_push (original);
return;
}
@@ -572,8 +571,7 @@ apply_iterators (rtx original, rtx *queue)
}
}
/* Add the new rtx to the end of the queue. */
- XEXP (*queue, 0) = x;
- XEXP (*queue, 1) = NULL_RTX;
+ queue->safe_push (x);
/* Lexicographically increment the iterator value sequence.
That is, cycle through iterator values, starting from the right,
@@ -590,10 +588,6 @@ apply_iterators (rtx original, rtx *queue)
break;
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)
define_subst ATTR_NAME should be applied. This attribute is set and
defined implicitly and automatically. */
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;
@@ -960,14 +954,13 @@ add_define_attr_for_define_subst (const char *attr_name, rtx *queue)
XSTR (return_rtx, 1) = xstrdup ("no,yes");
XEXP (return_rtx, 2) = const_str;
- XEXP (*queue, 0) = return_rtx;
- XEXP (*queue, 1) = NULL_RTX;
+ queue->safe_push (return_rtx);
}
/* This routine generates DEFINE_SUBST_ATTR expression with operands
ATTR_OPERANDS and places it to QUEUE. */
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;
int i;
@@ -978,8 +971,7 @@ add_define_subst_attr (const char **attr_operands, rtx *queue)
for (i = 0; i < 4; i++)
XSTR (return_rtx, i) = xstrdup (attr_operands[i]);
- XEXP (*queue, 0) = return_rtx;
- XEXP (*queue, 1) = NULL_RTX;
+ queue->safe_push (return_rtx);
}
/* Read define_subst_attribute construction. It has next form:
@@ -992,18 +984,17 @@ add_define_subst_attr (const char **attr_operands, rtx *queue)
static void
read_subst_mapping (htab_t subst_iters_table, htab_t subst_attrs_table,
- rtx *queue)
+ vec<rtx> *queue)
{
struct mapping *m;
struct map_value **end_ptr;
const char *attr_operands[4];
- rtx * queue_elem = queue;
int i;
for (i = 0; i < 4; i++)
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]);
@@ -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, 2, "");
- /* Add element to the queue. */
- XEXP (*queue, 1) = rtx_alloc (EXPR_LIST);
- queue_elem = &XEXP (*queue, 1);
-
- add_define_attr_for_define_subst (attr_operands[1], queue_elem);
+ add_define_attr_for_define_subst (attr_operands[1], queue);
}
m = add_mapping (&substs, subst_attrs_table, attr_operands[0]);
@@ -1050,15 +1037,15 @@ check_code_iterator (struct mapping *iterator)
store the list of rtxes as an EXPR_LIST in *X. */
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. */
- if (queue_head == 0)
+ if (!initialized)
{
initialize_iterators ();
- queue_head = rtx_alloc (EXPR_LIST);
+ initialized = true;
}
/* Handle various rtx-related declarations that aren't themselves
@@ -1100,19 +1087,17 @@ read_rtx (const char *rtx_name, rtx *x)
}
if (strcmp (rtx_name, "define_subst_attr") == 0)
{
- read_subst_mapping (substs.iterators, substs.attrs, &queue_head);
- *x = queue_head;
+ read_subst_mapping (substs.iterators, substs.attrs, rtxen);
/* READ_SUBST_MAPPING could generate a new DEFINE_ATTR. Return
TRUE to process it. */
return true;
}
- apply_iterators (read_rtx_code (rtx_name), &queue_head);
+ apply_iterators (read_rtx_code (rtx_name), rtxen);
iterator_uses.truncate (0);
attribute_uses.truncate (0);
- *x = queue_head;
return true;
}