[hackers] [scc/qbe] [cc2-qbe] Add support for NULL parameter in tmpnode() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Wed, 17 Aug 2016 14:29:49 +0200 (CEST)

commit a4b3b284742d4f7f3cd2fd53a00acff7a8c6a0cf
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Wed Aug 17 09:36:04 2016 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Wed Aug 17 13:35:58 2016 +0200

    [cc2-qbe] Add support for NULL parameter in tmpnode()
    
    It is a very common case to call 'newnode(tmpnode(OTMP))'
    so it is a good idea to pack it into newnode().

diff --git a/cc2/arch/qbe/cgen.c b/cc2/arch/qbe/cgen.c
index 6db1123..57e0c68 100644
--- a/cc2/arch/qbe/cgen.c
+++ b/cc2/arch/qbe/cgen.c
_AT_@ -97,6 +97,8 @@ tmpnode(Node *np, Type *tp)
 {
         Symbol *sym;
 
+ if (!np)
+ np = newnode(OTMP);
         sym = getsym(TMPSYM);
         sym->type = np->type = *tp;
         sym->kind = STMP;
Received on Wed Aug 17 2016 - 14:29:49 CEST

This archive was generated by hypermail 2.3.0 : Wed Aug 17 2016 - 14:36:30 CEST