@@ -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 ());
@@ -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;
@@ -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)));
@@ -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:
@@ -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;
}
@@ -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:
@@ -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)
@@ -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;
@@ -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;
}
@@ -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);
@@ -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;
@@ -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");
@@ -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;
@@ -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;
}
@@ -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)
@@ -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))
@@ -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;
@@ -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)
@@ -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:
@@ -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);
@@ -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
@@ -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:
@@ -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)));
@@ -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
@@ -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);
}