b43-asm: Make use of complex immediates as memory offsets possible.
authorMichael Buesch <mb@bu3sch.de>
Sun, 27 Jan 2008 18:41:45 +0000 (19:41 +0100)
committerMichael Buesch <mb@bu3sch.de>
Sun, 27 Jan 2008 18:41:45 +0000 (19:41 +0100)
Signed-off-by: Michael Buesch <mb@bu3sch.de>
assembler/parser.y
assembler/test.asm

index f00b2da4dec31266d2e64b6e6599514525ace4e8..c589195369c2ce536afecff77a8a460031238326 100644 (file)
@@ -75,6 +75,7 @@ line  : line_terminator {
 /* Allow terminating lines with the "|" char */
 line_terminator : /* Nothing */
                | BITW_OR line_terminator
+               ;
 
 section_switch : SECTION_TEXT {
                        section = SECTION_TEXT;
@@ -1083,27 +1084,26 @@ reg             : GPR regnr {
                  }
                ;
 
-mem            : BRACK_OPEN hexnum_decnum BRACK_CLOSE {
+mem            : BRACK_OPEN imm BRACK_CLOSE {
                        struct memory *mem = xmalloc(sizeof(struct memory));
+                       struct immediate *offset_imm = $2;
                        mem->type = MEM_DIRECT;
-                       mem->offset = (unsigned long)$2;
+                       mem->offset = offset_imm->imm;
+                       free(offset_imm);
                        $$ = mem;
                  }
-               | BRACK_OPEN hexnum_decnum COMMA OFFR regnr BRACK_CLOSE {
+               | BRACK_OPEN imm COMMA OFFR regnr BRACK_CLOSE {
                        struct memory *mem = xmalloc(sizeof(struct memory));
+                       struct immediate *offset_imm = $2;
                        mem->type = MEM_INDIRECT;
-                       mem->offset = (unsigned long)$2;
+                       mem->offset = offset_imm->imm;
+                       free(offset_imm);
                        mem->offr_nr = (unsigned long)$5;
                        $$ = mem;
                  }
                ;
 
-imm            : hexnum {
-                       struct immediate *imm = xmalloc(sizeof(struct immediate));
-                       imm->imm = (unsigned long)$1;
-                       $$ = imm;
-                 }
-               | decnum {
+imm            : hexnum_decnum {
                        struct immediate *imm = xmalloc(sizeof(struct immediate));
                        imm->imm = (unsigned long)$1;
                        $$ = imm;
index 8f78893f4d40089d690f94853b9b4cdfbbc8c288..873b7612847c887432d45dd0d4c1f8df861ee457 100644 (file)
@@ -164,6 +164,7 @@ function_b:
        or      [0],0,[0]               ; Can have one mem input and one mem output
        mov     testlabel, r0           ; Can use label as immediate value
        mov r0,r1|mov r2, r3            ; | does also seperate instructions
+       mov     [(1+1)],[(2+2),off0]    ; Can use complex immediates as memory offsets
 
 
 ; The .initvals section generates an "Initial Values" file