[PATCH 16/18] asm: fix liveness memory operand

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since memory operands are only some kind of reference, the pseudo
in an output operand is not defined by the statement, the reference
is only used.

Fix the liveness processing accordingly.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 linearize.c | 1 +
 linearize.h | 1 +
 liveness.c  | 5 ++++-
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/linearize.c b/linearize.c
index 68be3ab1e..09b1c7ee8 100644
--- a/linearize.c
+++ b/linearize.c
@@ -2101,6 +2101,7 @@ static void add_asm_output(struct entrypoint *ep, struct instruction *insn, stru
 		linearize_store_gen(ep, pseudo, &ad);
 	}
 	rule = __alloc_asm_constraint(0);
+	rule->is_memory = op->is_memory;
 	rule->ident = op->name;
 	rule->constraint = op->constraint ? op->constraint->string->data : "";
 	use_pseudo(insn, pseudo, &rule->pseudo);
diff --git a/linearize.h b/linearize.h
index 89da3db6e..76efd0b47 100644
--- a/linearize.h
+++ b/linearize.h
@@ -68,6 +68,7 @@ struct asm_constraint {
 	pseudo_t pseudo;
 	const char *constraint;
 	const struct ident *ident;
+	unsigned int is_memory:1;
 };
 
 DECLARE_ALLOCATOR(asm_constraint);
diff --git a/liveness.c b/liveness.c
index 93a7cc300..33cd04831 100644
--- a/liveness.c
+++ b/liveness.c
@@ -39,7 +39,10 @@ static void asm_liveness(struct basic_block *bb, struct instruction *insn,
 	} END_FOR_EACH_PTR(entry);
 		
 	FOR_EACH_PTR(insn->asm_rules->outputs, entry) {
-		def(bb, entry->pseudo);
+		if (entry->is_memory)
+			use(bb, entry->pseudo);
+		else
+			def(bb, entry->pseudo);
 	} END_FOR_EACH_PTR(entry);
 }
 
-- 
2.23.0




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux