scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

commit 9a4a477ae954a2c0b251a5cbe3811a01fd996f6f
parent d2262468e06da67413347597c9f15469e945f1be
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sat, 16 Dec 2017 21:56:28 +0100

[as-z80] Simplify r8-r8 instructions

There were several functions in this file that were duplicated
because the naming schema at the beginning was different

Diffstat:
Mas/target/x80/ins.c | 19++-----------------
Mas/target/x80/x80.dat | 10+++++-----
2 files changed, 7 insertions(+), 22 deletions(-)

diff --git a/as/target/x80/ins.c b/as/target/x80/ins.c @@ -140,7 +140,7 @@ r8_r8(Op *op, Node **args) } void -xx_r8_2(Op *op, Node **args) +xx_r8(Op *op, Node **args) { Node *par1, *par2; unsigned char buf[3]; @@ -155,22 +155,7 @@ xx_r8_2(Op *op, Node **args) } void -r8_xx_2(Op *op, Node **args) -{ - Node *par1, *par2; - unsigned char buf[3]; - int n = op->size; - - par1 = args[0]; - par2 = args[1]; - - memcpy(buf, op->bytes, n); - buf[n-1] |= reg2int(par2->sym->argtype) << 3; - emit(buf, n); -} - -void -r8_xx_1(Op *op, Node **args) +r8_xx(Op *op, Node **args) { Node *par1, *par2; unsigned char buf[3]; diff --git a/as/target/x80/x80.dat b/as/target/x80/x80.dat @@ -83,14 +83,14 @@ LD indir_HL,imm8 2 0x36 imm8 Z80,R800,GB80 LD reg_r,reg_r 1 0x40 r8_r8 Z80,R800,GB80 LD reg_p,reg_p 2 0xdd,0x40 r8_r8 Z80,R800 LD reg_q,reg_q 2 0xfd,0x40 r8_r8 Z80,R800 -LD indir_HL,reg_r 1 0x70 xx_r8_2 Z80,R800,GB80 -LD reg_r,indir_HL 1 0x46 r8_xx_1 Z80,R800,GB80 +LD indir_HL,reg_r 1 0x70 xx_r8 Z80,R800,GB80 +LD reg_r,indir_HL 1 0x46 r8_xx Z80,R800,GB80 LD HL,imm16 3 0x21 r_imm16 Z80,R800,GB80 -ADD regA,reg_r 1 0x80 xx_r8_2 Z80,R800,GB80 -ADD regA,reg_p 2 0xdd,0x80 xx_r8_2 Z80,R800 -ADD regA,reg_q 2 0xfd,0x80 xx_r8_2 Z80,R800 +ADD regA,reg_r 1 0x80 xx_r8 Z80,R800,GB80 +ADD regA,reg_p 2 0xdd,0x80 xx_r8 Z80,R800 +ADD regA,reg_q 2 0xfd,0x80 xx_r8 Z80,R800 ADD regA,imm8 2 0xc6 imm8 Z80,R800,GB80 ADD regA,indir_HL 1 0x86 noargs Z80,R800,GB80