summaryrefslogtreecommitdiff
path: root/gcc/genmatch.c
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-26 09:18:30 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-26 09:18:30 +0000
commit5e324b84c621f685e23e8ba620aa93cff30068e4 (patch)
treee79ab049985d601289566c278b52580210cc2ad4 /gcc/genmatch.c
parentd97142b0deb4b75fc0e39a20c53d1034ad3ed389 (diff)
downloadgcc-5e324b84c621f685e23e8ba620aa93cff30068e4.tar.gz
Move cexp simplifications to match.pd
This required reinstating support for captures in the result of a simplification. That part (genmatch.c) is by Richard B. Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi. gcc/ 2015-10-20 Richard Sandiford <richard.sandiford@arm.com> Richard Biener <rguenther@suse.de> * genmatch.c (dt_simplify::gen): Skip captures that are part of the result. (parser::parse_expr): Allow captures in results too. * builtins.c (fold_builtin_cexp): Delete. (fold_builtin_1): Handle constant cexp arguments here. * match.pd: Fold cexp(x+yi) to exp(x) * cexpi(y). git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229308 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/genmatch.c')
-rw-r--r--gcc/genmatch.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/genmatch.c b/gcc/genmatch.c
index b05760ec2ba..b5a0fffa714 100644
--- a/gcc/genmatch.c
+++ b/gcc/genmatch.c
@@ -3163,7 +3163,11 @@ dt_simplify::gen (FILE *f, int indent, bool gimple)
s->capture_max + 1, indexes[0]->get_name (opname));
for (int i = 1; i <= s->capture_max; ++i)
- fprintf (f, ", %s", indexes[i]->get_name (opname));
+ {
+ if (!indexes[i])
+ break;
+ fprintf (f, ", %s", indexes[i]->get_name (opname));
+ }
fprintf (f, " };\n");
}
@@ -3831,7 +3835,7 @@ parser::parse_expr ()
if (token->type == CPP_ATSIGN
&& !(token->flags & PREV_WHITE))
- op = parse_capture (e, !parsing_match_operand);
+ op = parse_capture (e, false);
else if (force_capture)
{
unsigned num = capture_ids->elements ();