scc

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

commit 5ce98041ac6706539aac39a2c9e32a43db3e6bd8
parent 277d04a458bad76df8427891e3b8bfb694a7c238
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri,  8 Aug 2014 19:08:49 +0200

Add emit of end of frame

This is only a stub of the real, but it is good enough now.

Diffstat:
Mcc2/cc2.h | 1+
Mcc2/cgen.c | 5+++++
2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/cc2/cc2.h b/cc2/cc2.h @@ -55,6 +55,7 @@ enum nerrors { #define FUN 0 #define VAR 1 +#define EFUN 2 #define AUTO 'A' #define REG 'R' #define MEM 'T' diff --git a/cc2/cgen.c b/cc2/cgen.c @@ -33,6 +33,10 @@ emit(char what, void *data) "\tADD\tHL,SP\n" "\tLD\tSP,HL\n", sym->u.f.name, -sym->u.f.stack); return; + case EFUN: + printf("\tLD\tSP,IX\n" + "\tRET\n"); + return; default: fputs("internal error: incorrect emit\n", stderr); abort(); @@ -43,6 +47,7 @@ void cgen(Symbol *sym, Node *list[]) { emit(FUN, sym); + emit(EFUN, NULL); } /*