diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2019-01-25 01:00:03 +0100 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2019-09-27 02:17:34 +0200 |
| commit | 279a25bad3a6868a1fac46501df8311e37eb72a0 (patch) | |
| tree | c61fbb553e8c251cd67f28e65fd4ff3166d923ff /linearize.c | |
| parent | 7aeb06b4bff797da4ea85a18738a2fd1f660d744 (diff) | |
| download | sparse-dev-279a25bad3a6868a1fac46501df8311e37eb72a0.tar.gz | |
asm: use a specific struct for asm operands
Before commit 756731e9 ("use a specific struct for asm operands")
ASM operands where stored as a list of n times 3 expressions.
After this commit, the triplets where stored inside a single
expression of type EXPR_ASM_OPERAND.
However, while this improved the parsing and use of ASM operands
it needlessly reuse 'struct expression' for something that is not
an expression at all.
Fix this by really using a specific struct for ASM operands.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'linearize.c')
| -rw-r--r-- | linearize.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/linearize.c b/linearize.c index 415bf7e5..69f2dfe6 100644 --- a/linearize.c +++ b/linearize.c @@ -2106,9 +2106,10 @@ static void add_asm_output(struct entrypoint *ep, struct instruction *insn, stru static pseudo_t linearize_asm_statement(struct entrypoint *ep, struct statement *stmt) { - struct expression *expr; struct instruction *insn; + struct expression *expr; struct asm_rules *rules; + struct asm_operand *op; const char *constraint; insn = alloc_instruction(OP_ASM, 0); @@ -2123,18 +2124,18 @@ static pseudo_t linearize_asm_statement(struct entrypoint *ep, struct statement insn->asm_rules = rules; /* Gather the inputs.. */ - FOR_EACH_PTR(stmt->asm_inputs, expr) { - constraint = expr->constraint ? expr->constraint->string->data : ""; - add_asm_input(ep, insn, expr->expr, constraint, expr->name); - } END_FOR_EACH_PTR(expr); + FOR_EACH_PTR(stmt->asm_inputs, op) { + constraint = op->constraint ? op->constraint->string->data : ""; + add_asm_input(ep, insn, op->expr, constraint, op->name); + } END_FOR_EACH_PTR(op); add_one_insn(ep, insn); /* Assign the outputs */ - FOR_EACH_PTR(stmt->asm_outputs, expr) { - constraint = expr->constraint ? expr->constraint->string->data : ""; - add_asm_output(ep, insn, expr->expr, constraint, expr->name); - } END_FOR_EACH_PTR(expr); + FOR_EACH_PTR(stmt->asm_outputs, op) { + constraint = op->constraint ? op->constraint->string->data : ""; + add_asm_output(ep, insn, op->expr, constraint, op->name); + } END_FOR_EACH_PTR(op); return VOID; } |
