Update the hi/lo syntax to be a bit more standard.

This commit is contained in:
David Given 2017-01-15 10:21:02 +01:00
parent 8edbff9795
commit 3c0bc205fc
3 changed files with 11 additions and 11 deletions

View file

@ -103,8 +103,8 @@
0, OP_LA, 0, "li", 0, OP_LA, 0, "li",
0, OP_RS_RA_RA_C, 31<<26 | 444<<1, "mr", 0, OP_RS_RA_RA_C, 31<<26 | 444<<1, "mr",
0, OP_POWERPC_FIXUP, 0, ".powerpcfixup", 0, OP_POWERPC_FIXUP, 0, ".powerpcfixup",
0, OP_HI, 0, "hi", 0, OP_HI, 0, "ha16",
0, OP_LO, 0, "lo", 0, OP_LO, 0, "lo16",
/* Branch processor instructions (page 20) */ /* Branch processor instructions (page 20) */

View file

@ -76,12 +76,12 @@ e16
serror("16-bit value out of range"); serror("16-bit value out of range");
$$ = (uint16_t) $1; $$ = (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 /* If this is a symbol reference, discard the symbol and keep only the
* offset part. */ * offset part. */
quad type = $2.typ & S_TYP; quad type = $3.typ & S_TYP;
quad val = $2.val; quad val = $3.val;
/* If the assembler stored a symbol for relocation later, we need to /* If the assembler stored a symbol for relocation later, we need to
* abandon it (because we're not going to generate a relocation). */ * abandon it (because we're not going to generate a relocation). */
@ -90,10 +90,10 @@ e16
$$ = ((quad)val) >> 16; $$ = ((quad)val) >> 16;
} }
| OP_LO expr | OP_LO ASC_LPAR expr ASC_RPAR
{ {
quad type = $2.typ & S_TYP; quad type = $3.typ & S_TYP;
quad val = $2.val; quad val = $3.val;
/* If the assembler stored a symbol for relocation later, we need to /* If the assembler stored a symbol for relocation later, we need to
* abandon it (because we're not going to generate a relocation). */ * abandon it (because we're not going to generate a relocation). */

View file

@ -169,14 +169,14 @@ TOKENS
/* Used only in instruction descriptions (to generate the correct syntax). */ /* Used only in instruction descriptions (to generate the correct syntax). */
GPRINDIRECT = { GPR reg; INT off; } 4 off "(" reg ")". 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. CONST = { INT val; } 4 val.
/* Primitives */ /* Primitives */
LABEL = { ADDR adr; } 4 adr. LABEL = { ADDR adr; } 4 adr.
LABEL_OFFSET_HI = { ADDR adr; } 4 "hi " adr. LABEL_OFFSET_HI = { ADDR adr; } 4 "ha16[" adr "]".
LABEL_OFFSET_LO = { ADDR adr; } 4 "lo " adr. LABEL_OFFSET_LO = { ADDR adr; } 4 "lo16[" adr "]".
LOCAL = { INT off; } 4. LOCAL = { INT off; } 4.
/* Allows us to use regvar() to refer to registers */ /* Allows us to use regvar() to refer to registers */