scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 827b4cdaa90cabaa1ee149a79ceb4cf7c7813f47
parent 9a2913311bd77d7075a327854a725d03eff554a2
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed, 20 Jan 2016 20:11:09 +0100

Move cc2 to cc2.old

We are going to begin with the new backend, and it is better
to begin from scratch, but with an eye in the older.

Diffstat:
Rcc2/Makefile -> cc2.old/Makefile | 0
Acc2.old/cast.patch | 61+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Rcc2/cc2.h -> cc2.old/cc2.h | 0
Rcc2/cgen.c -> cc2.old/cgen.c | 0
Rcc2/code.c -> cc2.old/code.c | 0
Rcc2/generror -> cc2.old/generror | 0
Rcc2/main.c -> cc2.old/main.c | 0
Rcc2/optm.c -> cc2.old/optm.c | 0
Rcc2/parser.c -> cc2.old/parser.c | 0
Rcc2/peep.c -> cc2.old/peep.c | 0
10 files changed, 61 insertions(+), 0 deletions(-)

diff --git a/cc2/Makefile b/cc2.old/Makefile diff --git a/cc2.old/cast.patch b/cc2.old/cast.patch @@ -0,0 +1,61 @@ +diff --git a/cc2/cgen.c b/cc2/cgen.c +index be4ff41..8839505 100644 +--- a/cc2/cgen.c ++++ b/cc2/cgen.c +@@ -449,16 +449,50 @@ cast(Node *np) + { + Node *lp = np->left; + uint8_t reg; ++ int8_t delta; + +- if (lp->type.size != np->type.size) ++ swtich (lp->type.size) { ++ case 1: ++ switch (np->type.size) { ++ case 1: ++ break; ++ case 2: ++ if (lp->op != REG) ++ move(lp, np); ++ np->reg = reg = lp->reg; ++ if (lp->sign && np->sign) { ++ code(BIT, lp, imm(7)); ++ code(JRZ, .., ..); ++ code(LDI, regs[upper[reg]], imm(-1)); ++ code(JR, ..., ...); ++ } ++ reguse[pair[reg]] = reguse[reg] = np; ++ code(LDI, regs[lower[reg]], imm(0)); ++ break; ++ default: ++ abort(); ++ } ++ break; ++ case 2: ++ switch (np->type.size) { ++ case 1: ++ if (lp->op == REG) { ++ reguse[upper[reg]] = NULL; ++ reg = lower[reg]; ++ np->reg = reg; ++ reguse[pair[reg]] = reguse[reg] = np; ++ } ++ break; ++ case 2: ++ break; ++ default: ++ abort(); ++ } ++ default: + abort(); ++ } + lp->used = 1; + np->sym = lp->sym; +- if ((np->op = lp->op) == REG) { +- reg = lp->reg; +- np->reg = reg; +- reguse[pair[reg]] = reguse[reg] = np; +- } + } + + static void (*opnodes[])(Node *) = { diff --git a/cc2/cc2.h b/cc2.old/cc2.h diff --git a/cc2/cgen.c b/cc2.old/cgen.c diff --git a/cc2/code.c b/cc2.old/code.c diff --git a/cc2/generror b/cc2.old/generror diff --git a/cc2/main.c b/cc2.old/main.c diff --git a/cc2/optm.c b/cc2.old/optm.c diff --git a/cc2/parser.c b/cc2.old/parser.c diff --git a/cc2/peep.c b/cc2.old/peep.c