ref: 99605c45f8a60733579b474e7491314442a60843
parent: 0646fcf44045b03e1ac837d2f2333b8af85d9f54
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Feb 20 08:42:12 EST 2018
[cc2/z80] Add lhs() This function is copied from qbe port. Changes are expected to this function.
--- 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 @@
}
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