Commit Graph

48 Commits

Author SHA1 Message Date
Janneke Nieuwenhuizen 98f37a5bdb squash! mescc: Fix switch statements' fallthrough 2023-09-17 07:44:16 +02:00
Janneke Nieuwenhuizen 6ec2715f74 Revert "squash! mescc: Fix switch statements' fallthrough --support mes"
This reverts commit ef4f4bb25a.
2023-09-17 07:41:03 +02:00
Janneke Nieuwenhuizen c65ce2798b Revert "squash! squash! mescc: Fix switch statements' fallthrough --support mes"
This reverts commit 3266f6a834.
2023-09-17 07:41:01 +02:00
Janneke Nieuwenhuizen 3266f6a834 squash! squash! mescc: Fix switch statements' fallthrough --support mes 2023-09-16 17:38:48 +02:00
Janneke Nieuwenhuizen ef4f4bb25a squash! mescc: Fix switch statements' fallthrough --support mes 2023-09-16 08:19:02 +02:00
Ekaitz 1ec88d0109 mescc: Fix switch statements' fallthrough
Flattens case structures as nyacc is giving consecutive cases as a
nested block like:

    (case testA
      (case testB
        (case testC BODY)))

We convert to:

    ((case testA (expr-stmt))
     (case testB (expr-stmt))
     (case testC BODY))

And then treat them as independent cases. For the fallthrough we just
add a jump to each case's body right before its clause (each of the case
blocks is responsible of adding its own jump to its body):

        // This doesn't have it because it's the first
    CASE1:
        testA
    CASE1_BODY:

        goto CASE2_BODY
    CASE2:
        testB
    CASE2_BODY:

        goto CASE3_BODY
    CASE3:
        testB
    CASE3_BODY:

This enables complex fallthrough schemes comparing to what was done
before.

* module/mescc/compile.scm
  (ast->info)[switch]{flatten-cases}: New variable.
  (ast->info)[switch]{statements}: Use flatten-cases on it.
  (switch->expr): Remove unneeded matchers and add jumps to body.
* build-aux/check-mescc.sh(xfail-tests): Remove
  lib/tests/scaffold/66-local-char-array.c
2023-09-13 13:48:33 +02:00
Ekaitz 4e9f08e2af mescc: Add support for signed rotation.
* module/mescc/compile.scm (expr->register)[rshift, assn-expr]: Add
signed right-rotation support.
* lib/arm-mes/arm.M1 (asr): Add instruction.
* lib/x86-mes/x86.M1 (sar): Add instruction.
* lib/x86_64-mes/x86_64.M1 (sar): Add instruction.
* module/mescc/armv4/as.scm (armv4:r0>>r1-signed): New procedure.
(armv4:instructions): Register it.
* module/mescc/i386/as.scm (i386:r0>>r1-signed): New procedure.
(i386:instructions): Register it.
* module/mescc/riscv64/as.scm (riscv64:r0>>r1-signed): New procedure.
(riscv64:instructions): Register it.
* module/mescc/x86_64/as.scm (x86_64:r0>>r1-signed): New procedure.
(x86_64:instructions): Register it.
(
2023-09-12 11:04:11 +02:00
Ekaitz b12f56c922 mescc: Initialize missing struct fields to 0.
This is a follow-up to commits
    7a8a2fc517
    mescc: x86_64 support: Refactor to abstracted assembly, add x86_64.

and

    c9ba7a619b
    mescc: Refactor variable declaration.

There was a debug "22" leaking in compile.scm.  It should be a "0".

* module/mescc/compile.scm (init-local): Replace "22" with "0".
* lib/tests/scaffold/7v-struct-initialize-zeroes.c: New test.
* build-aux/check-mescc.sh (tcc_tests): Add it.
(xfail-tests): Remove lib/tests/scaffold/72-typedef-struct-def-local.c.
2023-09-12 11:04:11 +02:00
W. J. van der Laan 55b42018db mescc: Add r0-cmp-r1 instruction.
This instruction is used to compare two registers and set the flags
accordingly. In current architectures this is the same as r0-r1, but for
RISCV it will be different.  RISC-V does not have condition flags so
(until a better solution) we are going to emulate them there.

* module/mescc/armv4/as.scm (armv4:instructions): Add r0-cmp-r1 as alias
of r0-r1.
* module/mescc/i386/as.scm: Same.
* module/mescc/x86_64/as.scm: Same.
* module/mescc/compile.scm (expr->register): Make use of the new
r0-cmp-r1 instruction.
2023-09-12 11:04:10 +02:00
Janneke Nieuwenhuizen 6117207d72 squash! HACK mescc: Consider truncate after each shift operation.
Instead of truncating on size of first operand, truncate on largest of
default/int or size of first operand
2023-09-12 11:04:02 +02:00
Janneke Nieuwenhuizen 57b60fc794 HACK mescc: Consider truncate after each shift operation.
XXX For every binop / binop* operation?  We need tests?

* module/mescc/compile.scm (expr->register): After lshift and rshift,
use convert-r0.
2023-09-12 11:04:02 +02:00
Andrius Štikonas 08b1e9fefe mescc: Do not overflow M1 64bit immediates.
M1 immediates are limited to 31-bit before they become negative.

* module/mescc/x86_64/as.scm (x86_64:value->r, x86_64:r-cmp-value,
x86_64:r-long-mem-add, x86_64:r-and): Limit M1 immediate to #x80000000.

* lib/tests/scaffold/67-m1-overflow-check.c: New test.
* build-aux/check-mescc.sh (mes_tests): Add it.
2023-09-12 11:04:02 +02:00
Jan (janneke) Nieuwenhuizen 348dcbcbd7
mescc: Only use signed division when numerator is signed.
Currently, sign-extension (CLTD vs XOR EDX) and signed division (IDIV vs
DIV) selected by setting "signed?".  See, module/mescc/x86/as.scm.
Possibly we need a signed? based on numerator and denominator, and
add a extend-sign? based on the signedness of the numerator?

* module/mescc/compile.scm (expr->register): Base "signed?" strictly on
signedness of numerator.
2021-01-01 10:31:46 +01:00
Jan (janneke) Nieuwenhuizen fac6a873f7
mescc: Use unsigned type for sizeof expression.
* module/mescc/compile.scm (ast->type): Use unsigned type for sizeof
expression.
2021-01-01 10:30:48 +01:00
Jan (janneke) Nieuwenhuizen da03a384c8
mescc: Respect integer literal type suffixes.
* module/mescc/compile.scm (ast->type): Respect ULL, UL, U, LL, L suffix
on integer literals.
2021-01-01 10:28:24 +01:00
Jan (janneke) Nieuwenhuizen a551d9dcde
mescc: Use (format (current-error-port) ...) instead of stderr.
* module/mescc/M1.scm: Use (format (current-error-port) ...) instead of
stderr.
* module/mescc/compile.scm: Likewise.
* module/mescc/mescc.scm: Likewise.
* module/mescc/preprocess.scm: Likewise.
2020-12-30 21:20:19 +01:00
Jan Nieuwenhuizen 36b2857d5b
mescc: Opt for reproducible builds with Guile and Mes.
* module/mescc/compile.scm (mes-or-reproducible?): New variable.
(ast->comment): Use it.
* module/mescc/preprocess.scm (mes-or-reproducible?): New variable.
(c99-input->full-ast): Use it.
2020-01-20 22:47:51 +01:00
Jan Nieuwenhuizen c1bc77a1fb
mescc: Remove dead code. Thanks Mark Weaver.
* module/mescc/compile.scm (field-size): Remove dead function.
2019-09-09 16:04:16 +02:00
Danny Milosavljevic a5f16861ab
mescc: Put char's ASCII code into register, not char.
* module/mescc/compile.scm (expr-register): Put char's ASCII code into
register, not char.
2019-05-30 22:11:37 +02:00
Jan Nieuwenhuizen 7670d6be38
mes: Update to Nyacc 0.93.
* mes/module/nyacc/lang/c99/util.mes: New file.
* mes/module/nyacc/lang/c99/parser.mes: Use it.
* module/mescc/compile.scm (ast->info): Update for Nyacc 0.93.0.
* module/mescc/preprocess.scm (need-progress):  Likewise.
(ast-strip-comment): Likewise.
2019-06-09 19:42:42 +02:00
Jan Nieuwenhuizen 26891251a6
mescc: Do not dump variables with extern storage.
* lib/tests/scaffold/70-extern.stdout: New file.
* lib/tests/scaffold/70-extern.c: New file.
* build-aux/check-mescc.sh (TESTS): Add it..
* module/mescc/M1.scm (global-string?, global-extern?): New function.
(info->M1): Dump strings first.  Skip extern symbols.
* module/mescc/info.scm (<global>): Add storage field.
(make-global): Add storage parameter.  Pass it.
* module/mescc/compile.scm (make-global-entry): Likewise.
(global->info): Likewise.
(init-declr->info): Likewise.
(decl->info): Pass storage.
2019-07-27 17:22:00 +02:00
Jan Nieuwenhuizen c03807b78f
mescc: Be silent.
* module/mescc/M1.scm (infos->M1, info->M1): Add verbose?.  Move
debugging into verbose? > 1.
* module/mescc/compile.scm (c99-input->info, c99-ast->info): Likewise.
(mescc:trace-verbose): Rename from mescc:trace.
(mescc:trace): New function.
* module/mescc.scm (mescc:main): Likewise.
* module/mescc/mescc.scm (mescc:preprocess, c->ast mescc:compile,
c->info, E->info): Likewise.
* module/mescc/preprocess.scm (c99-input->full-ast, c99-input->ast):
Likewise.
2019-07-27 09:51:21 +02:00
Jan Nieuwenhuizen af1cc3ce81
mescc: Add <include>/<kernel>/<arch> to include path.
* module/mescc/preprocess.scm (c99-input->full-ast): Add
<include>/<kernel>/<arch> to include path.
* module/mescc/compile.scm (c99-input->info): Pass arch.
* module/mescc/mescc.scm (mescc:preprocess): Likewise.
(c->info): Likewise.
(c->ast): Likewise.
2019-07-26 22:44:04 +02:00
Jan Nieuwenhuizen 2197252482
mescc: Add 70-function-destruct-declare.c test.
* module/mescc/compile.scm (init-declr->info): Do not attempt to
re-calculate function type.
(ftn-declr:get-type): Remove.
* lib/tests/scaffold/70-function-destruct-declare.c: New file.
* build-aux/check-mescc.sh (TESTS): Add it.
2019-07-26 19:09:12 +02:00
Jan Nieuwenhuizen 2611a64b2e
mescc: Add 70-struct-post.c test with fix.
* lib/tests/scaffold/70-struct-post.c: New file.
* build-aux/check-mescc.sh (TESTS): Add it.
* module/mescc/compile.scm (expr->register): Use type size for rank
0 (WAS: 1).
2019-07-21 22:40:42 +02:00
Jan Nieuwenhuizen 2f77f506b1
mescc: Add 70-struct-short-enum-init.c test with fix.
* module/mescc/compile.scm (init->data): Respect type of size.
* lib/tests/scaffold/70-struct-short-enum-init.c: New file.
* lib/tests/scaffold/70-struct-short-enum-init.stdout: New file.
* build-aux/check-mescc.sh (TESTS): Add test.
2019-07-21 16:48:26 +02:00
Jan Nieuwenhuizen 8e01a68357
mescc: Add 70-array-in-struct-init.c test with fix.
* lib/tests/scaffold/70-array-in-struct-init.c: New file.
* lib/tests/scaffold/70-array-in-struct-init.stdout: New file.
* build-aux/check-mescc.sh (TESTS): Add test.
* module/mescc/compile.scm (array-init-element->data): Recurse for
elements instead of using init->data.  Support array fields.
2019-07-20 17:14:55 +02:00
Jan Nieuwenhuizen 90b384def3
mes: Support map and for-each with lists of unequal length.
* mes/module/mes/base.mes (map): Support lists of unequal length.
* mes/module/mes/scm.mes (for-each): Likewise.
* module/mescc/compile.scm (expr->register): Fix compile warning.
* tests/scm.test ("map 1,2", "map 2,1", "for-each 1,2", "for-each
2,1": Test it.
2019-03-02 14:33:58 +01:00
Jan Nieuwenhuizen 0a32045caf
mescc: Replace \r in comments.
* module/mescc/compile.scm (ast->comment): Replace \r in comments.
2018-12-02 07:26:07 +01:00
Jan Nieuwenhuizen 149f2a3e51
core: String as array of bytes.
* src/strings.c: New file.
* src/mes.c: Use it.  Update users.
2018-11-11 16:25:36 +01:00
Jan Nieuwenhuizen 0feea9ae52
mescc: Recognize U integer suffix.
* module/mescc/compile.scm (cstring->int): Recognize U integer
suffix.  Thanks, Peter de Wachter!
2018-10-19 23:31:30 +02:00
Peter De Wachter b560899d84
mescc: Allow superfluous parentheses in function declarations.
E.g.:  int (f)();
This is obscure but valid C.  It occurs in the csmith headers (thanks
to macro shenanigans).

* module/mescc/compile.scm (fctn-defn:get-name,
fctn-defn:get-statement): Allow superfluous parentheses in function declarations.
2018-10-16 20:40:40 +02:00
Peter De Wachter ab57acfa01
mescc: Implement unary plus operator.
* module/mescc/compile.scm (ast->type, expr->register,
try-expr->number):): Implement unary plus operator.
2018-10-16 20:40:38 +02:00
Jan Nieuwenhuizen 6ab9a206bb
mescc: Nyacc comment escapes.
* module/mescc/compile.scm (ast->comment): Nyacc comment escapes.
2018-10-06 20:32:49 +02:00
Jan Nieuwenhuizen dc4b7f3a37
mescc: Fix clobbering of struct by value assign.
* module/mescc/x86_64/as.scm (long-r0->r1-mem): New instruction.
* module/mescc/i386/as.scm: Likewise.
* lib/x86_64-mes/x86_64.M1: Support it.
* module/mescc/compile.scm (r0->r1-mem*n-): Fix clobbering.
2018-10-06 20:23:43 +02:00
Jan Nieuwenhuizen eedf2d2381
mescc: Fix obnoxious assignment ERROR message.
* module/mescc/compile.scm (expression->register): Fix assignment
ERROR message.
2018-10-06 19:22:16 +02:00
Jan Nieuwenhuizen 3dd4da895f
mescc: Support negative divide.
* module/mescc/i386/as.scm (i386:r0/r1, i386:r0%r1): Support
negative divide.
* module/mescc/x86_64/as.scm (x86_64:r0/r1, x86_64:r0%r1): Likewise.
* lib/x86-mes/x86.M1: Likewise.
* lib/x86_64-mes/x86_64.M1: Likewise.
* scaffold/tests/a0-math-divide-signed-negative.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
2018-10-06 17:28:08 +02:00
Jan Nieuwenhuizen d862f1eceb
mescc: Support --align, off by default.
* scripts/mescc.in (parse-opts): Add --align.
* module/mescc/mescc.scm (mescc:compile): Support --align, off by
default.
* module/mescc/M1.scm (infos->M1): Add #:align parameter.
(M1:merge-infos): Likewise.  Keep types.
(info->M1): Likewise.  Make alignment switchable.
* module/mescc/compile.scm (r->ident):  Do not clobber.
(ident-add): Likewise.
(clean-info): Keep types.
* module/mescc/i386/as.scm (i386:r->byte-label): New instruction.
* lib/x86-mes/x86.M1: Add instructions.
* lib/x86_64-mes/x86_64.M1: Add instructions.
* module/mescc/x86_64/as.scm (x86_64:r->byte-label,
x86_64:r->word-label, x86_64:r->long-label): New instruction.
2018-10-06 15:56:14 +02:00
Jan Nieuwenhuizen 3584f45056
Revert "mescc: Make globals at least reg-size."
This reverts commit 30544316c35ed4a2472f2029beb27e007d913792.
2018-10-06 15:57:52 +02:00
Jan Nieuwenhuizen b456a32cf0
mescc: Make globals at least reg-size.
* module/mescc/compile.scm (global->info): Make globals at least reg-size.
2018-10-06 15:36:32 +02:00
Jan Nieuwenhuizen 51085ba25c
mescc: Support 64-bit immediates.
* module/mescc/M1.scm (hex2:address8, hex2:immediate8): New function.
(info->M1): Support 64-bit.
* module/mescc/compile.scm (convert-r0): FIXME!
* module/mescc/x86_64/as.scm (x86_64:value->r, x86_64:r->local,
x86_64:label->arg, x86_64:label->r, x86_64:r+value,
x86_64:r-cmp-value, x86_64:r-long-mem-add, x86_64:r-and): Support
64-bit immediates.
* lib/x86_64-mes/x86_64.M1: Likewise.
* scaffold/tests/17-compare-unsigned-char-le.c: Test it.
* scaffold/tests/17-compare-unsigned-short-le.c: Test it.
* build-aux/check-mescc.sh (tests): Run them.
2018-10-06 14:51:57 +02:00
Jan Nieuwenhuizen be4f23fae6
mescc: Fix truncation of short.
* module/mescc/compile.scm (convert-r0): Typo.  Fixes truncation of
short.  Thanks, pdewacht!
* scaffold/tests/a0-call-trunc-char.c: New file.
* scaffold/tests/a0-call-trunc-short.c: New file.
* build-aux/check-mescc.sh: Add them.
2018-10-06 11:57:04 +02:00
Jan Nieuwenhuizen 7a8a2fc517
mescc: x86_64 support: Refactor to abstracted assembly, add x86_64.
* module/mescc/as.scm: Support abstracted assembly.
* module/mescc/i386/as.scm: Rewrite.
* module/mescc/x86_64/as.scm: Implement.
* module/mescc/compile.scm: Refactor to abstracted assembly.
* module/mescc/M1.scm: Update for partial 64 bit support.
* module/mescc/bytevectors.scm (bytevector-u64-native-set!): New
procedure.
* module/mescc/i386/info.scm (i386:type-alist): Use 4 byte type length
also for faking double, long long, long double.
* module/mescc/info.scm:modified:
* module/mescc/x86_64/info.scm (x86_64:registers): New variable.
* lib/x86-mes/x86.M1: Update for new register scheme.
* lib/x86_64-mes/x86_64.M1: Implement.
* lib/x86-mes/setjmp.c: Implement.
* lib/x86_64-mes-gcc/setjmp.c: Implement.
* build-aux/build-cc.sh: Update for x86_64.
* build-aux/build-cc32.sh: Likewise.
* build-aux/build-mes.sh: Likewise.
* build-aux/build-x86_64-mes.sh: Likewise.
* build-aux/check-mescc.sh: Likewise.
* build-aux/test64.sh: Likewise.
* include/libmes.h: Likewise.
* include/setjmp.h: Likewise.
* include/signal.h: Likewise.
* include/stdarg.h: Likewise.
* include/sys/stat.h: Likewise.
* include/sys/types.h: Likewise.
* include/sys/wait.h: Likewise.
* include/unistd.h: Likewise.
* lib/libc+gnu.c: Likewise.
* lib/libc+tcc.c: Likewise.
* lib/linux/gnu.c: Likewise.
* lib/linux/libc-mini.c: Likewise.
* lib/linux/libc.c: Likewise.
* lib/linux/tcc.c: Likewise.
* lib/linux/x86_64-mes-gcc/mes.c: Likewise.
* lib/linux/x86_64-mes/crt1.c: Likewise.
* lib/mes/abtol.c: Likewise.
* lib/posix/mktemp.c: Likewise.
* lib/posix/wait.c: Likewise.
* lib/stdio/fopen.c: Likewise.
* lib/stdio/fputc.c: Likewise.
* lib/stdio/fseek.c: Likewise.
* lib/stdio/printf.c: Likewise.
* lib/stdio/sprintf.c: Likewise.
* lib/stdio/vfprintf.c: Likewise.
* lib/stdio/vsprintf.c: Likewise.
* lib/stdio/vsscanf.c: Likewise.
* lib/stdlib/qsort.c: Likewise.
* lib/x86-mes-gcc/setjmp.c: Likewise.
* scaffold/tests/11-if-1.c: Likewise.
* scaffold/tests/15-if-!f.c: Likewise.
* scaffold/tests/16-if-t.c: Likewise.
* scaffold/tests/21-char[].c: Likewise.
* scaffold/tests/23-pointer.c: Likewise.
* scaffold/tests/32-compare.c: Likewise.
* scaffold/tests/33-and-or.c: Likewise.
* scaffold/tests/34-pre-post.c: Likewise.
* scaffold/tests/35-compare-char.c: Likewise.
* scaffold/tests/36-compare-arithmetic.c: Likewise.
* scaffold/tests/37-compare-assign.c: Likewise.
* scaffold/tests/38-compare-call.c: Likewise.
* scaffold/tests/40-if-else.c: Likewise.
* scaffold/tests/41-?.c: Likewise.
* scaffold/tests/42-goto-label.c: Likewise.
* scaffold/tests/43-for-do-while.c: Likewise.
* scaffold/tests/44-switch.c: Likewise.
* scaffold/tests/45-void-call.c: Likewise.
* scaffold/tests/46-function-static.c: Likewise.
* scaffold/tests/51-strcmp.c: Likewise.
* scaffold/tests/51-strncmp.c: Likewise.
* scaffold/tests/53-strcpy.c: Likewise.
* scaffold/tests/54-argv.c: Likewise.
* scaffold/tests/60-math.c: Likewise.
* scaffold/tests/61-array.c: Likewise.
* scaffold/tests/63-struct-cell.c: Likewise.
* scaffold/tests/64-make-cell.c: Likewise.
* scaffold/tests/65-read.c: Likewise.
* scaffold/tests/70-printf.c: Likewise.
* scaffold/tests/71-struct-array.c: Likewise.
* scaffold/tests/72-typedef-struct-def.c: Likewise.
* scaffold/tests/74-multi-line-string.c: Likewise.
* scaffold/tests/76-pointer-arithmetic.c: Likewise.
* scaffold/tests/79-int-array.c: Likewise.
* scaffold/tests/7a-struct-char-array.c: Likewise.
* scaffold/tests/7b-struct-int-array.c: Likewise.
* scaffold/tests/7i-struct-struct.c: Likewise.
* scaffold/tests/7k-for-each-elem.c: Likewise.
* scaffold/tests/7l-struct-any-size-array.c: Likewise.
* scaffold/tests/7o-struct-pre-post.c: Likewise.
* scaffold/tests/7q-bit-field.c: Likewise.
* scaffold/tests/7s-struct-short.c: Likewise.
* scaffold/tests/80-setjmp.c: Likewise.
* scaffold/tests/81-qsort.c: Likewise.
* scaffold/tests/85-sizeof.c: Likewise.
* scaffold/tests/87-sscanf.c: Likewise.
* scaffold/tests/90-strpbrk.c: Likewise.
* scaffold/tests/91-fseek.c: Likewise.
* scaffold/tests/95-signal.c: Likewise.
* scaffold/tests/97-fopen.c: Likewise.
* scaffold/tests/99-readdir.c: Likewise.
* scaffold/tests/t.c: Likewise.
* lib/linux/x86_64-mes/mes.c: New file.
* lib/linux/x86_64-mes/mini.c: New file.
* lib/x86_64-mes/setjmp.c: New file.
* scaffold/tests/06-!call-1.c: New file.
* scaffold/tests/06-call-2.c: New file.
* scaffold/tests/06-call-variable.c: New file.
* scaffold/tests/08-assign-global.c: New file.
* scaffold/tests/08-assign-negative.c: New file.
* scaffold/tests/17-compare-and-or.c: New file.
* scaffold/tests/17-compare-and.c: New file.
* scaffold/tests/17-compare-ge.c: New file.
* scaffold/tests/17-compare-gt.c: New file.
* scaffold/tests/17-compare-le.c: New file.
* scaffold/tests/17-compare-lt.c: New file.
* scaffold/tests/17-compare-or.c: New file.
* scaffold/tests/17-compare-unsigned-ge.c: New file.
* scaffold/tests/17-compare-unsigned-gt.c: New file.
* scaffold/tests/17-compare-unsigned-le.c: New file.
* scaffold/tests/17-compare-unsigned-lt.c: New file.
* scaffold/tests/21-char[]-simple.c: New file.
* scaffold/tests/23-global-pointer-init-null.c: New file.
* scaffold/tests/23-global-pointer-init.c: New file.
* scaffold/tests/23-global-pointer-pointer-ref.c: New file.
* scaffold/tests/23-global-pointer-ref.c: New file.
* scaffold/tests/23-pointer-sub.c: New file.
* scaffold/tests/31-oputs.c: New file.
* scaffold/tests/32-call-wrap.c: New file.
* scaffold/tests/38-compare-call-2.c: New file.
* scaffold/tests/38-compare-call-3.c: New file.
* scaffold/tests/51-pointer-sub.c: New file.
* scaffold/tests/54-argc.c: New file.
* scaffold/tests/63-struct-array-assign.c: New file.
* scaffold/tests/63-struct-array-compare.c: New file.
* scaffold/tests/63-struct-array.c: New file.
* scaffold/tests/63-struct-assign.c: New file.
* scaffold/tests/63-struct-function.c: New file.
* scaffold/tests/63-struct-local.c: New file.
* scaffold/tests/63-struct-pointer.c: New file.
* scaffold/tests/63-struct.c: New file.
* scaffold/tests/70-printf-hello.c: New file.
* scaffold/tests/70-printf-simple.c: New file.
* scaffold/tests/70-stdarg.c: New file.
* scaffold/tests/70-strchr.c: New file.
* scaffold/tests/73-union-hello.c: New file.
* scaffold/tests/76-pointer-arithmetic-pp.c: New file.
* scaffold/tests/79-int-array-simple.c: New file.
* scaffold/tests/7b-struct-int-array-hello.c: New file.
* scaffold/tests/7b-struct-int-array-pointer.c: New file.
* scaffold/tests/7i-struct-struct-simple.c: New file.
* scaffold/tests/7k-for-each-elem-simple.c: New file.
* scaffold/tests/7l-struct-any-size-array-simple.c: New file.
* scaffold/tests/7o-struct-pre-post-simple.c: New file.
* scaffold/tests/7q-bit-field-simple.c: New file.
* scaffold/tests/90-strspn.c: New file.
* scaffold/tests/06-call-string.c.: Rename from 31-eputs.c.
* scaffold/tests/7t-function-destruct.c: Rename from 48-function-destruct.c.
* scaffold/tests/48-global-static.c: Rename from 49-global-static.c.
* scaffold/tests/55-char-array.c:renamed: Rename from 4a-char-array.c.
* scaffold/tests/51-itoa.c:r Rename from 52-itoa.c.
* include/signal.h:(struct sigaction):
2018-08-15 18:26:55 +02:00
Jan Nieuwenhuizen 3e1a197ed1
mescc: Initial x86_64 support.
make all-go && MES=guile ./pre-inst-env scripts/mescc -m64 -c scaffold/main.c
2018-08-14 20:32:56 +02:00
Jan Nieuwenhuizen ee9081f3ec
mescc: Prepare for x86_64 support.
* module/mescc/info.scm (info): Add allocated, registers.
* module/mescc/i386/info.scm: New file.
* build-aux/build-guile.sh (SCM_FILES): Add it.
* module/mescc/compile.scm (c99-input->info): Add info parameter.
(c99-ast->info): Likewise.
(i386:type-alist): Remove.
(alloc-register, free-register): New function.
(expr->register*): Rename from expr->accu*.  Update callers.
(expr->accu): Rename from expr->accu.  Update callers.
* module/mescc/mescc.scm(%info): New variable.
* module/mescc/mescc.scm (c->ast): Use it.
(mescc:compile): Likewise.
(E->info): Likewise.
2018-08-14 12:35:24 +02:00
Jan Nieuwenhuizen 72cb975213
GNU Mes.
Throughout, make these changes

   Copyright headers: GNU Mes
   First mention of name: GNU Mes
   Website: https://www.gnu.org/software/mes
   Git:     git://git.savannah.gnu.org/mes.git
2018-07-22 14:24:36 +02:00
Jan Nieuwenhuizen d9df00290c
mescc: Support verbose int types.
* module/mescc/compile.scm (i386:type-alist): Support verbose int types.
2018-07-21 12:02:16 +02:00
Jan Nieuwenhuizen a10c48735d
mescc: Posixify interface.
* module/mescc/compile.mes: Move from language/c99/compiler.mes.
* module/mescc: New module..
* module/mescc/M1.scm: Move from mes/M1.mes.
* module/mescc/as.scm: Likewise.
* module/mescc/bytevectors.scm: Likewise.
* module/mescc/mescc.scm: New file.
* scripts/mescc: Update to new layout and posixy interface.
* GNUmakefile: Likewise.
* 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/cc-mlibc.sh: Likewise.
* build-aux/cc.sh: Likewise.
* build-aux/check-mescc.sh: Likewise.
* build-aux/test.sh: Likewise.
* build.sh: Likewise.
* .gitignore: Update for posixy extensions.
2018-05-25 08:05:02 +02:00