diff options
Diffstat (limited to 'gcc-4.6/gcc/gimple-fold.c')
-rw-r--r-- | gcc-4.6/gcc/gimple-fold.c | 66 |
1 files changed, 44 insertions, 22 deletions
diff --git a/gcc-4.6/gcc/gimple-fold.c b/gcc-4.6/gcc/gimple-fold.c index cd8f409..ad45dcb 100644 --- a/gcc-4.6/gcc/gimple-fold.c +++ b/gcc-4.6/gcc/gimple-fold.c @@ -1210,6 +1210,11 @@ gimple_fold_builtin (gimple stmt) if (DECL_BUILT_IN_CLASS (callee) == BUILT_IN_MD) return NULL_TREE; + /* Give up for always_inline inline builtins until they are + inlined. */ + if (avoid_folding_inline_builtin (callee)) + return NULL_TREE; + /* If the builtin could not be folded, and it has no argument list, we're done. */ nargs = gimple_call_num_args (stmt); @@ -1533,28 +1538,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: |