Commit Graph

185 Commits

Author SHA1 Message Date
Jan Nieuwenhuizen b65e57be31
core: Tune debug printing.
* src/mes.c: Tune debug printing.
* src/gc.c: Likewise.
* module/mes/guile.mes: Likewise.
* HACKING: Describe it.
2018-04-09 07:12:38 +02:00
Jan Nieuwenhuizen ad135d3752 doc: Release udpate.
* HACKING: Update.
* INSTALL: Update.
* NEWS: Update.
* README: Update.
* doc/ANNOUNCE-0.12: New file.
* throughout: (janneke) coming out.
2017-11-21 19:22:26 +01:00
Jan Nieuwenhuizen bd82d5988d core: Add setenv.
* lib/libc.c (setenv): New function.
* include/stdlib.h (setenv): Declare it.
* scaffold/tests/61-array.c (test): Test it.
2018-04-07 09:21:51 +02:00
Jan Nieuwenhuizen 9fc27ee25a mes: Single environment lookup for variables, SICP chapter 3.
* src/mes.c (t): Add TVARIABLE.
  (scm_vm_eval_deref): New vm special.
  (make_vref_): New internal function.
  (eval_apply): WIP: replace symbols with their variable reference.
* src/gc.c (gc_loop): Handle TVARIABLE.
* src/lib.c (display_helper): Handle TVARIABLE.
* module/mes/type-0.mes (<cell:variable>): New variable.
  (cell:type-alist): Add it.
  (variable?): New function.
* module/mes/display.mes (display): Handle <variable>.
2017-12-09 08:33:50 +01:00
Jan Nieuwenhuizen 9c8e2dbd9f mes: Add incremental test suite.
* check-boot.sh: New file.
* check.sh: Invoke it.
* module/srfi/srfi-16.mes: New file.
* scaffold/boot/00-zero.scm: New file.
* scaffold/boot/01-true.scm: New file.
* scaffold/boot/02-symbol.scm: New file.
* scaffold/boot/03-string.scm: New file.
* scaffold/boot/04-cons.scm: New file.
* scaffold/boot/04-quote.scm: New file.
* scaffold/boot/05-list.scm: New file.
* scaffold/boot/06-tick.scm: New file.
* scaffold/boot/07-if.scm: New file.
* scaffold/boot/08-if-if.scm: New file.
* scaffold/boot/10-cons.scm: New file.
* scaffold/boot/11-list.scm: New file.
* scaffold/boot/12-car.scm: New file.
* scaffold/boot/13-cdr.scm: New file.
* scaffold/boot/14-exit.scm: New file.
* scaffold/boot/15-display.scm: New file.
* scaffold/boot/16-if-eq-quote.scm: New file.
* scaffold/boot/20-define-quote.scm: New file.
* scaffold/boot/20-define-quoted.scm: New file.
* scaffold/boot/20-define.scm: New file.
* scaffold/boot/21-define-procedure.scm: New file.
* scaffold/boot/22-define-procedure-2.scm: New file.
* scaffold/boot/23-begin.scm: New file.
* scaffold/boot/24-begin-define.scm: New file.
* scaffold/boot/25-begin-define-2.scm: New file.
* scaffold/boot/26-begin-define-later.scm: New file.
* scaffold/boot/26-define-define.scm: New file.
* scaffold/boot/27-lambda-define.scm: New file.
* scaffold/boot/28-define-define.scm: New file.
* scaffold/boot/29-lambda-define.scm: New file.
* scaffold/boot/2a-lambda-lambda.scm: New file.
* scaffold/boot/2b-define-lambda.scm: New file.
* scaffold/boot/2c-define-lambda-recurse.scm: New file.
* scaffold/boot/2d-define-lambda-set.scm: New file.
* scaffold/boot/2e-define-second.scm: New file.
* scaffold/boot/30-capture.scm: New file.
* scaffold/boot/31-capture-define.scm: New file.
* scaffold/boot/32-capture-modify-close.scm: New file.
* scaffold/boot/33-procedure-override-close.scm: New file.
* scaffold/boot/34-cdr-override-close.scm: New file.
* scaffold/boot/35-closure-modify.scm: New file.
* scaffold/boot/36-closure-override.scm: New file.
* scaffold/boot/37-closure-lambda.scm: New file.
* scaffold/boot/38-simple-format.scm: New file.
* scaffold/boot/40-define-macro.scm: New file.
* scaffold/boot/41-when.scm: New file.
* scaffold/boot/42-if-when.scm: New file.
* scaffold/boot/43-or.scm: New file.
* scaffold/boot/44-or-if.scm: New file.
* scaffold/boot/45-pass-if.scm: New file.
* scaffold/boot/46-report.scm: New file.
* scaffold/boot/47-pass-if-eq.scm: New file.
* scaffold/boot/48-let.scm: New file.
* scaffold/boot/49-macro-override.scm: New file.
* scaffold/boot/4a-define-macro-define-macro.scm: New file.
* scaffold/boot/4b-define-macro-define.scm: New file.
* scaffold/boot/4c-quasiquote.scm: New file.
* scaffold/boot/50-primitive-load.scm: New file.
* scaffold/boot/51-module.scm: New file.
* scaffold/boot/52-define-module.scm: New file.
* scaffold/boot/53-closure-display.scm: New file.
* scaffold/boot/60-let-syntax.scm: New file.
* scaffold/boot/closure.scm: New file.
* scaffold/boot/compose.scm: New file.
* scaffold/boot/data/bar.mes: New file.
* scaffold/boot/data/i.scm: New file.
* scaffold/boot/data/module.mes: New file.
* scaffold/boot/foo.scm: New file.
* scaffold/boot/lambda-star.scm: New file.
* scaffold/boot/vector.scm: New file.
* tests/boot.test: New file.
* tests/boot.test-guile: New file.
* tests/srfi-16.test: New file.
* tests/srfi-16.test-guile: New file.
2018-01-25 06:58:44 +01:00
Jan Nieuwenhuizen 71906fb735 mescc: M4 support: scaffold/tests/82-define.c.
* scaffold/tests/82-define.c: New file; inspired by M4.  Thanks, Ricardo!
* make.scm ("82-define"): Build it.
* check-mescc.sh: Add 82-define.
2017-12-04 23:19:32 +01:00
Jan Nieuwenhuizen 05c33b052a mlibc: Tinycc support: qsort.
* lib/libc+tcc.c (qswap, qpart): New function
  (qsort): Implement.
* scaffold/tests/81-qsort.c: Test it.
* make.scm ("81-qsort"): Build it.
2017-12-04 19:01:39 +01:00
Jan Nieuwenhuizen 8b5e1dde3c mescc: scaffold: misc cleanups.
* scaffold/tests/44-switch.c (swits): More case labels.
* scaffold/tests/60-math.c: Discriminate return values.
* scaffold/tests/77-pointer-assign.c (memset)[__TINYC__]: Remove.
* scaffold/tests/79-int-array.c (test): Discriminate return values.
2017-12-03 23:03:09 +01:00
Jan Nieuwenhuizen 808af5001f mlibc: New library layout; remove duplication.
* lib/libc+tcc-gcc.c: New file: Libc bits for GCC from libc-mes+tcc.c.
* lib/libc+tcc-mes.c: New file: Libc bits for MesCC from libc-mes+tcc.c.
* lib/libc+tcc.c: New file: Libc bits from libc-mes+tcc.c.
* lib/libc.c: New file: Merged from libc-mes.c, libc-gcc.c.
  (abtoi): New function: Rename from _atoi.
* lib/linux+tcc-gcc.c: New file:  Linux bits from libc-gcc+tcc.c.
* lib/linux+tcc-mes.c: New file: Linux bits from libc-mes+tcc.c.
* lib/linux-gcc.c: New file: Linux bits from libc-gcc.c.
* lib/linux-mes.c: New file: Linux bits from libc-mes.c.
* lib/mini-libc-gcc.c: New file.
* lib/mini-libc.c: New file: Libc bits from mini-libc-mes.c.
* lib/mini-linux-gcc.c: New file.
* lib/mini-linux-mes.c: New file: Linux bits from mini-libc-mes.c.
* lib/libc-gcc.c: Remove duplication using include now.
* lib/libc-mes.c: Likewise.
* lib/mini-libc-mes.c: Likewise.
* include/stdio.h (puts)[POSIX]: Remomve macro.
  (fputc, fputs)[!POSIX]: New macro.
  (fputc, fputs): Remove declaration.
* scaffold/tests/7j-strtoull.c (strtoull, test): Use abtoi.
* src/lib.c (fputs)[__MESC__]: Remove define.
* guile/guix/make.scm: Update for new library layout.
* make.scm: Likewise.
* build.sh: Likewise.
* install.sh: Likewise.
2017-12-03 13:56:21 +01:00
Jan Nieuwenhuizen 74c4197467 mescc: Mescc-tools support: char foo[BAR] = {'a', 'b', 'c'}.
* stage0/x86.M1 (mov____%al,0x8(%ebp), mov____%al,0x32(%ebp),
  mov____%ax,0x8(%ebp), mov____%ax,0x32(%ebp)): New define.
* module/mes/as-i386.mes (i386:accu->local+n,i386:byte-accu->local+n,
  i386:word-accu->local+n): New function.
* module/language/c99/compiler.mes (accu->local+n): New function.
  (initzer->data): Return char as single byte.
  (decl->info): Support char foo[BAR] = {'a', 'b', 'c'}.
* scaffold/tests/66-local-char-array.c: Test it.
* make.scm (add-scaffold-test): Build it.
2017-11-27 19:51:18 +01:00
Jan Nieuwenhuizen e8884d83e1 mlibc: GNU Gcc support: setjmp, longjmp.
* stage0/x86.M1 (jmp____*%ebx): New macro.
  (mov____0x8(%ebp),%ebp): New macro.
  (mov____0x8(%ebp),%esp): New macro.
* include/setjmp.h (jmp_buf): Redefine as struct.
* lib/libc-mes+tcc.c (longjmp, setjmp): Implement.
* scaffold/tests/80-setjmp.c: Test it.
* make.scm ("80-setjmp"): Build it.
* .gitignore: Ignore *.tcc-guile.
2017-11-26 13:10:46 +01:00
Jan Nieuwenhuizen ada6ac99dd mescc: Tinycc support: test #include.
* scaffold/tests/exit-42.i: New file.
* scaffold/tests/07-include.c: New file.
* make.scm ("07-include"): Build it.
2017-11-18 11:55:47 +01:00
Jan Nieuwenhuizen 02e70486a1 mescc: Tinycc support: struct struct array.
Support

  struct foo
  {
    struct bar baz[N];
    struct bar bla*[M];
  };

* module/language/c99/compiler.mes (expr->accu):
* scaffold/tests/7n-struct-struct-array.c: Test it.
* make.scm (add-scaffold-test): Build it.
2017-11-17 15:24:45 +01:00
Jan Nieuwenhuizen d393fd3743 tinycc: scaffold/main.c: running mes-tcc compiled binary #6.
* scaffold/main.c (main): Use variable, if, argc, ++, +=, function call to return 42.
2017-11-16 05:33:11 +01:00
Jan Nieuwenhuizen cf107cb2b2 tinycc: scaffold/main.c: running mes-tcc compiled binary #5.
* scaffold/main.c (main): Use function call and variable to return 42.
2017-11-15 23:06:23 +01:00
Jan Nieuwenhuizen a2bc80fe7b tinycc: scaffold/main.c: running mes-tcc compiled binary #4.
* scaffold/main.c (main): Use variables to return 42.
2017-11-14 19:42:08 +01:00
Jan Nieuwenhuizen dc65de59ce mescc: refactor expr->accu, expr->accu*, fixes nontrivial struct by value assign.
* module/language/c99/compiler.mes: (pke): New function.
  (expr->number): Rename from p-expr->number.  Update callers.
  (decl->info, init-declr->pointer, struct-field): Several pointeryness fixes.
  (expr->accu*, expr->accu): Remove special-casing for foo.bar,
  foo->bar, foo[bar].  Fixes struct by value assign for non-trival
  expressions.
  (accu->ident, ident-address->accu, ident->accu):
  (base->ident-address, ident->base): Remove.
* scaffold/tests/7k-for-each-elem.c (test): Test it.
* scaffold/tests/7c-dynarray.c (test): Test it.
* scaffold/tests/7m-struct-char-array-assign.c: Test it.
* make.scm (add-scaffold-test): Build it.
2017-11-11 13:45:53 +01:00
Jan Nieuwenhuizen 7e6408534f tinycc: scaffold/main.c: running tcc-compiled binary #3.
* scaffold/main.c (main): Remove asm.
2017-09-03 10:43:02 +02:00
Jan Nieuwenhuizen 9555d90174 mescc: Tinycc support: struct by value assign.
* module/language/c99/compiler.mes (expr->accu): warn for unsupported
  sizes.
* scaffold/tests/7h-struct-assign.c (test): Test it.
2017-09-10 16:59:53 +02:00
Jan Nieuwenhuizen 2896ce46c4 tinycc: scaffold/main.c: running tcc-compiled binary #2.
* scaffold/main.c (main)[__i386__]: Rename from _start.
2017-09-03 00:37:39 +02:00
Jan Nieuwenhuizen 9aa8d8bd9d tinycc: scaffold/main.c: first running tcc-compiled binary.
* scaffold/main.c (_start): Exit 42 using asm.
2017-08-19 11:35:58 +02:00
Jan Nieuwenhuizen 3560ee6c95 mescc: Tinycc support: fix *--p = 'x'.
* module/language/c99/compiler.mes (expr->accu): Respect size in *--p = 'x'.
* scaffold/tests/23-pointer.c (test): Test it.
2017-08-27 16:58:56 +02:00
Jan Nieuwenhuizen 989bfdbd25 mescc: Tinycc support: array of struct of any size.
* module/language/c99/compiler.mes (accu*value): New function
  (expr->accu*): Use it to support array of struct of any size.
* scaffold/tests/7l-struct-any-size-array.c: Test it.
* make.scm (add-scaffold-test): Build it.
2017-08-27 11:23:45 +02:00
Jan Nieuwenhuizen 69073e1954 mescc: Tinycc support: pointer arithmetic with pointer-variable.
* module/language/c99/compiler.mes (expr->accu): pointer arithmetic with pointer-variable.
* scaffold/tests/76-pointer-arithmetic.c (test): Test it.
* mlibc/include/stdarg.h (va_start): Update for fixed pointer arithmetic.
2017-08-26 10:16:53 +02:00
Jan Nieuwenhuizen 8649f7a923 mescc: Tinycc support: pointer arithmetic with &variable.
* module/language/c99/compiler.mes (expr->pointer): Handle ref.
* scaffold/tests/76-pointer-arithmetic.c: Test it.
2017-08-25 06:58:15 +02:00
Jan Nieuwenhuizen 0875ce655a mescc: Tinycc support: pointer arithmetic with variable.
* module/language/c99/compiler.mes (expr->accu): Support pointer
  arithmetic with variable: p + i, p - i, p += i, p -= i.
* scaffold/tests/76-pointer-arithmetic.c (test): Test it.
2017-08-23 07:08:16 +02:00
Jan Nieuwenhuizen 1e23dbaf17 mescc: Tinycc support: handle pointerness, siziness for cast foo*.
* module/language/c99/compiler.mes (expr->pointer): Support cast foo*.
  (expr->size): Likewise.
* scaffold/tests/7k-for-each-elem.c: Test it
* make.scm (add-scaffold-test): Build it.
2017-08-23 06:55:25 +02:00
Jan Nieuwenhuizen 93714ad0a4 mescc: Tinycc support: strtoull.
* mlibc/include/mlibc.h (_atoi): Declare.
* mlibc/include/ctype.h (isxdigit): Declare.
* mlibc/libc-gcc.c (isxdigit, _atoi): New function.
  (atoi): Use it.
* mlibc/libc-mes.c (isxdigit, _atoi): New function.
  (atoi): Use it.
* scaffold/tests/7j-strtoull.c (test): Test it.
* make.scm (add-scaffold-test): Build it.
2017-08-19 10:51:24 +02:00
Jan Nieuwenhuizen 3392f7241a mescc: Tinycc support: struct.struct.
* module/language/c99/compiler.mes (field:name):
  (field:pointer):
  (field:size):
  (field:type):
  (field-field):
  (field-offset):
  (struct-field): Support struct.struct.
* scaffold/tests/7i-struct-struct.c: Test it.
* make.scm (add-scaffold-test): Build it.
2017-08-10 21:36:49 +02:00
Jan Nieuwenhuizen 8fcf2b36b2 mescc: Tinycc support: --*p, ++*p.
* module/language/c99/compiler.mes (expr->accu): Remove specific --/++.
  (expr->accu*): Support p, *p.
* scaffold/tests/76-pointer-arithmetic.c (test): Test it.
2017-08-10 20:57:43 +02:00
Jan Nieuwenhuizen b16c9dbf16 mescc: Tinycc support: word array assignment.
* stage0/x86.M1 (movzwl_(%eax),%eax): New define.
* module/mes/as-i386.mes (i386:word-mem->accu): New function.
* module/mes/as-i386.scm: Export it.
* module/language/c99/compiler.mes (expr->accu): word array assignment.
  (expr->accu*): word array assignment.
* scaffold/tests/7a-struct-char-array.c (test): Test it.
2017-08-08 10:00:13 +02:00
Jan Nieuwenhuizen 082c81dbbb mescc: Tinycc support: struct char array assignment.
* module/language/c99/compiler.mes (expr->accu): struct char array assignment.
* scaffold/tests/7a-struct-char-array.c (test): Test it.
2017-08-07 19:43:59 +02:00
Jan Nieuwenhuizen 11d240e756 mescc: Tinycc support: struct assign by value.
* module/language/c99/compiler.mes (base->ident): Remove.
  (accu->ident): Use them to support assign of size >4 by value.
* scaffold/tests/7h-struct-assign.c: Test it.
* make.scm (add-scaffold-test): Build it.
* module/mes/as-i386.mes (i386:base->local): Remove.
  (i386:accu*n->local):
  (i386:accu*n->label): New functions.
* module/mes/as-i386.scm: Export them.
* stage0/x86.M1: (mov____%ebx,0x32):
  (mov____%ebx,0x32(%ebp)):
  (mov____%ebx,0x8(%ebp)):
  (mov____%ebx,0x8(%edx)):
  (mov____%ecx,0x32(%ebp)):
  (mov____%ecx,0x8(%ebp)):
  (mov____0x32(%eax),%ebx):
  (mov____0x32(%eax),%ecx):
  (mov____0x8(%eax),%ebx): New define.
2017-08-06 18:49:19 +02:00
Jan Nieuwenhuizen ba50d4bd25 mescc: Move simple main to scaffold.
* scaffold/main.c (main): Move from doc/examples/main.c
* make.scm: Build it.
* README: Update.
* guile/mescc.scm (main):
* scripts/mescc.mes (main): Remove fallback doc/examples/main.c
2017-08-06 13:14:09 +02:00
Jan Nieuwenhuizen 12b41e0e86 mescc: Tinycc support: byte and word struct fields.
* stage0/x86.M1 (mov____%al,0x8(%edx)):
  (mov____%ax,(%edx)):
  (mov____%ax,0x32(%edx)):
  (mov____%ax,0x8(%edx)):
  (movzbl_0x32(%eax),%eax):
  (movzbl_0x8(%eax),%eax):
  (movzwl_0x32(%eax),%eax):
  (movzwl_0x8(%eax),%eax): New define.
* module/mes/as-i386.mes (i386:word-accu->base-mem):
  (i386:byte-accu->base-mem+n):
  (i386:word-accu->base-mem+n):
  (i386:byte-mem+n->accu):
  (i386:word-mem+n->accu): New function.
* module/mes/as-i386.scm: Export them.
* module/language/c99/compiler.mes (struct-field): Use actual size for
  simple types (WAS: 4).
  (decl->info):
  (expr->accu): Respect byte and word struct field sizes.
* scaffold/tests/7g-struct-byte-word-field.c: Test it.
* make.scm (add-scaffold-test): Build it.
2017-08-06 12:27:16 +02:00
Jan Nieuwenhuizen dd66f9b5d2 mescc: Tinycc support: fixes for foo.bar[baz].
* module/language/c99/compiler.mes (expr->accu, expr->accu*): fixes for foo.bar[baz].
* scaffold/tests/7c-dynarray.c: Test it.
2017-08-05 21:09:19 +02:00
Jan Nieuwenhuizen 95f107282d mescc: Tinycc support: fixes for foo->bar[baz].
* module/language/c99/compiler.mes (expr->accu, expr->accu*): fixes
  for foo->bar[baz].
  (expr->pointer): Support i-sel.
  (p-expr->type): Support add, sub, de-ref, ref-to.
* scaffold/tests/7f-struct-pointer-arithmetic.c: Test it.
* make.scm (add-scaffold-test): Build it.
2017-08-05 19:10:00 +02:00
Jan Nieuwenhuizen 31c69b8b00 mescc: Tinycc support: foo.bar[baz], foo->bar[baz] for typedef'd struct bar.
* module/language/c99/compiler.mes (expr->accu): foo.bar[baz],
  foo->bar[baz] for typedef'd struct bar.
* scaffold/tests/7c-dynarray.c: Test it.
2017-08-05 12:39:36 +02:00
Jan Nieuwenhuizen 3f4cc96a7b mescc: Tinycc support: foo[index]->bar for array bar.
* module/language/c99/compiler.mes (expr->accu*): foo[index]->bar for array bar.
* scaffold/tests/7e-struct-array-access.c: Test it.
* make.scm (add-scaffold-test): Build it.
2017-08-04 21:45:29 +02:00
Jan Nieuwenhuizen d64a304a83 mescc: Tinycc support: ((unsigned char*)str)[i].
* module/language/c99/compiler.mes (expr->accu*): Consider size of
  expr array deref.
* scaffold/tests/7d-cast-char.c: Test it.
2017-08-04 11:40:04 +02:00
Jan Nieuwenhuizen 949e320622 mescc: Tinycc support: ((unsigned char*)str)[0].
* module/language/c99/compiler.mes (expr->accu): Consider size of
  expr array deref.
* stage0/x86.M1 (movzbl_0x32(%ebp),%eax): New define.
* scaffold/tests/7d-cast-char.c: Test it.
2017-08-04 11:34:01 +02:00
Jan Nieuwenhuizen 0b60a58809 mescc: Tinycc support: support foo.bar[baz], foo->bar[baz] for struct bar.
* module/language/c99/compiler.mes (struct-field): Use negative
  pointer for struct array fields.
  (expr->accu): support: support foo.bar[baz], foo->bar[baz] for struct bar.
* scaffold/tests/7c-dynarray.c: Test it.
2017-08-01 11:26:00 +02:00
Jan Nieuwenhuizen c23a9ee01f mescc: drop naive realloc.
* mlibc/libc-gcc.c (free, memcpy): Move from libc-mes+tcc.c.
  (realloc): Use realloc from libc-mes+tcc.c
* mlibc/libc-gcc+tcc.c (free, memcpy, realloc): Remove.
* mlibc/libc-mes+tcc.c (free, memcpy, realloc): Remove.
* scaffold/tests/79-int-array.c (test): Update.
* scaffold/tests/7a-struct-char-array.c (test): Update.
2017-08-01 11:08:14 +02:00
Jan Nieuwenhuizen 1e37c9d9ea mescc: Tinycc support: ((foo*) p) + n.
* module/language/c99/compiler.mes init-declr->pointer, expr->pointer,
  expr->size): support: ((foo*) p) + n.
  (expr->accu*): Consider field size for foo.bar[baz].
* scaffold/tests/7b-struct-int-array.c: Test it.
* make.scm (add-scaffold-test): Build it.
2017-07-31 12:19:23 +02:00
Jan Nieuwenhuizen edb6bbcd9c mescc: Tinycc support: field size of foo.bar[baz], foo->bar[baz].
Inspired by a patch from rain1 for foo->bar[baz].

* module/language/c99/compiler.mes (expr->accu):
  (expr->accu*): Consider field size for foo.bar[baz].
* scaffold/tests/7a-struct-char-array.c: Test it.
* make.scm (add-scaffold-test): Build it.
2017-07-30 18:04:25 +02:00
Jan Nieuwenhuizen 9c4519af8d mescc: Tinycc support: int foo[bar] = {baz,...}.
* scaffold/tests/79-int-array.c: Test it.
* make.scm (add-scaffold-test): Build it.
* module/language/c99/compiler.mes (init-declr->count): New function.
  (decl->info): Support int foo[bar] = {baz,...}.
2017-07-30 08:27:05 +02:00
Jan Nieuwenhuizen bd3ab85e98 mescc: Tinycc support: union.struct.
* module/language/c99/compiler.mes (decl->info): Support struct inside union.
* scaffold/tests/78-union-struct.c: Test it.
* make.scm (add-scaffold-test): Build it.
2017-07-29 22:50:00 +02:00
Jan Nieuwenhuizen 042022419e mescc: Tinycc support: fix accu value after comparison.
* stage0/x86.M1 (setg___%al,, setge__%al, setl___%al, setle__%al): New
  defines.
* module/mes/as-i386.mes (i386:g?->accu, i386:ge?->accu,
  i386:l?->accu, i386:le?->accu, i386:jumpl, i386:jumple): New functions.
* module/mes/as-i386.scm: Export them.
* module/language/c99/compiler.mes (expr->accu): Use them to fix accu
  value after comparisons.
  (test-jump-label->info): Update comparison jumps.
2017-07-29 20:46:16 +02:00
Jan Nieuwenhuizen 683d5bf1d2 mescc: Tinycc support: foo.bar = foo.baz = bla.
* module/language/c99/compiler.mes (expr->base*): New function.
 (expr->accu): Use it to have value in accu for assignments.
* scaffold/tests/77-pointer-assign.c (test): Test it.
* stage0/x86.M1 (mov____%ecx,(%edx), mov___(%eax),%ecx): New define.
* module/mes/as-i386.mes (accu-mem->base->mem): New function.
  (i386:byte-base->accu-mem+n):
  (i386:byte-base->accu-mem):
  (i386:base-mem->accu-mem):
  (i386:base->accu-mem):
  (i386:value->accu-mem+n):
  (i386:value->accu-mem):
  (i386:accu->base-mem+n):
  (i386:byte-accu->base-mem):
  (i386:accu->base-mem): Rename from accu-address, base-address.
  Update callers.
* module/mes/as-i386.scm (mes): Update exports.
2017-07-28 22:45:32 +02:00
Jan Nieuwenhuizen e102ef94ca mescc: Tinycc support: fix foo[bar]->baz.
* module/language/c99/compiler.mes (expr->accu*): Lose one indirection.
* scaffold/tests/72-typedef-struct-def.c: Test it.
2017-07-29 08:37:34 +02:00