Update the hi/lo syntax to be a bit more standard.
authorDavid Given <dg@cowlark.com>
Sun, 15 Jan 2017 09:21:02 +0000 (10:21 +0100)
committerDavid Given <dg@cowlark.com>
Sun, 15 Jan 2017 09:21:02 +0000 (10:21 +0100)
mach/powerpc/as/mach3.c
mach/powerpc/as/mach4.c
mach/powerpc/ncg/table

index 62ed204..a40e249 100644 (file)
 0,     OP_LA,                 0,                                       "li",
 0,     OP_RS_RA_RA_C,         31<<26 | 444<<1,                         "mr",
 0,     OP_POWERPC_FIXUP,      0,                                       ".powerpcfixup",
-0,     OP_HI,                 0,                                       "hi",
-0,     OP_LO,                 0,                                       "lo",
+0,     OP_HI,                 0,                                       "ha16",
+0,     OP_LO,                 0,                                       "lo16",
 
 /* Branch processor instructions (page 20) */
 
index d9e4b03..0168775 100644 (file)
@@ -76,12 +76,12 @@ e16
                        serror("16-bit value out of range");
                $$ = (uint16_t) $1;
        }
-       | OP_HI expr
+       | OP_HI ASC_LPAR expr ASC_RPAR
        {
                /* If this is a symbol reference, discard the symbol and keep only the
                 * offset part. */
-               quad type = $2.typ & S_TYP;
-               quad val = $2.val;
+               quad type = $3.typ & S_TYP;
+               quad val = $3.val;
 
                /* If the assembler stored a symbol for relocation later, we need to
                 * abandon it (because we're not going to generate a relocation). */
@@ -90,10 +90,10 @@ e16
 
                $$ = ((quad)val) >> 16;
        }
-       | OP_LO expr
+       | OP_LO ASC_LPAR expr ASC_RPAR
        {
-               quad type = $2.typ & S_TYP;
-               quad val = $2.val;
+               quad type = $3.typ & S_TYP;
+               quad val = $3.val;
 
                /* If the assembler stored a symbol for relocation later, we need to
                 * abandon it (because we're not going to generate a relocation). */
index 29353a2..a907e42 100644 (file)
@@ -169,14 +169,14 @@ TOKENS
 /* Used only in instruction descriptions (to generate the correct syntax). */
 
        GPRINDIRECT        = { GPR reg; INT off; }    4    off "(" reg ")".
-       GPRINDIRECT_OFFSET_LO = { GPR reg; ADDR adr; } 4   "lo [" adr "](" reg ")".
+       GPRINDIRECT_OFFSET_LO = { GPR reg; ADDR adr; } 4   "lo16[" adr "](" reg ")".
        CONST              = { INT val; }             4    val.
 
 /* Primitives */
 
        LABEL              = { ADDR adr; }            4    adr.
-       LABEL_OFFSET_HI    = { ADDR adr; }            4    "hi " adr.
-       LABEL_OFFSET_LO    = { ADDR adr; }            4    "lo " adr.
+       LABEL_OFFSET_HI    = { ADDR adr; }            4    "ha16[" adr "]".
+       LABEL_OFFSET_LO    = { ADDR adr; }            4    "lo16[" adr "]".
        LOCAL              = { INT off; }             4.
 
 /* Allows us to use regvar() to refer to registers */