diff options
author | Bobby Bingham <koorogi@koorogi.info> | 2017-01-14 16:18:16 -0600 |
---|---|---|
committer | Bobby Bingham <koorogi@koorogi.info> | 2017-01-15 23:19:28 -0600 |
commit | f91057644c1f1813bf1373b5158e6b658210d570 (patch) | |
tree | 690913e6f3cf6173e1be867f950135f5f4e1df94 /parser.y | |
parent | 3ec0ba288f355c717f1449625bc0aba3c4c9b104 (diff) |
Switch addpc to use pc-offset instead of immediate operand
This makes more sense, as the argument is really a signed offset from the
program counter.
Diffstat (limited to 'parser.y')
-rw-r--r-- | parser.y | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -88,6 +88,7 @@ void yyerror(const char *msg) %type <args> a_regp_reg %type <args> a_reg_regp %type <args> a_reg_imm +%type <args> a_reg_pcoff %type <args> a_pcoff %type <lval> intlit @@ -136,7 +137,7 @@ inst: | T_BLE a_pcoff { $$ = INSTRUCTION_ARGS(BLE, $2); } | T_BRA a_pcoff { $$ = INSTRUCTION_ARGS(BRA, $2); } | T_JMP a_regp { $$ = INSTRUCTION_ARGS(JMP, $2); } - | T_ADDPC a_reg_imm { $$ = INSTRUCTION_ARGS(ADDPC, $2); } + | T_ADDPC a_reg_pcoff { $$ = INSTRUCTION_ARGS(ADDPC, $2); } | T_NOP { $$ = INSTRUCTION(NOP); } ; @@ -152,6 +153,8 @@ a_reg_regp: T_SPACE T_REG "," T_REGPTR { $$ = MKARGS($2, $4); } a_reg_imm: T_SPACE T_REG "," imm { $$ = MKARGS($2, $4); } +a_reg_pcoff: + T_SPACE T_REG "," pcoff { $$ = MKARGS($2, $4); } a_pcoff: T_SPACE pcoff { $$ = MKARGS($2); } |