diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2019-01-14 16:02:06 +0100 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2019-09-27 03:29:34 +0200 |
commit | ad1e7dc055a1a177ca79c72de3c8c87594abba6c (patch) | |
tree | de599d0c308816586c31b8a62950ff7a4724cf4c | |
parent | 75bcc7dc0fe1f09ae0340ed928f8f4033bd0ba9e (diff) | |
download | sparse-ad1e7dc055a1a177ca79c72de3c8c87594abba6c.tar.gz |
asm: fix missing expansion of asm statements
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@gmail.com>
-rw-r--r-- | expand.c | 18 | ||||
-rw-r--r-- | validation/expand/asm0.c | 1 |
2 files changed, 17 insertions, 2 deletions
@@ -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 0664b622..568a4d19 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: |