[hackers] [scc] [cc2-qbe] Add skeleton for function code generation || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Mon, 11 Apr 2016 17:17:36 +0200 (CEST)

commit 734448b3325cec5c59a3ecc611a524a9719c4c75
Author: Roberto E. Vargas Caballero <roberto.vargas_AT_igrid-td.com>
AuthorDate: Mon Apr 11 17:16:01 2016 +0200
Commit: Roberto E. Vargas Caballero <roberto.vargas_AT_igrid-td.com>
CommitDate: Mon Apr 11 17:16:01 2016 +0200

    [cc2-qbe] Add skeleton for function code generation
    
    This is only a stub that prints the name of the function,
    although it still cannot print the type of the function
    because we do not have this information in our IR,
    although we can derive it from the code (from the return
    statements)

diff --git a/cc2/arch/qbe/code.c b/cc2/arch/qbe/code.c
index b55a8bd..38e9390 100644
--- a/cc2/arch/qbe/code.c
+++ b/cc2/arch/qbe/code.c
_AT_@ -144,6 +144,11 @@ data(Node *np)
 void
 writeout(void)
 {
+ if (curfun->kind == GLOB)
+ fputs("export ", stdout);
+ printf("function $%s(", symname(curfun));
+ puts("){");
+ puts("}");
 }
 
 void
Received on Mon Apr 11 2016 - 17:17:36 CEST

This archive was generated by hypermail 2.3.0 : Mon Apr 11 2016 - 17:24:20 CEST