tinycc-devel
[Top][All Lists]
Advanced

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

[Tinycc-devel] [PATCH 3/3] arm-asm: Allow implicit offset 0 in input of


From: Danny Milosavljevic
Subject: [Tinycc-devel] [PATCH 3/3] arm-asm: Allow implicit offset 0 in input of asm_single_data_transfer_opcode
Date: Tue, 5 Jan 2021 01:06:40 +0100

---
 arm-asm.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/arm-asm.c b/arm-asm.c
index 5b64fa6..0f7340c 100644
--- a/arm-asm.c
+++ b/arm-asm.c
@@ -992,15 +992,19 @@ static void asm_single_data_transfer_opcode(TCCState *s1, 
int token)
         closed_bracket = 1;
         // exclam = 1; // implicit in hardware; don't do it in software
     }
-    if (tok != ',')
-        expect("','");
-    else
+    if (tok == ',') {
         next(); // skip ','
-    if (tok == '-') {
-        op2_minus = 1;
-        next();
+        if (tok == '-') {
+            op2_minus = 1;
+            next();
+        }
+        parse_operand(s1, &ops[2]);
+    } else {
+        // end of input expression in brackets--assume 0 offset
+        ops[2].type = OP_IM8;
+        ops[2].e.v = 0;
+        opcode |= 1 << 24; // add offset before transfer
     }
-    parse_operand(s1, &ops[2]);
     if (!closed_bracket) {
         if (tok != ']')
             expect("']'");



reply via email to

[Prev in Thread] Current Thread [Next in Thread]