@@ -2174,7 +2174,7 @@ static void add_asm_output(struct entrypoint *ep, struct instruction *insn, stru
static pseudo_t linearize_asm_statement(struct entrypoint *ep, struct statement *stmt)
{
struct instruction *insn;
- struct expression *expr;
+ struct expression *expr, *clob;
struct asm_rules *rules;
struct asm_operand *op;
@@ -2206,6 +2206,12 @@ static pseudo_t linearize_asm_statement(struct entrypoint *ep, struct statement
add_asm_output(ep, insn, op);
} END_FOR_EACH_PTR(op);
+ /* and finally, look if it clobbers memory */
+ FOR_EACH_PTR(stmt->asm_clobbers, clob) {
+ if (!strcmp(clob->string->data, "memory"))
+ insn->clobber_memory = 1;
+ } END_FOR_EACH_PTR(clob);
+
return VOID;
}
@@ -150,6 +150,7 @@ struct instruction {
struct /* asm */ {
const char *string;
struct asm_rules *asm_rules;
+ int clobber_memory:1;
};
};
};
An asm statement can specify that it clobbers memory. Add this info directly in the corresponding instruction, avoiding the need to scan the clobber list each time. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- linearize.c | 8 +++++++- linearize.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-)