scc

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

commit e954d0a88f3ae65a707af607e8adf636f350365e
parent 38bb7f83ccf922f9dcbd59f70c83b50ae201730b
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue, 20 Feb 2018 13:42:12 +0000

[cc2/z80] Add lhs()

This function is copied from qbe port. Changes are expected to this
function.

Diffstat:
Mcc2/target/z80-scc/cgen.c | 23+++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/cc2/target/z80-scc/cgen.c b/cc2/target/z80-scc/cgen.c @@ -1,5 +1,7 @@ static char sccsid[] = "@(#) ./cc2/arch/z80/cgen.c"; +#include <stdlib.h> + #include "arch.h" #include "../../../inc/scc.h" #include "../../cc2.h" @@ -10,13 +12,30 @@ swtch(Node *idx) } static Node * -lhs(Node *np, Node *ret) +rhs(Node *np, Node *ret) { } static Node * -rhs(Node *np, Node *ret) +field(Node *np, Node *ret, int islhs) +{ +} + +static Node * +lhs(Node *np, Node *new) { + switch (np->op) { + case OMEM: + case OAUTO: + *new = *np; + return new; + case OPTR: + return rhs(np->left, new); + case OFIELD: + return field(np, new, 1); + default: + abort(); + } } static void