From 5c9447f2404b5360adfe707fe0589fef24099834 Mon Sep 17 00:00:00 2001 From: bstarynk Date: Mon, 3 Oct 2011 06:17:33 +0000 Subject: 2011-10-03 Basile Starynkevitch MELT branch merged with trunk rev 179444 using svnmerge. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@179445 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimple-fold.c | 61 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 22 deletions(-) (limited to 'gcc/gimple-fold.c') diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index e345058cdbd..f8e5035e297 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -1201,28 +1201,45 @@ fold_stmt_1 (gimple_stmt_iterator *gsi, bool inplace) case GIMPLE_ASM: /* Fold *& in asm operands. */ - for (i = 0; i < gimple_asm_noutputs (stmt); ++i) - { - tree link = gimple_asm_output_op (stmt, i); - tree op = TREE_VALUE (link); - if (REFERENCE_CLASS_P (op) - && (op = maybe_fold_reference (op, true)) != NULL_TREE) - { - TREE_VALUE (link) = op; - changed = true; - } - } - for (i = 0; i < gimple_asm_ninputs (stmt); ++i) - { - tree link = gimple_asm_input_op (stmt, i); - tree op = TREE_VALUE (link); - if (REFERENCE_CLASS_P (op) - && (op = maybe_fold_reference (op, false)) != NULL_TREE) - { - TREE_VALUE (link) = op; - changed = true; - } - } + { + size_t noutputs; + const char **oconstraints; + const char *constraint; + bool allows_mem, allows_reg; + + noutputs = gimple_asm_noutputs (stmt); + oconstraints = XALLOCAVEC (const char *, noutputs); + + for (i = 0; i < gimple_asm_noutputs (stmt); ++i) + { + tree link = gimple_asm_output_op (stmt, i); + tree op = TREE_VALUE (link); + oconstraints[i] + = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link))); + if (REFERENCE_CLASS_P (op) + && (op = maybe_fold_reference (op, true)) != NULL_TREE) + { + TREE_VALUE (link) = op; + changed = true; + } + } + for (i = 0; i < gimple_asm_ninputs (stmt); ++i) + { + tree link = gimple_asm_input_op (stmt, i); + tree op = TREE_VALUE (link); + constraint + = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link))); + parse_input_constraint (&constraint, 0, 0, noutputs, 0, + oconstraints, &allows_mem, &allows_reg); + if (REFERENCE_CLASS_P (op) + && (op = maybe_fold_reference (op, !allows_reg && allows_mem)) + != NULL_TREE) + { + TREE_VALUE (link) = op; + changed = true; + } + } + } break; case GIMPLE_DEBUG: -- cgit v1.2.1