ref: 7ef0309d40338751616257999bb1456a6d7c481e
parent: d464e990c12ba28e4fbe501db59a4a994baa4281
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sun May 8 16:12:18 EDT 2016
[cc2-qbe] Emit abbrev statements Abbrev statements are the combination of a assignation and some other operator, and they don't have special meaning in QBE. They must be expanded.
--- a/cc2/arch/qbe/cgen.c
+++ b/cc2/arch/qbe/cgen.c
@@ -231,6 +231,20 @@
return nd;
}
+static Node *
+abbrev(Node *np)
+{
+ Node *tmp;
+
+ if (np->u.subop == 0)
+ return np->right;
+ tmp = newnode(np->u.subop);
+ tmp->type = np->type;
+ tmp->right = np->right;
+ tmp->left = np->left;
+ return np->right = cgen(tmp);
+}
+
Node *
cgen(Node *np)
{
@@ -317,6 +331,7 @@
case ODEC:
abort();
case OASSIG:
+ r = abbrev(np);
switch (tp->size) {
case 1:
op = ASSTB;