gcc/ * coretypes.h (gimple_asm): New typedef. (const_gimple_asm): New typedef.
* gimple.h (gimple_statement_base::as_a_gimple_asm): New. gimple_statement_base::dyn_cast_gimple_asm): New. (gimple_build_asm_vec): Return a gimple_asm rather than just a gimple. (gimple_asm_clobbers_memory_p): Require a const_gimple_asm rather than just a const_gimple. (gimple_asm_ninputs): Likewise. (gimple_asm_noutputs): Likewise. (gimple_asm_nclobbers): Likewise. (gimple_asm_nlabels): Likewise. (gimple_asm_input_op): Likewise. (gimple_asm_input_op_ptr): Likewise. (gimple_asm_output_op): Likewise. (gimple_asm_output_op_ptr): Likewise. (gimple_asm_clobber_op): Likewise. (gimple_asm_label_op): Likewise. (gimple_asm_string): Likewise. (gimple_asm_volatile_p): Likewise. (gimple_asm_input_p): Likewise. (gimple_asm_set_input_op): Require a gimple_asm rather than a plain gimple. (gimple_asm_set_output_op): Likewise. (gimple_asm_set_clobber_op): Likewise. (gimple_asm_set_label_op): Likewise. (gimple_asm_set_volatile): Likewise. (gimple_asm_set_input): Likewise. * cfgexpand.c (expand_asm_stmt): Require a gimple_asm rather than a plain gimple. (expand_gimple_stmt_1): Add checked cast to gimple_asm within GIMPLE_ASM case of switch statement. * gimple-fold.c (fold_stmt_1): Add new local from checked cast to gimple_asm within case GIMPLE_ASM. * gimple-pretty-print.c (dump_gimple_asm): Require a gimple_asm rather than a plain gimple. (pp_gimple_stmt_1): Add checked cast to gimple_asm within GIMPLE_ASM case of switch statement. * gimple-streamer-in.c (input_gimple_stmt): Rework existing checked cast to gimple_asm; add a new one. * gimple-streamer-out.c (output_gimple_stmt): Add new local from checked cast to gimple_asm within case GIMPLE_ASM. * gimple-walk.c (walk_gimple_asm): Require a gimple_asm rather than a plain gimple. (walk_gimple_op): Add checked cast to gimple_asm within GIMPLE_ASM case of switch statement. (walk_stmt_load_store_addr_ops): Use dyn_cast_gimple_asm in place of a code check against GIMPLE_ASM to introduce a new gimple_asm local. * gimple.c (gimple_build_asm_1): Return a gimple_asm rather than a plain gimple. (gimple_build_asm_vec): Likewise. (gimple_has_side_effects): Add a checked cast to gimple_asm. (gimple_could_trap_p_1): Likewise. (gimple_call_builtin_p): Require a const_gimple_asm rather then a const_gimple. * gimplify-me.c (gimple_regimplify_operands): Add a checked cast and a new local of type gimple_asm within GIMPLE_ASM case. * gimplify.c (gimplify_asm_expr): Convert a local from gimple to gimple_asm. * ipa-pure-const.c (check_stmt): Add checked casts within GIMPLE_ASM case. * ssa-iterators.h (op_iter_init): Likewise. * tree-cfg.c (make_goto_expr_edges): Convert a local from gimple to gimple_asm. (cleanup_dead_labels): Add a checked cast and a new local of type gimple_asm within GIMPLE_ASM case. (gimple_redirect_edge_and_branch): Likewise. (is_ctrl_altering_stmt): Add a checked cast. (need_fake_edge_p): Replace a code check against GIMPLE_ASM with a dyn_cast_gimple_asm. * tree-complex.c (expand_complex_comparison): Convert a local from gimple to gimple_asm. * tree-data-ref.c (get_references_in_stmt): Add a checked cast to gimple_asm. * tree-eh.c (stmt_could_throw_p): Likewise. * tree-inline.c (estimate_num_insns): Likewise. * tree-sra.c (scan_function): Add a checked cast and a new local of type gimple_asm within GIMPLE_ASM case. (sra_modify_function_body): Likewise. (ipa_sra_modify_function_body): Likewise. * tree-ssa-coalesce.c (create_outofssa_var_map): Likewise. * tree-ssa-dce.c (propagate_necessity): Replace a code check against GIMPLE_ASM with a dyn_cast_gimple_asm. * tree-ssa-operands.c (maybe_add_call_vops): Require a gimple_asm rather than a plain gimple. (parse_ssa_operands): Add a checked cast to gimple_asm. * tree-ssa-structalias.c (find_func_aliases): Add a checked cast and a new local of type gimple_asm within clause guarded by code check. * tree-ssa-threadedge.c (record_temporary_equivalences_from_stmts_at_dest): Add a checked cast to gimple_asm. * tree-ssa.c (execute_update_addresses_taken): Add checked casts and new locals of type gimple_asm within clauses guarded by code check. --- gcc/cfgexpand.c | 4 +- gcc/coretypes.h | 4 ++ gcc/gimple-fold.c | 11 +-- gcc/gimple-pretty-print.c | 4 +- gcc/gimple-streamer-in.c | 7 +- gcc/gimple-streamer-out.c | 15 +++-- gcc/gimple-walk.c | 16 ++--- gcc/gimple.c | 14 ++-- gcc/gimple.h | 164 +++++++++++++++++++++------------------------ gcc/gimplify-me.c | 9 +-- gcc/gimplify.c | 2 +- gcc/ipa-pure-const.c | 4 +- gcc/ssa-iterators.h | 2 +- gcc/tree-cfg.c | 20 +++--- gcc/tree-complex.c | 2 +- gcc/tree-data-ref.c | 3 +- gcc/tree-eh.c | 2 +- gcc/tree-inline.c | 3 +- gcc/tree-sra.c | 77 +++++++++++---------- gcc/tree-ssa-coalesce.c | 9 +-- gcc/tree-ssa-dce.c | 6 +- gcc/tree-ssa-operands.c | 4 +- gcc/tree-ssa-structalias.c | 9 +-- gcc/tree-ssa-threadedge.c | 3 +- gcc/tree-ssa.c | 18 ++--- 25 files changed, 214 insertions(+), 198 deletions(-) diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 175a9f4..71615a8 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -2865,7 +2865,7 @@ expand_asm_operands (tree string, tree outputs, tree inputs, static void -expand_asm_stmt (gimple stmt) +expand_asm_stmt (gimple_asm stmt) { int noutputs; tree outputs, tail, t; @@ -3150,7 +3150,7 @@ expand_gimple_stmt_1 (gimple stmt) expand_case (stmt->as_a_gimple_switch ()); break; case GIMPLE_ASM: - expand_asm_stmt (stmt); + expand_asm_stmt (stmt->as_a_gimple_asm ()); break; case GIMPLE_CALL: expand_call_stmt (stmt->as_a_gimple_call ()); diff --git a/gcc/coretypes.h b/gcc/coretypes.h index 1d04d07..7c869e9 100644 --- a/gcc/coretypes.h +++ b/gcc/coretypes.h @@ -93,6 +93,10 @@ struct gimple_statement_assign; typedef struct gimple_statement_assign *gimple_assign; typedef const struct gimple_statement_assign *const_gimple_assign; +struct gimple_statement_asm; +typedef struct gimple_statement_asm *gimple_asm; +typedef const struct gimple_statement_asm *const_gimple_asm; + struct gimple_statement_call; typedef struct gimple_statement_call *gimple_call; typedef const struct gimple_statement_call *const_gimple_call; diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index aa62bef..2d317b0 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -1304,17 +1304,18 @@ fold_stmt_1 (gimple_stmt_iterator *gsi, bool inplace) case GIMPLE_ASM: /* Fold *& in asm operands. */ { + gimple_asm asm_stmt = stmt->as_a_gimple_asm (); size_t noutputs; const char **oconstraints; const char *constraint; bool allows_mem, allows_reg; - noutputs = gimple_asm_noutputs (stmt); + noutputs = gimple_asm_noutputs (asm_stmt); oconstraints = XALLOCAVEC (const char *, noutputs); - for (i = 0; i < gimple_asm_noutputs (stmt); ++i) + for (i = 0; i < gimple_asm_noutputs (asm_stmt); ++i) { - tree link = gimple_asm_output_op (stmt, i); + tree link = gimple_asm_output_op (asm_stmt, i); tree op = TREE_VALUE (link); oconstraints[i] = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link))); @@ -1325,9 +1326,9 @@ fold_stmt_1 (gimple_stmt_iterator *gsi, bool inplace) changed = true; } } - for (i = 0; i < gimple_asm_ninputs (stmt); ++i) + for (i = 0; i < gimple_asm_ninputs (asm_stmt); ++i) { - tree link = gimple_asm_input_op (stmt, i); + tree link = gimple_asm_input_op (asm_stmt, i); tree op = TREE_VALUE (link); constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link))); diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c index 6ee6ce9..da27f21 100644 --- a/gcc/gimple-pretty-print.c +++ b/gcc/gimple-pretty-print.c @@ -1580,7 +1580,7 @@ dump_gimple_transaction (pretty_printer *buffer, gimple gs, int spc, int flags) dumpfile.h). */ static void -dump_gimple_asm (pretty_printer *buffer, gimple gs, int spc, int flags) +dump_gimple_asm (pretty_printer *buffer, gimple_asm gs, int spc, int flags) { unsigned int i, n, f, fields; @@ -2091,7 +2091,7 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags) switch (gimple_code (gs)) { case GIMPLE_ASM: - dump_gimple_asm (buffer, gs, spc, flags); + dump_gimple_asm (buffer, gs->as_a_gimple_asm (), spc, flags); break; case GIMPLE_ASSIGN: diff --git a/gcc/gimple-streamer-in.c b/gcc/gimple-streamer-in.c index 2d5885f..25d871c 100644 --- a/gcc/gimple-streamer-in.c +++ b/gcc/gimple-streamer-in.c @@ -137,7 +137,7 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in, case GIMPLE_ASM: { /* FIXME lto. Move most of this into a new gimple_asm_set_string(). */ - gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (stmt); + gimple_asm asm_stmt = stmt->as_a_gimple_asm (); tree str; asm_stmt->ni = streamer_read_uhwi (ib); asm_stmt->no = streamer_read_uhwi (ib); @@ -218,11 +218,12 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in, } else if (code == GIMPLE_ASM) { + gimple_asm asm_stmt = stmt->as_a_gimple_asm (); unsigned i; - for (i = 0; i < gimple_asm_noutputs (stmt); i++) + for (i = 0; i < gimple_asm_noutputs (asm_stmt); i++) { - tree op = TREE_VALUE (gimple_asm_output_op (stmt, i)); + tree op = TREE_VALUE (gimple_asm_output_op (asm_stmt, i)); if (TREE_CODE (op) == SSA_NAME) SSA_NAME_DEF_STMT (op) = stmt; } diff --git a/gcc/gimple-streamer-out.c b/gcc/gimple-streamer-out.c index 85a7966..7aafba1 100644 --- a/gcc/gimple-streamer-out.c +++ b/gcc/gimple-streamer-out.c @@ -109,12 +109,15 @@ output_gimple_stmt (struct output_block *ob, gimple stmt) break; case GIMPLE_ASM: - streamer_write_uhwi (ob, gimple_asm_ninputs (stmt)); - streamer_write_uhwi (ob, gimple_asm_noutputs (stmt)); - streamer_write_uhwi (ob, gimple_asm_nclobbers (stmt)); - streamer_write_uhwi (ob, gimple_asm_nlabels (stmt)); - streamer_write_string (ob, ob->main_stream, gimple_asm_string (stmt), - true); + { + gimple_asm asm_stmt = stmt->as_a_gimple_asm (); + streamer_write_uhwi (ob, gimple_asm_ninputs (asm_stmt)); + streamer_write_uhwi (ob, gimple_asm_noutputs (asm_stmt)); + streamer_write_uhwi (ob, gimple_asm_nclobbers (asm_stmt)); + streamer_write_uhwi (ob, gimple_asm_nlabels (asm_stmt)); + streamer_write_string (ob, ob->main_stream, + gimple_asm_string (asm_stmt), true); + } /* Fallthru */ case GIMPLE_ASSIGN: diff --git a/gcc/gimple-walk.c b/gcc/gimple-walk.c index 0bb86db..f71b0db 100644 --- a/gcc/gimple-walk.c +++ b/gcc/gimple-walk.c @@ -94,7 +94,7 @@ walk_gimple_seq (gimple_seq seq, walk_stmt_fn callback_stmt, /* Helper function for walk_gimple_stmt. Walk operands of a GIMPLE_ASM. */ static tree -walk_gimple_asm (gimple stmt, walk_tree_fn callback_op, +walk_gimple_asm (gimple_asm stmt, walk_tree_fn callback_op, struct walk_stmt_info *wi) { tree ret, op; @@ -292,7 +292,7 @@ walk_gimple_op (gimple stmt, walk_tree_fn callback_op, break; case GIMPLE_ASM: - ret = walk_gimple_asm (stmt, callback_op, wi); + ret = walk_gimple_asm (stmt->as_a_gimple_asm (), callback_op, wi); if (ret) return ret; break; @@ -779,18 +779,18 @@ walk_stmt_load_store_addr_ops (gimple stmt, void *data, ret |= visit_addr (stmt, gimple_call_lhs (stmt), gimple_call_lhs (stmt), data); } - else if (gimple_code (stmt) == GIMPLE_ASM) + else if (gimple_asm asm_stmt = stmt->dyn_cast_gimple_asm ()) { unsigned noutputs; const char *constraint; const char **oconstraints; bool allows_mem, allows_reg, is_inout; - noutputs = gimple_asm_noutputs (stmt); + noutputs = gimple_asm_noutputs (asm_stmt); oconstraints = XALLOCAVEC (const char *, noutputs); if (visit_store || visit_addr) - for (i = 0; i < gimple_asm_noutputs (stmt); ++i) + for (i = 0; i < gimple_asm_noutputs (asm_stmt); ++i) { - tree link = gimple_asm_output_op (stmt, i); + tree link = gimple_asm_output_op (asm_stmt, i); tree op = get_base_loadstore (TREE_VALUE (link)); if (op && visit_store) ret |= visit_store (stmt, op, TREE_VALUE (link), data); @@ -806,9 +806,9 @@ walk_stmt_load_store_addr_ops (gimple stmt, void *data, } } if (visit_load || visit_addr) - for (i = 0; i < gimple_asm_ninputs (stmt); ++i) + for (i = 0; i < gimple_asm_ninputs (asm_stmt); ++i) { - tree link = gimple_asm_input_op (stmt, i); + tree link = gimple_asm_input_op (asm_stmt, i); tree op = TREE_VALUE (link); if (visit_addr && TREE_CODE (op) == ADDR_EXPR) diff --git a/gcc/gimple.c b/gcc/gimple.c index b73fc74..e037c05 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -538,11 +538,11 @@ gimple_build_bind (tree vars, gimple_seq body, tree block) NCLOBBERS is the number of clobbered registers. */ -static inline gimple +static inline gimple_asm gimple_build_asm_1 (const char *string, unsigned ninputs, unsigned noutputs, unsigned nclobbers, unsigned nlabels) { - gimple_statement_asm *p; + gimple_asm p; int size = strlen (string); /* ASMs with labels cannot have outputs. This should have been @@ -576,12 +576,12 @@ gimple_build_asm_1 (const char *string, unsigned ninputs, unsigned noutputs, CLOBBERS is a vector of the clobbered register parameters. LABELS is a vector of destination labels. */ -gimple +gimple_asm gimple_build_asm_vec (const char *string, vec<tree, va_gc> *inputs, vec<tree, va_gc> *outputs, vec<tree, va_gc> *clobbers, vec<tree, va_gc> *labels) { - gimple p; + gimple_asm p; unsigned i; p = gimple_build_asm_1 (string, @@ -1802,7 +1802,7 @@ gimple_has_side_effects (const_gimple s) return true; if (gimple_code (s) == GIMPLE_ASM - && gimple_asm_volatile_p (s)) + && gimple_asm_volatile_p (s->as_a_gimple_asm ())) return true; if (is_gimple_call (s)) @@ -1843,7 +1843,7 @@ gimple_could_trap_p_1 (gimple s, bool include_mem, bool include_stores) switch (gimple_code (s)) { case GIMPLE_ASM: - return gimple_asm_volatile_p (s); + return gimple_asm_volatile_p (s->as_a_gimple_asm ()); case GIMPLE_CALL: t = gimple_call_fndecl (s); @@ -2457,7 +2457,7 @@ gimple_call_builtin_p (const_gimple stmt, enum built_in_function code) GIMPLE_ASM. */ bool -gimple_asm_clobbers_memory_p (const_gimple stmt) +gimple_asm_clobbers_memory_p (const_gimple_asm stmt) { unsigned i; diff --git a/gcc/gimple.h b/gcc/gimple.h index a4c7b30..944e473 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -246,6 +246,18 @@ public: return as_a <gimple_statement_assign> (this); } + inline gimple_asm + as_a_gimple_asm () + { + return as_a <gimple_statement_asm> (this); + } + + inline const_gimple_asm + as_a_gimple_asm () const + { + return as_a <const gimple_statement_asm> (this); + } + inline gimple_call as_a_gimple_call () { @@ -320,6 +332,12 @@ public: return dyn_cast <gimple_statement_assign> (this); } + inline gimple_asm + dyn_cast_gimple_asm () + { + return dyn_cast <gimple_statement_asm> (this); + } + inline gimple_call dyn_cast_gimple_call () { @@ -1466,9 +1484,9 @@ gimple_label gimple_build_label (tree label); gimple_goto gimple_build_goto (tree dest); gimple gimple_build_nop (void); gimple_bind gimple_build_bind (tree, gimple_seq, tree); -gimple gimple_build_asm_vec (const char *, vec<tree, va_gc> *, - vec<tree, va_gc> *, vec<tree, va_gc> *, - vec<tree, va_gc> *); +gimple_asm gimple_build_asm_vec (const char *, vec<tree, va_gc> *, + vec<tree, va_gc> *, vec<tree, va_gc> *, + vec<tree, va_gc> *); gimple gimple_build_catch (tree, gimple_seq); gimple gimple_build_eh_filter (tree, gimple_seq); gimple gimple_build_eh_must_not_throw (tree); @@ -1544,7 +1562,7 @@ extern bool gimple_builtin_call_types_compatible_p (const_gimple, tree); extern bool gimple_call_builtin_p (const_gimple); extern bool gimple_call_builtin_p (const_gimple, enum built_in_class); extern bool gimple_call_builtin_p (const_gimple, enum built_in_function); -extern bool gimple_asm_clobbers_memory_p (const_gimple); +extern bool gimple_asm_clobbers_memory_p (const_gimple_asm); extern void dump_decl_set (FILE *, bitmap); extern bool nonfreeing_call_p (gimple); extern bool infer_nonnull_range (gimple, tree, bool, bool); @@ -3450,218 +3468,188 @@ gimple_bind_set_block (gimple_bind bind_stmt, tree block) } -/* Return the number of input operands for GIMPLE_ASM GS. */ +/* Return the number of input operands for GIMPLE_ASM ASM_STMT. */ static inline unsigned -gimple_asm_ninputs (const_gimple gs) +gimple_asm_ninputs (const_gimple_asm asm_stmt) { - const gimple_statement_asm *asm_stmt = - as_a <const gimple_statement_asm> (gs); return asm_stmt->ni; } -/* Return the number of output operands for GIMPLE_ASM GS. */ +/* Return the number of output operands for GIMPLE_ASM ASM_STMT. */ static inline unsigned -gimple_asm_noutputs (const_gimple gs) +gimple_asm_noutputs (const_gimple_asm asm_stmt) { - const gimple_statement_asm *asm_stmt = - as_a <const gimple_statement_asm> (gs); return asm_stmt->no; } -/* Return the number of clobber operands for GIMPLE_ASM GS. */ +/* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */ static inline unsigned -gimple_asm_nclobbers (const_gimple gs) +gimple_asm_nclobbers (const_gimple_asm asm_stmt) { - const gimple_statement_asm *asm_stmt = - as_a <const gimple_statement_asm> (gs); return asm_stmt->nc; } -/* Return the number of label operands for GIMPLE_ASM GS. */ +/* Return the number of label operands for GIMPLE_ASM ASM_STMT. */ static inline unsigned -gimple_asm_nlabels (const_gimple gs) +gimple_asm_nlabels (const_gimple_asm asm_stmt) { - const gimple_statement_asm *asm_stmt = - as_a <const gimple_statement_asm> (gs); return asm_stmt->nl; } -/* Return input operand INDEX of GIMPLE_ASM GS. */ +/* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */ static inline tree -gimple_asm_input_op (const_gimple gs, unsigned index) +gimple_asm_input_op (const_gimple_asm asm_stmt, unsigned index) { - const gimple_statement_asm *asm_stmt = - as_a <const gimple_statement_asm> (gs); gcc_gimple_checking_assert (index < asm_stmt->ni); - return gimple_op (gs, index + asm_stmt->no); + return gimple_op (asm_stmt, index + asm_stmt->no); } -/* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */ +/* Return a pointer to input operand INDEX of GIMPLE_ASM ASM_STMT. */ static inline tree * -gimple_asm_input_op_ptr (const_gimple gs, unsigned index) +gimple_asm_input_op_ptr (const_gimple_asm asm_stmt, unsigned index) { - const gimple_statement_asm *asm_stmt = - as_a <const gimple_statement_asm> (gs); gcc_gimple_checking_assert (index < asm_stmt->ni); - return gimple_op_ptr (gs, index + asm_stmt->no); + return gimple_op_ptr (asm_stmt, index + asm_stmt->no); } -/* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */ +/* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */ static inline void -gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op) +gimple_asm_set_input_op (gimple_asm asm_stmt, unsigned index, tree in_op) { - gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs); gcc_gimple_checking_assert (index < asm_stmt->ni && TREE_CODE (in_op) == TREE_LIST); - gimple_set_op (gs, index + asm_stmt->no, in_op); + gimple_set_op (asm_stmt, index + asm_stmt->no, in_op); } -/* Return output operand INDEX of GIMPLE_ASM GS. */ +/* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */ static inline tree -gimple_asm_output_op (const_gimple gs, unsigned index) +gimple_asm_output_op (const_gimple_asm asm_stmt, unsigned index) { - const gimple_statement_asm *asm_stmt = - as_a <const gimple_statement_asm> (gs); gcc_gimple_checking_assert (index < asm_stmt->no); - return gimple_op (gs, index); + return gimple_op (asm_stmt, index); } -/* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */ +/* Return a pointer to output operand INDEX of GIMPLE_ASM ASM_STMT. */ static inline tree * -gimple_asm_output_op_ptr (const_gimple gs, unsigned index) +gimple_asm_output_op_ptr (const_gimple_asm asm_stmt, unsigned index) { - const gimple_statement_asm *asm_stmt = - as_a <const gimple_statement_asm> (gs); gcc_gimple_checking_assert (index < asm_stmt->no); - return gimple_op_ptr (gs, index); + return gimple_op_ptr (asm_stmt, index); } -/* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */ +/* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */ static inline void -gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op) +gimple_asm_set_output_op (gimple_asm asm_stmt, unsigned index, tree out_op) { - gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs); gcc_gimple_checking_assert (index < asm_stmt->no && TREE_CODE (out_op) == TREE_LIST); - gimple_set_op (gs, index, out_op); + gimple_set_op (asm_stmt, index, out_op); } -/* Return clobber operand INDEX of GIMPLE_ASM GS. */ +/* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */ static inline tree -gimple_asm_clobber_op (const_gimple gs, unsigned index) +gimple_asm_clobber_op (const_gimple_asm asm_stmt, unsigned index) { - const gimple_statement_asm *asm_stmt = - as_a <const gimple_statement_asm> (gs); gcc_gimple_checking_assert (index < asm_stmt->nc); - return gimple_op (gs, index + asm_stmt->ni + asm_stmt->no); + return gimple_op (asm_stmt, index + asm_stmt->ni + asm_stmt->no); } -/* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */ +/* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */ static inline void -gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op) +gimple_asm_set_clobber_op (gimple_asm asm_stmt, unsigned index, tree clobber_op) { - gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs); gcc_gimple_checking_assert (index < asm_stmt->nc && TREE_CODE (clobber_op) == TREE_LIST); - gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->no, clobber_op); + gimple_set_op (asm_stmt, index + asm_stmt->ni + asm_stmt->no, clobber_op); } -/* Return label operand INDEX of GIMPLE_ASM GS. */ +/* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */ static inline tree -gimple_asm_label_op (const_gimple gs, unsigned index) +gimple_asm_label_op (const_gimple_asm asm_stmt, unsigned index) { - const gimple_statement_asm *asm_stmt = - as_a <const gimple_statement_asm> (gs); gcc_gimple_checking_assert (index < asm_stmt->nl); - return gimple_op (gs, index + asm_stmt->ni + asm_stmt->nc); + return gimple_op (asm_stmt, index + asm_stmt->ni + asm_stmt->nc); } -/* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */ +/* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */ static inline void -gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op) +gimple_asm_set_label_op (gimple_asm asm_stmt, unsigned index, tree label_op) { - gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs); gcc_gimple_checking_assert (index < asm_stmt->nl && TREE_CODE (label_op) == TREE_LIST); - gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->nc, label_op); + gimple_set_op (asm_stmt, index + asm_stmt->ni + asm_stmt->nc, label_op); } /* Return the string representing the assembly instruction in - GIMPLE_ASM GS. */ + GIMPLE_ASM ASM_STMT. */ static inline const char * -gimple_asm_string (const_gimple gs) +gimple_asm_string (const_gimple_asm asm_stmt) { - const gimple_statement_asm *asm_stmt = - as_a <const gimple_statement_asm> (gs); return asm_stmt->string; } -/* Return true if GS is an asm statement marked volatile. */ +/* Return true ASM_STMT ASM_STMT is an asm statement marked volatile. */ static inline bool -gimple_asm_volatile_p (const_gimple gs) +gimple_asm_volatile_p (const_gimple_asm asm_stmt) { - GIMPLE_CHECK (gs, GIMPLE_ASM); - return (gs->subcode & GF_ASM_VOLATILE) != 0; + return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0; } -/* If VOLATLE_P is true, mark asm statement GS as volatile. */ +/* If VOLATLE_P is true, mark asm statement ASM_STMT as volatile. */ static inline void -gimple_asm_set_volatile (gimple gs, bool volatile_p) +gimple_asm_set_volatile (gimple_asm asm_stmt, bool volatile_p) { - GIMPLE_CHECK (gs, GIMPLE_ASM); if (volatile_p) - gs->subcode |= GF_ASM_VOLATILE; + asm_stmt->subcode |= GF_ASM_VOLATILE; else - gs->subcode &= ~GF_ASM_VOLATILE; + asm_stmt->subcode &= ~GF_ASM_VOLATILE; } -/* If INPUT_P is true, mark asm GS as an ASM_INPUT. */ +/* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */ static inline void -gimple_asm_set_input (gimple gs, bool input_p) +gimple_asm_set_input (gimple_asm asm_stmt, bool input_p) { - GIMPLE_CHECK (gs, GIMPLE_ASM); if (input_p) - gs->subcode |= GF_ASM_INPUT; + asm_stmt->subcode |= GF_ASM_INPUT; else - gs->subcode &= ~GF_ASM_INPUT; + asm_stmt->subcode &= ~GF_ASM_INPUT; } -/* Return true if asm GS is an ASM_INPUT. */ +/* Return true if asm ASM_STMT is an ASM_INPUT. */ static inline bool -gimple_asm_input_p (const_gimple gs) +gimple_asm_input_p (const_gimple_asm asm_stmt) { - GIMPLE_CHECK (gs, GIMPLE_ASM); - return (gs->subcode & GF_ASM_INPUT) != 0; + return (asm_stmt->subcode & GF_ASM_INPUT) != 0; } diff --git a/gcc/gimplify-me.c b/gcc/gimplify-me.c index 05e986a..7aaac08 100644 --- a/gcc/gimplify-me.c +++ b/gcc/gimplify-me.c @@ -183,7 +183,8 @@ gimple_regimplify_operands (gimple stmt, gimple_stmt_iterator *gsi_p) break; case GIMPLE_ASM: { - size_t i, noutputs = gimple_asm_noutputs (stmt); + gimple_asm asm_stmt = stmt->as_a_gimple_asm (); + size_t i, noutputs = gimple_asm_noutputs (asm_stmt); const char *constraint, **oconstraints; bool allows_mem, allows_reg, is_inout; @@ -191,7 +192,7 @@ gimple_regimplify_operands (gimple stmt, gimple_stmt_iterator *gsi_p) = (const char **) alloca ((noutputs) * sizeof (const char *)); for (i = 0; i < noutputs; i++) { - tree op = gimple_asm_output_op (stmt, i); + tree op = gimple_asm_output_op (asm_stmt, i); constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (op))); oconstraints[i] = constraint; parse_output_constraint (&constraint, i, 0, 0, &allows_mem, @@ -200,9 +201,9 @@ gimple_regimplify_operands (gimple stmt, gimple_stmt_iterator *gsi_p) is_inout ? is_gimple_min_lval : is_gimple_lvalue, fb_lvalue | fb_mayfail); } - for (i = 0; i < gimple_asm_ninputs (stmt); i++) + for (i = 0; i < gimple_asm_ninputs (asm_stmt); i++) { - tree op = gimple_asm_input_op (stmt, i); + tree op = gimple_asm_input_op (asm_stmt, i); constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (op))); parse_input_constraint (&constraint, 0, 0, noutputs, 0, oconstraints, &allows_mem, &allows_reg); diff --git a/gcc/gimplify.c b/gcc/gimplify.c index b24ce70..e0444ca 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -4861,7 +4861,7 @@ gimplify_asm_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) const char *constraint; bool allows_mem, allows_reg, is_inout; enum gimplify_status ret, tret; - gimple stmt; + gimple_asm stmt; vec<tree, va_gc> *inputs; vec<tree, va_gc> *outputs; vec<tree, va_gc> *clobbers; diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c index e5ec305..133bc73 100644 --- a/gcc/ipa-pure-const.c +++ b/gcc/ipa-pure-const.c @@ -697,14 +697,14 @@ check_stmt (gimple_stmt_iterator *gsip, funct_state local, bool ipa) } break; case GIMPLE_ASM: - if (gimple_asm_clobbers_memory_p (stmt)) + if (gimple_asm_clobbers_memory_p (stmt->as_a_gimple_asm ())) { if (dump_file) fprintf (dump_file, " memory asm clobber is not const/pure\n"); /* Abandon all hope, ye who enter here. */ local->pure_const_state = IPA_NEITHER; } - if (gimple_asm_volatile_p (stmt)) + if (gimple_asm_volatile_p (stmt->as_a_gimple_asm ())) { if (dump_file) fprintf (dump_file, " volatile is not const/pure\n"); diff --git a/gcc/ssa-iterators.h b/gcc/ssa-iterators.h index 2c75e4a..126a46e 100644 --- a/gcc/ssa-iterators.h +++ b/gcc/ssa-iterators.h @@ -610,7 +610,7 @@ op_iter_init (ssa_op_iter *ptr, gimple stmt, int flags) ptr->numops = 1; break; case GIMPLE_ASM: - ptr->numops = gimple_asm_noutputs (stmt); + ptr->numops = gimple_asm_noutputs (stmt->as_a_gimple_asm ()); break; default: ptr->numops = 0; diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 8b8020e..6c0f157 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -1203,7 +1203,7 @@ make_goto_expr_edges (basic_block bb) static void make_gimple_asm_edges (basic_block bb) { - gimple stmt = last_stmt (bb); + gimple_asm stmt = last_stmt (bb)->as_a_gimple_asm (); int i, n = gimple_asm_nlabels (stmt); for (i = 0; i < n; ++i) @@ -1403,11 +1403,12 @@ cleanup_dead_labels (void) case GIMPLE_ASM: { - int i, n = gimple_asm_nlabels (stmt); + gimple_asm asm_stmt = stmt->as_a_gimple_asm (); + int i, n = gimple_asm_nlabels (asm_stmt); for (i = 0; i < n; ++i) { - tree cons = gimple_asm_label_op (stmt, i); + tree cons = gimple_asm_label_op (asm_stmt, i); tree label = main_block_label (TREE_VALUE (cons)); TREE_VALUE (cons) = label; } @@ -2379,7 +2380,7 @@ is_ctrl_altering_stmt (gimple t) return true; case GIMPLE_ASM: - if (gimple_asm_nlabels (t) > 0) + if (gimple_asm_nlabels (t->as_a_gimple_asm ()) > 0) return true; break; @@ -5465,12 +5466,13 @@ gimple_redirect_edge_and_branch (edge e, basic_block dest) case GIMPLE_ASM: { - int i, n = gimple_asm_nlabels (stmt); + gimple_asm asm_stmt = stmt->as_a_gimple_asm (); + int i, n = gimple_asm_nlabels (asm_stmt); tree label = NULL; for (i = 0; i < n; ++i) { - tree cons = gimple_asm_label_op (stmt, i); + tree cons = gimple_asm_label_op (asm_stmt, i); if (label_to_block (TREE_VALUE (cons)) == e->dest) { if (!label) @@ -7503,9 +7505,9 @@ need_fake_edge_p (gimple t) return true; } - if (gimple_code (t) == GIMPLE_ASM - && (gimple_asm_volatile_p (t) || gimple_asm_input_p (t))) - return true; + if (gimple_asm asm_stmt = t->dyn_cast_gimple_asm ()) + if (gimple_asm_volatile_p (asm_stmt) || gimple_asm_input_p (asm_stmt)) + return true; return false; } diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c index 55b120e..166eb1b 100644 --- a/gcc/tree-complex.c +++ b/gcc/tree-complex.c @@ -1420,7 +1420,7 @@ expand_complex_comparison (gimple_stmt_iterator *gsi, tree ar, tree ai, static void expand_complex_asm (gimple_stmt_iterator *gsi) { - gimple stmt = gsi_stmt (*gsi); + gimple_asm stmt = gsi_stmt (*gsi)->as_a_gimple_asm (); unsigned int i; for (i = 0; i < gimple_asm_noutputs (stmt); ++i) diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 01d0a7a..8626753 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -4370,7 +4370,8 @@ get_references_in_stmt (gimple stmt, vec<data_ref_loc, va_heap> *references) clobbers_memory = true; } else if (stmt_code == GIMPLE_ASM - && (gimple_asm_volatile_p (stmt) || gimple_vuse (stmt))) + && (gimple_asm_volatile_p (stmt->as_a_gimple_asm ()) + || gimple_vuse (stmt))) clobbers_memory = true; if (!gimple_vuse (stmt)) diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c index c9e9be1..c5eda1f 100644 --- a/gcc/tree-eh.c +++ b/gcc/tree-eh.c @@ -2801,7 +2801,7 @@ stmt_could_throw_p (gimple stmt) case GIMPLE_ASM: if (!cfun->can_throw_non_call_exceptions) return false; - return gimple_asm_volatile_p (stmt); + return gimple_asm_volatile_p (stmt->as_a_gimple_asm ()); default: return false; diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 9f06006..3c935b8 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -3896,7 +3896,8 @@ estimate_num_insns (gimple stmt, eni_weights *weights) case GIMPLE_ASM: { - int count = asm_str_count (gimple_asm_string (stmt)); + int count = + asm_str_count (gimple_asm_string (stmt->as_a_gimple_asm ())); /* 1000 means infinity. This avoids overflows later with very long asm statements. */ if (count > 1000) diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index ffef13d..60728aa 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -1324,21 +1324,24 @@ scan_function (void) break; case GIMPLE_ASM: - walk_stmt_load_store_addr_ops (stmt, NULL, NULL, NULL, - asm_visit_addr); - if (final_bbs) - bitmap_set_bit (final_bbs, bb->index); + { + gimple_asm asm_stmt = stmt->as_a_gimple_asm (); + walk_stmt_load_store_addr_ops (asm_stmt, NULL, NULL, NULL, + asm_visit_addr); + if (final_bbs) + bitmap_set_bit (final_bbs, bb->index); - for (i = 0; i < gimple_asm_ninputs (stmt); i++) - { - t = TREE_VALUE (gimple_asm_input_op (stmt, i)); - ret |= build_access_from_expr (t, stmt, false); - } - for (i = 0; i < gimple_asm_noutputs (stmt); i++) - { - t = TREE_VALUE (gimple_asm_output_op (stmt, i)); - ret |= build_access_from_expr (t, stmt, true); - } + for (i = 0; i < gimple_asm_ninputs (asm_stmt); i++) + { + t = TREE_VALUE (gimple_asm_input_op (asm_stmt, i)); + ret |= build_access_from_expr (t, asm_stmt, false); + } + for (i = 0; i < gimple_asm_noutputs (asm_stmt); i++) + { + t = TREE_VALUE (gimple_asm_output_op (asm_stmt, i)); + ret |= build_access_from_expr (t, asm_stmt, true); + } + } break; default: @@ -3369,16 +3372,19 @@ sra_modify_function_body (void) break; case GIMPLE_ASM: - for (i = 0; i < gimple_asm_ninputs (stmt); i++) - { - t = &TREE_VALUE (gimple_asm_input_op (stmt, i)); - modified |= sra_modify_expr (t, &gsi, false); - } - for (i = 0; i < gimple_asm_noutputs (stmt); i++) - { - t = &TREE_VALUE (gimple_asm_output_op (stmt, i)); - modified |= sra_modify_expr (t, &gsi, true); - } + { + gimple_asm asm_stmt = stmt->as_a_gimple_asm (); + for (i = 0; i < gimple_asm_ninputs (asm_stmt); i++) + { + t = &TREE_VALUE (gimple_asm_input_op (asm_stmt, i)); + modified |= sra_modify_expr (t, &gsi, false); + } + for (i = 0; i < gimple_asm_noutputs (asm_stmt); i++) + { + t = &TREE_VALUE (gimple_asm_output_op (asm_stmt, i)); + modified |= sra_modify_expr (t, &gsi, true); + } + } break; default: @@ -4635,16 +4641,19 @@ ipa_sra_modify_function_body (ipa_parm_adjustment_vec adjustments) break; case GIMPLE_ASM: - for (i = 0; i < gimple_asm_ninputs (stmt); i++) - { - t = &TREE_VALUE (gimple_asm_input_op (stmt, i)); - modified |= ipa_modify_expr (t, true, adjustments); - } - for (i = 0; i < gimple_asm_noutputs (stmt); i++) - { - t = &TREE_VALUE (gimple_asm_output_op (stmt, i)); - modified |= ipa_modify_expr (t, false, adjustments); - } + { + gimple_asm asm_stmt = stmt->as_a_gimple_asm (); + for (i = 0; i < gimple_asm_ninputs (asm_stmt); i++) + { + t = &TREE_VALUE (gimple_asm_input_op (asm_stmt, i)); + modified |= ipa_modify_expr (t, true, adjustments); + } + for (i = 0; i < gimple_asm_noutputs (asm_stmt); i++) + { + t = &TREE_VALUE (gimple_asm_output_op (asm_stmt, i)); + modified |= ipa_modify_expr (t, false, adjustments); + } + } break; default: diff --git a/gcc/tree-ssa-coalesce.c b/gcc/tree-ssa-coalesce.c index c42a8eb..fa1c3cf 100644 --- a/gcc/tree-ssa-coalesce.c +++ b/gcc/tree-ssa-coalesce.c @@ -1007,15 +1007,16 @@ create_outofssa_var_map (coalesce_list_p cl, bitmap used_in_copy) case GIMPLE_ASM: { + gimple_asm asm_stmt = stmt->as_a_gimple_asm (); unsigned long noutputs, i; unsigned long ninputs; tree *outputs, link; - noutputs = gimple_asm_noutputs (stmt); - ninputs = gimple_asm_ninputs (stmt); + noutputs = gimple_asm_noutputs (asm_stmt); + ninputs = gimple_asm_ninputs (asm_stmt); outputs = (tree *) alloca (noutputs * sizeof (tree)); for (i = 0; i < noutputs; ++i) { - link = gimple_asm_output_op (stmt, i); + link = gimple_asm_output_op (asm_stmt, i); outputs[i] = TREE_VALUE (link); } @@ -1026,7 +1027,7 @@ create_outofssa_var_map (coalesce_list_p cl, bitmap used_in_copy) char *end; unsigned long match; - link = gimple_asm_input_op (stmt, i); + link = gimple_asm_input_op (asm_stmt, i); constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link))); input = TREE_VALUE (link); diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c index 8d3fc5b..1f885c6 100644 --- a/gcc/tree-ssa-dce.c +++ b/gcc/tree-ssa-dce.c @@ -878,14 +878,14 @@ propagate_necessity (bool aggressive) mark_all_reaching_defs_necessary (stmt); } } - else if (gimple_code (stmt) == GIMPLE_ASM) + else if (gimple_asm asm_stmt = stmt->dyn_cast_gimple_asm ()) { unsigned i; mark_all_reaching_defs_necessary (stmt); /* Inputs may perform loads. */ - for (i = 0; i < gimple_asm_ninputs (stmt); ++i) + for (i = 0; i < gimple_asm_ninputs (asm_stmt); ++i) { - tree op = TREE_VALUE (gimple_asm_input_op (stmt, i)); + tree op = TREE_VALUE (gimple_asm_input_op (asm_stmt, i)); if (TREE_CODE (op) != SSA_NAME && !is_gimple_min_invariant (op) && TREE_CODE (op) != CONSTRUCTOR diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c index b95a273..d3f654c 100644 --- a/gcc/tree-ssa-operands.c +++ b/gcc/tree-ssa-operands.c @@ -662,7 +662,7 @@ maybe_add_call_vops (struct function *fn, gimple_call stmt) /* Scan operands in the ASM_EXPR stmt referred to in INFO. */ static void -get_asm_stmt_operands (struct function *fn, gimple stmt) +get_asm_stmt_operands (struct function *fn, gimple_asm stmt) { size_t i, noutputs; const char **oconstraints; @@ -915,7 +915,7 @@ parse_ssa_operands (struct function *fn, gimple stmt) switch (code) { case GIMPLE_ASM: - get_asm_stmt_operands (fn, stmt); + get_asm_stmt_operands (fn, stmt->as_a_gimple_asm ()); break; case GIMPLE_TRANSACTION: diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 01905cf..72b20f2 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -4774,17 +4774,18 @@ find_func_aliases (gimple origt) /* Handle asms conservatively by adding escape constraints to everything. */ else if (gimple_code (t) == GIMPLE_ASM) { + gimple_asm asm_stmt = t->as_a_gimple_asm (); unsigned i, noutputs; const char **oconstraints; const char *constraint; bool allows_mem, allows_reg, is_inout; - noutputs = gimple_asm_noutputs (t); + noutputs = gimple_asm_noutputs (asm_stmt); oconstraints = XALLOCAVEC (const char *, noutputs); for (i = 0; i < noutputs; ++i) { - tree link = gimple_asm_output_op (t, i); + tree link = gimple_asm_output_op (asm_stmt, i); tree op = TREE_VALUE (link); constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link))); @@ -4812,9 +4813,9 @@ find_func_aliases (gimple origt) lhsc.release (); } } - for (i = 0; i < gimple_asm_ninputs (t); ++i) + for (i = 0; i < gimple_asm_ninputs (asm_stmt); ++i) { - tree link = gimple_asm_input_op (t, i); + tree link = gimple_asm_input_op (asm_stmt, i); tree op = TREE_VALUE (link); constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link))); diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c index 0a4af13..03c6b4a 100644 --- a/gcc/tree-ssa-threadedge.c +++ b/gcc/tree-ssa-threadedge.c @@ -370,7 +370,8 @@ record_temporary_equivalences_from_stmts_at_dest (edge e, /* If the statement has volatile operands, then we assume we can not thread through this block. This is overly conservative in some ways. */ - if (gimple_code (stmt) == GIMPLE_ASM && gimple_asm_volatile_p (stmt)) + if (gimple_code (stmt) == GIMPLE_ASM + && gimple_asm_volatile_p (stmt->as_a_gimple_asm ())) return NULL; /* If duplicating this block is going to cause too much code diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 2927e0b..7d0e844 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1501,9 +1501,10 @@ execute_update_addresses_taken (void) else if (code == GIMPLE_ASM) { - for (i = 0; i < gimple_asm_noutputs (stmt); ++i) + gimple_asm asm_stmt = stmt->as_a_gimple_asm (); + for (i = 0; i < gimple_asm_noutputs (asm_stmt); ++i) { - tree link = gimple_asm_output_op (stmt, i); + tree link = gimple_asm_output_op (asm_stmt, i); tree lhs = TREE_VALUE (link); if (TREE_CODE (lhs) != SSA_NAME) { @@ -1518,9 +1519,9 @@ execute_update_addresses_taken (void) bitmap_set_bit (not_reg_needs, DECL_UID (decl)); } } - for (i = 0; i < gimple_asm_ninputs (stmt); ++i) + for (i = 0; i < gimple_asm_ninputs (asm_stmt); ++i) { - tree link = gimple_asm_input_op (stmt, i); + tree link = gimple_asm_input_op (asm_stmt, i); if ((decl = non_rewritable_mem_ref_base (TREE_VALUE (link)))) bitmap_set_bit (not_reg_needs, DECL_UID (decl)); } @@ -1631,16 +1632,17 @@ execute_update_addresses_taken (void) else if (gimple_code (stmt) == GIMPLE_ASM) { + gimple_asm asm_stmt = stmt->as_a_gimple_asm (); unsigned i; - for (i = 0; i < gimple_asm_noutputs (stmt); ++i) + for (i = 0; i < gimple_asm_noutputs (asm_stmt); ++i) { - tree link = gimple_asm_output_op (stmt, i); + tree link = gimple_asm_output_op (asm_stmt, i); maybe_rewrite_mem_ref_base (&TREE_VALUE (link), suitable_for_renaming); } - for (i = 0; i < gimple_asm_ninputs (stmt); ++i) + for (i = 0; i < gimple_asm_ninputs (asm_stmt); ++i) { - tree link = gimple_asm_input_op (stmt, i); + tree link = gimple_asm_input_op (asm_stmt, i); maybe_rewrite_mem_ref_base (&TREE_VALUE (link), suitable_for_renaming); } -- 1.8.5.3