aboutsummaryrefslogtreecommitdiff
path: root/gcc/gensupport.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2019-07-12 07:54:23 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2019-07-12 07:54:23 +0000
commitd281492de84960b5885f88fffeeb226650f5141d (patch)
tree28304a490e6a430efab5d43f9479dbef727543b4 /gcc/gensupport.c
parent1fdd6f0412922eb7438cbbadbb805fce8cc77485 (diff)
downloadgcc-d281492de84960b5885f88fffeeb226650f5141d.zip
gcc-d281492de84960b5885f88fffeeb226650f5141d.tar.gz
gcc-d281492de84960b5885f88fffeeb226650f5141d.tar.bz2
Support multiple operand counts for .md @ patterns
This patch extends the support for "@..." pattern names so that the patterns can have different numbers of operands. This allows things like binary and ternary operations to be handled in a consistent way, a bit like optabs. The generators assert that the number of operands passed is correct for the underlying instruction. Also, replace_operands_with_dups iterated over the old rtx format even after having decided to do a replacement, which broke with match_operator. 2019-07-12 Richard Sandiford <richard.sandiford@arm.com> gcc/ * doc/md.texi: Document that @ patterns can have different numbers of operands. * genemit.c (handle_overloaded_gen): Handle this case. * genopinit.c (handle_overloaded_gen): Likewise. * gensupport.c (replace_operands_with_dups): Iterate over the new rtx's format rather than the old one's. From-SVN: r273432
Diffstat (limited to 'gcc/gensupport.c')
-rw-r--r--gcc/gensupport.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/gensupport.c b/gcc/gensupport.c
index 0ad9995..1aab711 100644
--- a/gcc/gensupport.c
+++ b/gcc/gensupport.c
@@ -500,12 +500,14 @@ replace_operands_with_dups (rtx x)
{
newx = rtx_alloc (MATCH_DUP);
XINT (newx, 0) = XINT (x, 0);
+ x = newx;
}
else if (GET_CODE (x) == MATCH_OPERATOR)
{
newx = rtx_alloc (MATCH_OP_DUP);
XINT (newx, 0) = XINT (x, 0);
XVEC (newx, 1) = XVEC (x, 2);
+ x = newx;
}
else
newx = shallow_copy_rtx (x);