From b5a57cd15c31f09ffb09667c2abf1a1e4c6aad4a Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 20 May 2023 13:52:24 +0900 Subject: [PATCH] [qfcc] Use assign_statement for v6p call arguments I had written assign_statement a while after the call handling code and didn't think to modify the call code. This makes for more consistent code. --- tools/qfcc/source/statements.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/tools/qfcc/source/statements.c b/tools/qfcc/source/statements.c index 8922432f1..68bfd6b4e 100644 --- a/tools/qfcc/source/statements.c +++ b/tools/qfcc/source/statements.c @@ -751,6 +751,15 @@ static sblock_t *addressing_mode (sblock_t *sblock, expr_t *ref, static statement_t *lea_statement (operand_t *pointer, operand_t *offset, expr_t *e); +static statement_t * +assign_statement (operand_t *dst, operand_t *src, expr_t *e) +{ + statement_t *s = new_statement (st_assign, "assign", e); + s->opa = dst; + s->opc = src; + return s; +} + static sblock_t * expr_assign_copy (sblock_t *sblock, expr_t *e, operand_t **op, operand_t *src) { @@ -796,7 +805,7 @@ expr_assign_copy (sblock_t *sblock, expr_t *e, operand_t **op, operand_t *src) } if (!src) { // This is the very right-hand node of a non-nil assignment chain - // (there may be more chains somwhere within src_expr, but they + // (there may be more chains somewhere within src_expr, but they // are not part of this chain as they are separated by another // expression). sblock = statement_subexpr (sblock, src_expr, &src); @@ -837,6 +846,7 @@ expr_assign_copy (sblock_t *sblock, expr_t *e, operand_t **op, operand_t *src) // FIXME this probably needs to be more agressive // shouldn't emit code... sblock = statement_subexpr (sblock, dst_expr, &def); + //FIXME is this even necessary? if it is, should use copy_operand sblock = statement_subexpr (sblock, dst_expr, &kill); } dst_expr = expr_file_line (address_expr (dst_expr, 0), e); @@ -1045,9 +1055,7 @@ expr_call_v6p (sblock_t *sblock, expr_t *call, operand_t **op) arg = p; sblock = statement_subexpr (sblock, a, &arg); if (arg != p) { - s = new_statement (st_assign, "assign", a); - s->opa = p; - s->opc = arg; + s = assign_statement (p, arg, a); sblock_add_statement (sblock, s); } } @@ -1503,15 +1511,6 @@ load_statement (operand_t *ptr, operand_t *offs, operand_t *op, expr_t *e) return s; } -static statement_t * -assign_statement (operand_t *dst, operand_t *src, expr_t *e) -{ - statement_t *s = new_statement (st_assign, "assign", e); - s->opa = dst; - s->opc = src; - return s; -} - static sblock_t * expr_deref (sblock_t *sblock, expr_t *deref, operand_t **op) {