Turns out Apple's hi16/ha16 exactly match my ha16/has16, so renamed
authorDavid Given <dg@cowlark.com>
Sun, 15 Jan 2017 10:59:33 +0000 (11:59 +0100)
committerDavid Given <dg@cowlark.com>
Sun, 15 Jan 2017 10:59:33 +0000 (11:59 +0100)
accordingly. (Memo to self: read the docs *before* doing the work.)

mach/powerpc/as/mach1.c
mach/powerpc/as/mach2.c
mach/powerpc/as/mach3.c
mach/powerpc/as/mach4.c
mach/powerpc/as/mach5.c
mach/powerpc/ncg/table
util/led/relocate.c

index 8cf9ca2..c1651fc 100644 (file)
@@ -5,5 +5,5 @@
 
 #include <stdbool.h>
 
-extern quad emit_ha(struct expr_t* expr, bool is_signed);
+extern quad emit_hi(struct expr_t* expr, bool is_signed);
 extern quad emit_lo(struct expr_t* expr);
index f64d148..3ecaf10 100644 (file)
@@ -85,7 +85,7 @@
 %token <y_word> OP_LI32
 
 %token <y_word> OP_POWERPC_FIXUP
-%token <y_word> OP_HA OP_HAS OP_LO
+%token <y_word> OP_HI OP_HA OP_LO
 
 /* Other token types */
 
index 74415aa..724ba73 100644 (file)
 0,     OP_LA,                 0,                                       "la",
 0,     OP_LA,                 0,                                       "li",
 0,     OP_RS_RA_RA_C,         31<<26 | 444<<1,                         "mr",
-0,     OP_HA,                 0,                                       "ha16",
-0,     OP_HAS,                0,                                       "has16",
+0,     OP_HI,                 0,                                       "hi16",
+0,     OP_HA,                0,                                        "ha16",
 0,     OP_LO,                 0,                                       "lo16",
 
 /* Branch processor instructions (page 20) */
index bb6f516..1ad180d 100644 (file)
@@ -75,8 +75,8 @@ e16
                        serror("16-bit value out of range");
                $$ = (uint16_t) $1;
        }
-       | OP_HA ASC_LPAR expr ASC_RPAR           { $$ = emit_ha(&$3, false); }
-       | OP_HAS ASC_LPAR expr ASC_RPAR          { $$ = emit_ha(&$3, true); }
+       | OP_HI ASC_LPAR expr ASC_RPAR           { $$ = emit_hi(&$3, false); }
+       | OP_HA ASC_LPAR expr ASC_RPAR           { $$ = emit_hi(&$3, true); }
        | OP_LO ASC_LPAR expr ASC_RPAR           { $$ = emit_lo(&$3); }
        ;
 
index a8e4cd0..e3e23f2 100644 (file)
@@ -1,5 +1,5 @@
 
-quad emit_ha(struct expr_t* expr, bool is_signed)
+quad emit_hi(struct expr_t* expr, bool is_signed)
 {
     /* If this is a symbol reference, discard the symbol and keep only the
         * offset part. */
index d37bed8..d3d2fcb 100644 (file)
@@ -175,8 +175,8 @@ TOKENS
 /* Primitives */
 
        LABEL              = { ADDR adr; }            4    adr.
+       LABEL_OFFSET_HI    = { ADDR adr; }            4    "hi16[" adr "]".
        LABEL_OFFSET_HA    = { ADDR adr; }            4    "ha16[" adr "]".
-       LABEL_OFFSET_HAS   = { ADDR adr; }            4    "has16[" adr "]".
        LABEL_OFFSET_LO    = { ADDR adr; }            4    "lo16[" adr "]".
        LOCAL              = { INT off; }             4.
 
@@ -286,7 +286,7 @@ INSTRUCTIONS
   add             GPR:wo, GPR:ro, GPR:ro.
   addX "add."     GPR:wo, GPR:ro, GPR:ro.
   addi            GPR:wo, GPR:ro, CONST:ro.
-  addis           GPR:wo, GPR:ro, CONST+LABEL_OFFSET_HA+LABEL_OFFSET_HAS:ro.
+  addis           GPR:wo, GPR:ro, CONST+LABEL_OFFSET_HI+LABEL_OFFSET_HA:ro.
   and             GPR:wo, GPR:ro, GPR:ro.
   andc            GPR:wo, GPR:ro, GPR:ro.
   andiX  "andi."  GPR:wo:cc, GPR:ro, CONST:ro.
@@ -408,7 +408,7 @@ MOVES
        from LABEL to GPR
                gen
                        COMMENT("move LABEL->GPR")
-                       addis %2, R0, {LABEL_OFFSET_HA, %1.adr}
+                       addis %2, R0, {LABEL_OFFSET_HI, %1.adr}
                        ori %2, %2, {LABEL_OFFSET_LO, %1.adr}
 
 /* Sign extension */
@@ -1149,7 +1149,7 @@ PATTERNS
                with LABEL
                        uses REG
                        gen
-                               addis %a, R0, {LABEL_OFFSET_HAS, %1.adr}
+                               addis %a, R0, {LABEL_OFFSET_HA, %1.adr}
                                lwz %a, {GPRINDIRECT_OFFSET_LO, %a, %1.adr}
                        yields %a
                with GPR
index 613a0af..7e2f9db 100644 (file)
@@ -297,6 +297,7 @@ static void put_powerpc_valu(char* addr, uint32_t value, uint16_t type)
        else if (((opcode1 & 0xfc1f0000) == 0x3c000000) &&
                 ((opcode2 & 0xfc000000) == 0x60000000))
        {
+               /* addis / ori instruction pair */
                uint16_t hi = value >> 16;
                uint16_t lo = value & 0xffff;