aboutsummaryrefslogtreecommitdiff
path: root/gcc/stmt.c
diff options
context:
space:
mode:
authorVladimir N. Makarov <vmakarov@redhat.com>2021-02-16 10:27:56 -0500
committerVladimir N. Makarov <vmakarov@redhat.com>2021-02-16 10:30:10 -0500
commit72d78655a91bb2f89ac4432cfd6374380d6f9987 (patch)
tree58e1991a7c059630e352f1d0033972240ad82fbc /gcc/stmt.c
parentebf9b6c13f0847ddcc22e540a5fcdbf644e85a9c (diff)
downloadgcc-72d78655a91bb2f89ac4432cfd6374380d6f9987.zip
gcc-72d78655a91bb2f89ac4432cfd6374380d6f9987.tar.gz
gcc-72d78655a91bb2f89ac4432cfd6374380d6f9987.tar.bz2
[PR98096] inline-asm: Take inout operands into account for access to labels by names.
GCC splits inout operands into output and new matched input operands during gimplfication. Addressing operands by name or number is not problem as the new input operands are added at the end of existing input operands. However it became a problem for labels in asm goto with output reloads. Addressing labels should take into account the new input operands. The patch solves the problem. gcc/ChangeLog: PR inline-asm/98096 * stmt.c (resolve_operand_name_1): Take inout operands into account for access to labels by names. * doc/extend.texi: Describe counting operands for accessing labels. gcc/testsuite/ChangeLog: PR inline-asm/98096 * gcc.c-torture/compile/pr98096.c: New.
Diffstat (limited to 'gcc/stmt.c')
-rw-r--r--gcc/stmt.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/stmt.c b/gcc/stmt.c
index bd836d8..f52ffaf 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -611,7 +611,7 @@ static char *
resolve_operand_name_1 (char *p, tree outputs, tree inputs, tree labels)
{
char *q;
- int op;
+ int op, op_inout;
tree t;
/* Collect the operand name. */
@@ -624,11 +624,14 @@ resolve_operand_name_1 (char *p, tree outputs, tree inputs, tree labels)
*q = '\0';
/* Resolve the name to a number. */
- for (op = 0, t = outputs; t ; t = TREE_CHAIN (t), op++)
+ for (op_inout = op = 0, t = outputs; t ; t = TREE_CHAIN (t), op++)
{
tree name = TREE_PURPOSE (TREE_PURPOSE (t));
if (name && strcmp (TREE_STRING_POINTER (name), p) == 0)
goto found;
+ tree constraint = TREE_VALUE (TREE_PURPOSE (t));
+ if (constraint && strchr (TREE_STRING_POINTER (constraint), '+') != NULL)
+ op_inout++;
}
for (t = inputs; t ; t = TREE_CHAIN (t), op++)
{
@@ -636,6 +639,7 @@ resolve_operand_name_1 (char *p, tree outputs, tree inputs, tree labels)
if (name && strcmp (TREE_STRING_POINTER (name), p) == 0)
goto found;
}
+ op += op_inout;
for (t = labels; t ; t = TREE_CHAIN (t), op++)
{
tree name = TREE_PURPOSE (t);