[gimple-classes, committed 21/92] Introduce gimple_asm
David Malcolm
dmalcolm@redhat.com
Mon Oct 27 20:54:00 GMT 2014
This corresponds to:
[PATCH 23/89] Introduce gimple_asm
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01234.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK after fixing up the naming/const stuff as discussed for prior
> patches.
> That applies to 22-30. Make sure to take care of
> the pretty printers per Trevor's comments as well. He indicated those
> were missing in a couple of those patches.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00628.html
gcc/
* coretypes.h (gimple_asm): New typedef.
(const_gimple_asm): New typedef.
* gimple.h (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): Replace a check for
GIMPLE_ASM with a dyn_cast<gimple_asm>, introducing a new local
"asm_stmt", using it in place of "t" for typesafety.
* 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/ChangeLog.gimple-classes | 123 ++++++++++++++++++++++++++++++++++++
gcc/cfgexpand.c | 4 +-
gcc/coretypes.h | 4 ++
gcc/gimple-fold.c | 20 +++---
gcc/gimple-pretty-print.c | 4 +-
gcc/gimple-streamer-in.c | 5 +-
gcc/gimple-streamer-out.c | 15 +++--
gcc/gimple-walk.c | 16 ++---
gcc/gimple.c | 14 ++---
gcc/gimple.h | 146 +++++++++++++++++--------------------------
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 | 10 +--
gcc/tree-ssa-threadedge.c | 3 +-
gcc/tree-ssa.c | 18 +++---
26 files changed, 323 insertions(+), 202 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index bba6c7d..bd88371 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,128 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_asm
+
+ * coretypes.h (gimple_asm): New typedef.
+ (const_gimple_asm): New typedef.
+
+ * gimple.h (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): Replace a check for
+ GIMPLE_ASM with a dyn_cast<gimple_asm>, introducing a new local
+ "asm_stmt", using it in place of "t" for typesafety.
+
+ * 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.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_goto
* coretypes.h (gimple_goto): New typedef.
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index e656ed5..d93c888 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -2927,7 +2927,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;
@@ -3212,7 +3212,7 @@ expand_gimple_stmt_1 (gimple stmt)
expand_case (as_a <gimple_switch> (stmt));
break;
case GIMPLE_ASM:
- expand_asm_stmt (stmt);
+ expand_asm_stmt (as_a <gimple_asm> (stmt));
break;
case GIMPLE_CALL:
expand_call_stmt (as_a <gimple_call> (stmt));
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 653343a..98636bb 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -114,6 +114,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 56b1e5b..c6ba019 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -2855,17 +2855,18 @@ fold_stmt_1 (gimple_stmt_iterator *gsi, bool inplace)
}
case GIMPLE_ASM:
{
- for (i = 0; i < gimple_asm_noutputs (stmt); ++i)
+ gimple_asm asm_stmt = as_a <gimple_asm> (stmt);
+ 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);
if (REFERENCE_CLASS_P (op)
&& maybe_canonicalize_mem_ref_addr (&TREE_VALUE (link)))
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);
if ((REFERENCE_CLASS_P (op)
|| TREE_CODE (op) == ADDR_EXPR)
@@ -2935,17 +2936,18 @@ fold_stmt_1 (gimple_stmt_iterator *gsi, bool inplace)
case GIMPLE_ASM:
/* Fold *& in asm operands. */
{
+ gimple_asm asm_stmt = as_a <gimple_asm> (stmt);
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)));
@@ -2956,9 +2958,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 47772d6..d8d7703 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -1606,7 +1606,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;
@@ -2085,7 +2085,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, as_a <gimple_asm> (gs), spc, flags);
break;
case GIMPLE_ASSIGN:
diff --git a/gcc/gimple-streamer-in.c b/gcc/gimple-streamer-in.c
index 2741ea7..c297ec3 100644
--- a/gcc/gimple-streamer-in.c
+++ b/gcc/gimple-streamer-in.c
@@ -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 = as_a <gimple_asm> (stmt);
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..77fc3fa 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 = as_a <gimple_asm> (stmt);
+ 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 661a69e..40d2145 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 (as_a <gimple_asm> (stmt), 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 = dyn_cast <gimple_asm> (stmt))
{
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 0e5e473..2d86191 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -542,11 +542,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
@@ -580,12 +580,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,
@@ -1821,7 +1821,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 (as_a <const_gimple_asm> (s)))
return true;
if (is_gimple_call (s))
@@ -1862,7 +1862,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 (as_a <gimple_asm> (s));
case GIMPLE_CALL:
t = gimple_call_fndecl (s);
@@ -2477,7 +2477,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 128baf5..d2dc7ce 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1322,9 +1322,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);
@@ -1401,7 +1401,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);
@@ -3339,218 +3339,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..08d2b9c 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 = as_a <gimple_asm> (stmt);
+ 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 af64e45..bed3606 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -4918,7 +4918,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 6beca09..8375381 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -698,14 +698,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 (as_a <gimple_asm> (stmt)))
{
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 (as_a <gimple_asm> (stmt)))
{
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..f332b7c 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 (as_a <gimple_asm> (stmt));
break;
default:
ptr->numops = 0;
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 1652075..8e9262f 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -1247,7 +1247,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 = as_a <gimple_asm> (last_stmt (bb));
int i, n = gimple_asm_nlabels (stmt);
for (i = 0; i < n; ++i)
@@ -1447,11 +1447,12 @@ cleanup_dead_labels (void)
case GIMPLE_ASM:
{
- int i, n = gimple_asm_nlabels (stmt);
+ gimple_asm asm_stmt = as_a <gimple_asm> (stmt);
+ 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;
}
@@ -2414,7 +2415,7 @@ is_ctrl_altering_stmt (gimple t)
return true;
case GIMPLE_ASM:
- if (gimple_asm_nlabels (t) > 0)
+ if (gimple_asm_nlabels (as_a <gimple_asm> (t)) > 0)
return true;
break;
@@ -5535,12 +5536,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 = as_a <gimple_asm> (stmt);
+ 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)
@@ -7567,9 +7569,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 = dyn_cast <gimple_asm> (t))
+ 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 c259504..d2b4f01 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -1419,7 +1419,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 = as_a <gimple_asm> (gsi_stmt (*gsi));
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 89aeb30..9bd3c17 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -4388,7 +4388,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 (as_a <gimple_asm> (stmt))
+ || gimple_vuse (stmt)))
clobbers_memory = true;
if (!gimple_vuse (stmt))
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index df3f613..9769225 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -2773,7 +2773,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 (as_a <gimple_asm> (stmt));
default:
return false;
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 15b2cdd..2c7d6b7 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -3944,7 +3944,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 (as_a <gimple_asm> (stmt)));
/* 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 fb24114..67c4247 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -1325,21 +1325,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 = as_a <gimple_asm> (stmt);
+ 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:
@@ -3411,16 +3414,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 = as_a <gimple_asm> (stmt);
+ 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:
@@ -4672,16 +4678,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 = as_a <gimple_asm> (stmt);
+ 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 e4e2201..f043096 100644
--- a/gcc/tree-ssa-coalesce.c
+++ b/gcc/tree-ssa-coalesce.c
@@ -1008,15 +1008,16 @@ create_outofssa_var_map (coalesce_list_p cl, bitmap used_in_copy)
case GIMPLE_ASM:
{
+ gimple_asm asm_stmt = as_a <gimple_asm> (stmt);
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);
}
@@ -1027,7 +1028,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 f95c0ea..8e8cd57 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -882,14 +882,14 @@ propagate_necessity (bool aggressive)
mark_all_reaching_defs_necessary (stmt);
}
}
- else if (gimple_code (stmt) == GIMPLE_ASM)
+ else if (gimple_asm asm_stmt = dyn_cast <gimple_asm> (stmt))
{
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 1e59b76..5f20c66 100644
--- a/gcc/tree-ssa-operands.c
+++ b/gcc/tree-ssa-operands.c
@@ -655,7 +655,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;
@@ -909,7 +909,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, as_a <gimple_asm> (stmt));
break;
case GIMPLE_TRANSACTION:
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 4bde124..a130268 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -4752,19 +4752,19 @@ find_func_aliases (struct function *fn, gimple origt)
}
}
/* Handle asms conservatively by adding escape constraints to everything. */
- else if (gimple_code (t) == GIMPLE_ASM)
+ else if (gimple_asm asm_stmt = dyn_cast <gimple_asm> (t))
{
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)));
@@ -4791,9 +4791,9 @@ find_func_aliases (struct function *fn, gimple origt)
process_constraint (new_constraint (*lhsp, rhsc));
}
}
- 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 45083df..50cc729 100644
--- a/gcc/tree-ssa-threadedge.c
+++ b/gcc/tree-ssa-threadedge.c
@@ -345,7 +345,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 (as_a <gimple_asm> (stmt)))
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 a907426..6babaee 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -1454,9 +1454,10 @@ execute_update_addresses_taken (void)
else if (code == GIMPLE_ASM)
{
- for (i = 0; i < gimple_asm_noutputs (stmt); ++i)
+ gimple_asm asm_stmt = as_a <gimple_asm> (stmt);
+ 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)
{
@@ -1471,9 +1472,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));
}
@@ -1584,16 +1585,17 @@ execute_update_addresses_taken (void)
else if (gimple_code (stmt) == GIMPLE_ASM)
{
+ gimple_asm asm_stmt = as_a <gimple_asm> (stmt);
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
More information about the Gcc-patches
mailing list