diff options
author | matz <matz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-09-02 21:13:34 +0000 |
---|---|---|
committer | matz <matz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-09-02 21:13:34 +0000 |
commit | 16c9337cf8172108f7c4230803c6aa0370807a94 (patch) | |
tree | dcf22487df72f428cf2839f64e5d177bc055f7b3 /gcc/stmt.c | |
parent | 0d12348a8a447ac3f0d395555bec3cb87d234516 (diff) | |
download | gcc-16c9337cf8172108f7c4230803c6aa0370807a94.tar.gz |
* expr.h (emit_storent_insn, expand_expr_real_1,
expand_expr_real_2): Declare.
* expr.c (emit_storent_insn, expand_expr_real_1,
expand_expr_real_2): Export.
(store_expr): Setting and evaluating dont_return_target is
useless.
(expand_expr_real_1, <case GOTO_EXPR, RETURN_EXPR, SWITCH_EXPR,
LABEL_EXPR and ASM_EXPR>): Move to gcc_unreachable.
* except.c (expand_resx_expr): Rename to ...
(expand_resx_stmt): ... this. Rewrite to take gimple statement.
* except.h (expand_resx_stmt): Declare.
* stmt.c: Add include gimple.h
(expand_asm_expr): Rename to ...
(expand_asm_stmt): ... this. Rewrite to take gimple statement.
(expand_case): Rewrite to take gimple statement.
* tree.h (expand_asm_stmt): Declare.
(expand_case): Change prototype.
* Makefile.in (stmt.o): Depend on gimple.h.
* builtins.c (expand_builtin_synchronize): Build gimple asm
statement, not an ASM_EXPR.
* cfgexpand.c (gimple_cond_pred_to_tree, set_expr_location_r,
gimple_to_tree, release_stmt_tree): Remove.
(expand_gimple_cond): Don't call gimple_cond_pred_to_tree or
ggc_free, but hold comparison code and operands separately.
Call jumpif_1 and jumpifnot_1 instead of jumpif and jumpifnot.
(expand_call_stmt, expand_gimple_stmt_1,
expand_gimple_stmt): New helpers.
(expand_gimple_tailcall): Don't call gimple_to_tree, expand_expr_stmt,
release_stmt_tree. Call expand_gimple_stmt instead.
(expand_gimple_basic_block): Ditto.
* calls.c (emit_call_1): Don't look at EH regions here, make
fntree parameter useless.
(expand_call): New local rettype for TREE_TYPE(exp), use it
throughout. Remove local p, use addr instead.
Don't look at EH regions here.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151350 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stmt.c')
-rw-r--r-- | gcc/stmt.c | 90 |
1 files changed, 63 insertions, 27 deletions
diff --git a/gcc/stmt.c b/gcc/stmt.c index 0a36e10f0b4..23fdd08dd30 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -48,6 +48,7 @@ along with GCC; see the file COPYING3. If not see #include "predict.h" #include "optabs.h" #include "target.h" +#include "gimple.h" #include "regs.h" #include "alloc-pool.h" #include "pretty-print.h" @@ -1075,20 +1076,65 @@ expand_asm_operands (tree string, tree outputs, tree inputs, } void -expand_asm_expr (tree exp) +expand_asm_stmt (gimple stmt) { - int noutputs, i; - tree outputs, tail; + int noutputs; + tree outputs, tail, t; tree *o; + size_t i, n; + const char *s; + tree str, out, in, cl; + + /* Meh... convert the gimple asm operands into real tree lists. + Eventually we should make all routines work on the vectors instead + of relying on TREE_CHAIN. */ + out = NULL_TREE; + n = gimple_asm_noutputs (stmt); + if (n > 0) + { + t = out = gimple_asm_output_op (stmt, 0); + for (i = 1; i < n; i++) + { + TREE_CHAIN (t) = gimple_asm_output_op (stmt, i); + t = gimple_asm_output_op (stmt, i); + } + } + + in = NULL_TREE; + n = gimple_asm_ninputs (stmt); + if (n > 0) + { + t = in = gimple_asm_input_op (stmt, 0); + for (i = 1; i < n; i++) + { + TREE_CHAIN (t) = gimple_asm_input_op (stmt, i); + t = gimple_asm_input_op (stmt, i); + } + } + + cl = NULL_TREE; + n = gimple_asm_nclobbers (stmt); + if (n > 0) + { + t = cl = gimple_asm_clobber_op (stmt, 0); + for (i = 1; i < n; i++) + { + TREE_CHAIN (t) = gimple_asm_clobber_op (stmt, i); + t = gimple_asm_clobber_op (stmt, i); + } + } - if (ASM_INPUT_P (exp)) + s = gimple_asm_string (stmt); + str = build_string (strlen (s), s); + + if (gimple_asm_input_p (stmt)) { - expand_asm_loc (ASM_STRING (exp), ASM_VOLATILE_P (exp), input_location); + expand_asm_loc (str, gimple_asm_volatile_p (stmt), input_location); return; } - outputs = ASM_OUTPUTS (exp); - noutputs = list_length (outputs); + outputs = out; + noutputs = gimple_asm_noutputs (stmt); /* o[I] is the place that output number I should be written. */ o = (tree *) alloca (noutputs * sizeof (tree)); @@ -1098,8 +1144,7 @@ expand_asm_expr (tree exp) /* Generate the ASM_OPERANDS insn; store into the TREE_VALUEs of OUTPUTS some trees for where the values were actually stored. */ - expand_asm_operands (ASM_STRING (exp), outputs, ASM_INPUTS (exp), - ASM_CLOBBERS (exp), ASM_VOLATILE_P (exp), + expand_asm_operands (str, outputs, in, cl, gimple_asm_volatile_p (stmt), input_location); /* Copy all the intermediate outputs into the specified outputs. */ @@ -2154,7 +2199,7 @@ emit_case_bit_tests (tree index_type, tree index_expr, tree minval, Generate the code to test it and jump to the right place. */ void -expand_case (tree exp) +expand_case (gimple stmt) { tree minval = NULL_TREE, maxval = NULL_TREE, range = NULL_TREE; rtx default_label = 0; @@ -2167,9 +2212,7 @@ expand_case (tree exp) int i; rtx before_case, end, lab; - tree vec = SWITCH_LABELS (exp); - tree orig_type = TREE_TYPE (exp); - tree index_expr = SWITCH_COND (exp); + tree index_expr = gimple_switch_index (stmt); tree index_type = TREE_TYPE (index_expr); int unsignedp = TYPE_UNSIGNED (index_type); @@ -2188,11 +2231,6 @@ expand_case (tree exp) sizeof (struct case_node), 100); - /* The switch body is lowered in gimplify.c, we should never have - switches with a non-NULL SWITCH_BODY here. */ - gcc_assert (!SWITCH_BODY (exp)); - gcc_assert (SWITCH_LABELS (exp)); - do_pending_stack_adjust (); /* An ERROR_MARK occurs for various reasons including invalid data type. */ @@ -2200,24 +2238,24 @@ expand_case (tree exp) { tree elt; bitmap label_bitmap; - int vl = TREE_VEC_LENGTH (vec); + int stopi = 0; /* cleanup_tree_cfg removes all SWITCH_EXPR with their index expressions being INTEGER_CST. */ gcc_assert (TREE_CODE (index_expr) != INTEGER_CST); - /* The default case, if ever taken, is at the end of TREE_VEC. */ - elt = TREE_VEC_ELT (vec, vl - 1); + /* The default case, if ever taken, is the first element. */ + elt = gimple_switch_label (stmt, 0); if (!CASE_LOW (elt) && !CASE_HIGH (elt)) { default_label_decl = CASE_LABEL (elt); - --vl; + stopi = 1; } - for (i = vl - 1; i >= 0; --i) + for (i = gimple_switch_num_labels (stmt) - 1; i >= stopi; --i) { tree low, high; - elt = TREE_VEC_ELT (vec, i); + elt = gimple_switch_label (stmt, i); low = CASE_LOW (elt); gcc_assert (low); @@ -2371,9 +2409,7 @@ expand_case (tree exp) decision tree an unconditional jump to the default code is emitted. */ - use_cost_table - = (TREE_CODE (orig_type) != ENUMERAL_TYPE - && estimate_case_costs (case_list)); + use_cost_table = estimate_case_costs (case_list); balance_case_nodes (&case_list, NULL); emit_case_nodes (index, case_list, default_label, index_type); if (default_label) |