[PATCH 17/18] asm: fix missing expansion of asm statements

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

 



The operands of extended ASM need to be expanded, exactly
like any other expression. For example, without this expansion
expressions with __builtin_compatible_types_p() can't be
linearized and will issue a 'warning unknown expression".

So, add the missing expansion of ASM operands.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 expand.c                 | 18 +++++++++++++++++-
 validation/expand/asm0.c |  1 -
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/expand.c b/expand.c
index 487a44943..ac6686e45 100644
--- a/expand.c
+++ b/expand.c
@@ -1160,6 +1160,22 @@ static int expand_if_statement(struct statement *stmt)
 	return SIDE_EFFECTS;
 }
 
+static int expand_asm_statement(struct statement *stmt)
+{
+	struct asm_operand *op;
+	int cost = 0;
+
+	FOR_EACH_PTR(stmt->asm_outputs, op) {
+		cost += expand_expression(op->expr);
+	} END_FOR_EACH_PTR(op);
+
+	FOR_EACH_PTR(stmt->asm_inputs, op) {
+		cost += expand_expression(op->expr);
+	} END_FOR_EACH_PTR(op);
+
+	return cost;
+}
+
 /*
  * Expanding a compound statement is really just
  * about adding up the costs of each individual
@@ -1250,7 +1266,7 @@ static int expand_statement(struct statement *stmt)
 	case STMT_NONE:
 		break;
 	case STMT_ASM:
-		/* FIXME! Do the asm parameter evaluation! */
+		expand_asm_statement(stmt);
 		break;
 	case STMT_CONTEXT:
 		expand_expression(stmt->expression);
diff --git a/validation/expand/asm0.c b/validation/expand/asm0.c
index 0664b6224..568a4d198 100644
--- a/validation/expand/asm0.c
+++ b/validation/expand/asm0.c
@@ -7,7 +7,6 @@ static void foo(void)
 /*
  * check-name: expand-asm0
  * 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