diff mbox series

[4/5] asm-mem: does it output to memory?

Message ID 20210221223452.8075-5-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show
Series teach memory simplification about ASM instructions | expand

Commit Message

Luc Van Oostenryck Feb. 21, 2021, 10:34 p.m. UTC
If an asm statement have a memory output operand, it modifies memory.

Since this information is needed during memops simplification,
add this info directly in the corresponding instruction,
avoiding the need to scan the output operands list each time.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 linearize.c | 1 +
 linearize.h | 1 +
 2 files changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/linearize.c b/linearize.c
index 4140b60caebd..0c9b0e59cc4b 100644
--- a/linearize.c
+++ b/linearize.c
@@ -2153,6 +2153,7 @@  static void add_asm_output_address(struct entrypoint *ep, struct instruction *in
 
 	pseudo = linearize_expression(ep, op->expr);
 	add_asm_rule(insn, &insn->asm_rules->outputs, op, pseudo);
+	insn->output_memory = 1;
 }
 
 static void add_asm_output(struct entrypoint *ep, struct instruction *insn, struct asm_operand *op)
diff --git a/linearize.h b/linearize.h
index fb51327684bb..cf0cf066a8e5 100644
--- a/linearize.h
+++ b/linearize.h
@@ -151,6 +151,7 @@  struct instruction {
 			const char *string;
 			struct asm_rules *asm_rules;
 			int clobber_memory:1;
+			int output_memory:1;
 		};
 	};
 };