From 430e002293abd915fe368b0348ffa375af1e82a7 Mon Sep 17 00:00:00 2001 From: yroux Date: Wed, 16 Jul 2014 19:45:04 +0000 Subject: [PATCH] 2014-07-16 Yvan Roux Backport from trunk r211771. 2014-06-18 Kyrylo Tkachov * genattrtab.c (n_bypassed): New variable. (process_bypasses): Initialise n_bypassed. Count number of bypassed reservations. (make_automaton_attrs): Allocate space for bypassed reservations rather than number of bypasses. git-svn-id: svn://gcc.gnu.org/svn/gcc/branches/linaro/gcc-4_9-branch@212696 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog.linaro | 11 +++++++++++ gcc/genattrtab.c | 11 +++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog.linaro b/gcc/ChangeLog.linaro index 01d0639..0fda245 100644 --- a/gcc/ChangeLog.linaro +++ b/gcc/ChangeLog.linaro @@ -1,5 +1,16 @@ 2014-07-16 Yvan Roux + Backport from trunk r211771. + 2014-06-18 Kyrylo Tkachov + + * genattrtab.c (n_bypassed): New variable. + (process_bypasses): Initialise n_bypassed. + Count number of bypassed reservations. + (make_automaton_attrs): Allocate space for bypassed reservations + rather than number of bypasses. + +2014-07-16 Yvan Roux + Backport from trunk r210861. 2014-05-23 Jiong Wang diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c index 99b1b83..9261af6 100644 --- a/gcc/genattrtab.c +++ b/gcc/genattrtab.c @@ -4765,6 +4765,7 @@ struct bypass_list static struct bypass_list *all_bypasses; static size_t n_bypasses; +static size_t n_bypassed; static void gen_bypass_1 (const char *s, size_t len) @@ -4810,12 +4811,18 @@ process_bypasses (void) struct bypass_list *b; struct insn_reserv *r; + n_bypassed = 0; + /* The reservation list is likely to be much longer than the bypass list. */ for (r = all_insn_reservs; r; r = r->next) for (b = all_bypasses; b; b = b->next) if (fnmatch (b->pattern, r->name, 0) == 0) - r->bypassed = true; + { + n_bypassed++; + r->bypassed = true; + break; + } } /* Check that attribute NAME is used in define_insn_reservation condition @@ -5074,7 +5081,7 @@ make_automaton_attrs (void) process_bypasses (); byps_exp = rtx_alloc (COND); - XVEC (byps_exp, 0) = rtvec_alloc (n_bypasses * 2); + XVEC (byps_exp, 0) = rtvec_alloc (n_bypassed * 2); XEXP (byps_exp, 1) = make_numeric_value (0); for (decl = all_insn_reservs, i = 0; decl; -- 2.7.4