From 34c57a7f73e14095364a8863070f8e8c9f62cdc4 Mon Sep 17 00:00:00 2001 From: Luc Van Oostenryck Date: Sat, 20 Feb 2021 10:04:34 +0100 Subject: asm-mem: does it clobber memory? 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 --- linearize.c | 8 +++++++- linearize.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/linearize.c b/linearize.c index 33d641b4..4140b60c 100644 --- a/linearize.c +++ b/linearize.c @@ -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; } diff --git a/linearize.h b/linearize.h index a77e4b3e..fb513276 100644 --- a/linearize.h +++ b/linearize.h @@ -150,6 +150,7 @@ struct instruction { struct /* asm */ { const char *string; struct asm_rules *asm_rules; + int clobber_memory:1; }; }; }; -- cgit 1.2.3-korg