Commit Graph

18 Commits

Author SHA1 Message Date
Jan Nieuwenhuizen 4faeece057
mescc: Tinycc support: Char and short sign extend.
* module/mes/as-i386.mes (i386:accu*n->local, i386:byte-accu->local+n,
  i386:word-accu->local+n): Remove.
  (i386:byte-accu, i386:signed-byte-accu, i386:word-accu,
  i386:signed-word-accu): New function.
* module/mes/as-i386.scm: Export them.
* module/language/c99/compiler.mes (accu->local+n-text): Simplify.
  (mem->accu, convert-accu): New function.
  (expr->accu): Use them.
* stage0/x86.M1 (mov____%al,0x32(%ebp), mov____%al,0x8(%ebp),
  mov____%ax,0x32(%ebp), mov____%ax,0x8(%ebp), movzbl_0x32(%ebp),%eax,
  movzbl_0x8(%ebp),%eax, movzwl_0x32(%ebp),%eax,
  movzwl_0x8(%ebp),%eax): Deprecate.
* scaffold/tests/7r-sign-extend.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
2018-05-18 23:58:10 +02:00
Jan Nieuwenhuizen 209f9cc599
mescc: Tinycc support: Update some tests. 2018-05-14 21:18:08 +02:00
Jan Nieuwenhuizen 0f87473105
mescc: Tinycc support: Support bit-fields.
* module/language/c99/compiler.mes (struct->fields): Support bit-fields.
  (ast->type):
  (field-field):
  (field-offset):
  (expr->accu*):
  (expr->accu):
  (struct-field):
  (->size):
* module/language/c99/info.scm (<bit-field>): New type.
* stage0/x86.M1 (and____$i32,%eax, and____(%edx),%eax,
  mov____(%edx),%eax, or____(%edx),%eax): New macro.
* module/mes/as-i386.mes (i386:base-mem->accu): Use
  it.
  (i386:accu-and, i386:accu-and-base-mem, i386:accu-or-base-mem): New
  function.
* module/mes/as-i386.scm: Export them.
* scaffold/tests/7q-bit-field.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
2018-05-13 17:05:28 +02:00
Jan Nieuwenhuizen dae4a30417
mescc: Tinycc support: Anonymous string array.
* module/language/c99/compiler.mes (global->info): Anonymous string
  array.
  (local->info): Likewise.
  (array-init->string): Support array of char.
  (init-local): Likewise.
  (->size): Fix for array.
* scaffold/tests/4a-char-array.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
2018-05-12 12:03:01 +02:00
Jan Nieuwenhuizen ad9f171c49
mescc: Tinycc support: Implement ((struct foo*)p)->bar.
* module/language/c99/compiler.mes (expr->accu*):
* scaffold/tests/7p-struct-cast.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
2018-05-12 00:20:51 +02:00
Jan Nieuwenhuizen 057607ca0a
mescc: Tinycc support: Implement (foo--)->bar and permutations.
* module/language/c99/info.scm (clone): Add post field.
  (make): Handle post parameter.
* module/language/c99/compiler.mes (clone): Handle post parameter.
  (expr->accu*): Set it to support foo--/foo--.
  (expr->accu): Read it to support foo--/foo--.
* scaffold/tests/7o-struct-pre-post.c: Test it.
* build-aux/check-mescc.sh: Run it.
2018-05-13 13:50:32 +02:00
Jan Nieuwenhuizen e3a8316184
mescc: Tinycc support: Fix for ?-operator. 2018-05-11 15:13:55 +02:00
Jan Nieuwenhuizen a1862f749f
mescc: Refactor type system: WIP
* module/language/c99/compiler.mes (): WIP
* module/language/c99/info.scm (): WIP
2018-05-10 12:40:07 +02:00
Jan Nieuwenhuizen c9ba7a619b
mescc: Refactor variable declaration.
* module/language/c99/compiler.mes (decl->info): Refactor.
2018-05-05 12:30:06 +02:00
Jan Nieuwenhuizen 1b8d59fd0f
mescc: Handle sizeof expression.
* module/language/c99/compiler.mes (expr->accu): Handle sizeof
  expression.
* scaffold/tests/85-sizeof.c: Test it.
2018-05-05 00:59:31 +02:00
Jan Nieuwenhuizen 2311b8bd20
mescc: Handle struct field lists.
* module/language/c99/compiler.mes (struct-field): Return list of
  fields.  Update callers.
* scaffold/tests/84-struct-field-list.c: Test it.
* build-aux/check-mescc.sh (tests): Add it.
2018-05-05 00:14:47 +02:00
Jan Nieuwenhuizen 13edbaf4d8
mescc: Support heterogeneous variable init.
* module/language/c99/compiler.mes (decl->info): Support heterogeneous
  variable init.
* scaffold/tests/83-heterogenoous-init.c: Test it.
* build-aux/check-mescc.sh (tests): Add it.
2018-05-04 22:38:01 +02:00
Jan Nieuwenhuizen e53f55f002
mescc: Support functions in expression.
* module/language/c99/info.scm (<function>): New type.
* module/language/c99/compiler.mes (ast->type): Support function.
  (expr->type-size): Likewise.
  (expr->type): Likewise.
  (expr->accu*): Likewise.
  (function->info): Create <function>.
* module/mes/M1.mes (object->M1): Grok <function>.
* scaffold/tests/47-function-expression.c: Test it.
* build-aux/check-mescc.sh: Add it.
2018-05-04 13:58:27 +02:00
Jan Nieuwenhuizen be60b3e49b
mescc: Support function-static variables.
* module/language/c99/info.scm (make): Add statics field.
  (<global>): Add name and function fields.  Update callers.
  (global->string): New function.
* module/mes/M1.mes (object->M1): Update.
* module/language/c99/compiler.mes (clone): Add statics field.
  (ident->accu): For <global>, use global in text (WAS: name).
  (ident-address->accu): Likewise.
  (ident-address->base): Likewise.
  (decl-local->info): New function.
  (decl->info): New function.
  (ast->info): Use them.
  (function->info): Keep globals in object (WAS: global:value only).
* scaffold/tests/46-function-static.c: Test it.
2018-05-04 20:45:27 +02:00
Jan Nieuwenhuizen 62bd70cfb6
mescc: Guile fixes.
* scripts/mescc: Set GODIR.  Add module as expression to Mes
  invokation.  Remove explicit (second) call to main.
2018-05-04 10:12:34 +02:00
Jan Nieuwenhuizen ba17eeeefe
build: Fixes for Debian and /bin/sh == dash.
* build.sh: Use separate export stanzas.  Use command -v (WAS: type
  -p).  Fixes sh, /bin/sh == dash.
* build-aux/build-cc.sh: Likewise.
* build-aux/build-guile.sh: Likewise.
* build-aux/build-mes.sh: Likewise.
* build-aux/build-mlibc.sh: Likewise.
* build-aux/cc-mes.sh: Likewise.
* build-aux/check-mescc.sh: Likewise.
* check.sh: Likewise.
* install.sh: Likewise.
* scripts/mescc: Likewise.
2018-05-03 20:32:06 +02:00
Jan Nieuwenhuizen 98417537a2
test: enable all tests, use expect count, add tinycc tests.
* build-aux/check-mescc.sh (tests): Add tinycc tests.
* build-aux/diff.scm: Naive diff for tinycc tests.
* build-aux/test.sh: Run diff when .expect found.
2018-05-01 16:50:29 +02:00
Jan Nieuwenhuizen a937d18c38
build: Simplify, drop make.scm experiment.
* build.sh: Rewrite.
* build-aux/build-cc.sh: New file.
* build-aux/build-mes.sh: New file.
* build-aux/build-mlibc.sh: New file.
* build-aux/cc.sh: New file.
* build-aux/cc-mes.sh: New file.
* build-aux/cc-mlibc.sh: New file.
* install.sh: Update.
* make.scm: Remove.
* guile/guix/make.scm: Remove.
* guile/guix/records.scm: Remove.
* guile/guix/shell-utilsg.scm: Remove.
2018-04-29 18:38:57 +02:00