mescc: Support globals.
authorJan Nieuwenhuizen <janneke@gnu.org>
Tue, 10 Jan 2017 19:12:06 +0000 (20:12 +0100)
committerJan Nieuwenhuizen <janneke@gnu.org>
Tue, 10 Jan 2017 19:12:06 +0000 (20:12 +0100)
commit4726a6c9ce1187c0b295b5b7e6f569c8b86e8c86
tree14ed9265a288a707f6ba5e58a1b8f10767e3d05a
parent36f9d584c50eeba46d8486e728791417a5f1c199
mescc: Support globals.

* module/language/c99/compiler.mes (write-any): Catch writing of
  procedure and give more debug information.
  (ref-local, ref-global): Remove.
  (push-global-ref, push-global, push-ident-ref): New functions.
  (push-ident): New function.
  (expr->arg): Use them.
  (ident->accu, ident->accu, accu->ident, value->ident, ident->base):
  Take info parameter, also handle globals.
  (ident-address->accu, ident->global, cstring->number): New functions.
  (ast->info): Update.
* module/mes/libc-i386.mes (i386:ret-local): Remove.
  (i386:push-global-ref): Rename from i386:ref-global.
  (i386:push-local): Rename from i386:ref-local.
  (i386:value->local): Rename from i386:local-assign.
  (i386:push-global, i386:push-local-ref, i386:value->global,
  i386:local-address->accu): New functions.
* module/mes/libc-i386.scm: Export them.
module/language/c99/compiler.mes
module/mes/libc-i386.mes
module/mes/libc-i386.scm