[PATCH 15/18] asm: linearization of output memory operands is different

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

 



ASM memory operands are considered by GCC as some kind of implicit
reference. Their linearization should thus not create any storage
statement: the storage is done by the ASM code itself.

Adjust the linearization of such operands accordingly.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 linearize.c                   | 13 +++++++++----
 validation/linear/asm-memop.c |  1 -
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/linearize.c b/linearize.c
index 7724350ba..68be3ab1e 100644
--- a/linearize.c
+++ b/linearize.c
@@ -2089,12 +2089,17 @@ static void add_asm_input(struct entrypoint *ep, struct instruction *insn, struc
 static void add_asm_output(struct entrypoint *ep, struct instruction *insn, struct asm_operand *op)
 {
 	struct access_data ad = { NULL, };
-	pseudo_t pseudo = alloc_pseudo(insn);
+	pseudo_t pseudo;
 	struct asm_constraint *rule;
 
-	if (!op->expr || !linearize_address_gen(ep, op->expr, &ad))
-		return;
-	linearize_store_gen(ep, pseudo, &ad);
+	if (op->is_memory) {
+		pseudo = linearize_expression(ep, op->expr);
+	} else {
+		if (!linearize_address_gen(ep, op->expr, &ad))
+			return;
+		pseudo = alloc_pseudo(insn);
+		linearize_store_gen(ep, pseudo, &ad);
+	}
 	rule = __alloc_asm_constraint(0);
 	rule->ident = op->name;
 	rule->constraint = op->constraint ? op->constraint->string->data : "";
diff --git a/validation/linear/asm-memop.c b/validation/linear/asm-memop.c
index 97df98e22..245c8d0f0 100644
--- a/validation/linear/asm-memop.c
+++ b/validation/linear/asm-memop.c
@@ -8,7 +8,6 @@ static int foo(int *p)
 /*
  * check-name: linear-asm-memop
  * check-command: test-linearize $file
- * check-known-to-fail
  *
  * check-output-start
 foo:
-- 
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