Commit graph

824 commits

Author SHA1 Message Date
Jan Nieuwenhuizen 37ed2c15bf build: Bugfix for store.
* guile/guix/make.scm (store): Add each store file only once.
2017-07-26 11:36:07 +02:00
Jan Nieuwenhuizen 1bddb52c75 build: Resurrect guile-2.0. Thanks rain1!
* module/mes/guile.scm: New file.
* module/mes/elf.scm: Include it.
* module/mes/bytevectors.scm: : Include it.
* module/mes/as.scm: Include it.
* module/mes/as-i386.scm: Include it.
* module/mes/M1.scm: Include it.
* module/language/c99/compiler.scm: Include it.
* make.scm: Update.
2017-07-26 11:36:07 +02:00
Jan Nieuwenhuizen 822d0df889 build: Non-Guix build robustifications. Thanks, rain1!
Fix typo in configure, gracefully switch between M0 vs M1, skip
CC32/i686-unknown-linux-gnu-gcc targets if not available, esp. for
non-Guix usage.

* configure (M1): Declare missing variable.
* make.scm (main): all-go, clean-go: New targets.
* GNUmakefile (PHONY_TARGETS): Add them.
  (.config.make): New target.
* guile/guix/make.scm (%CC32): Set to #f if not found.
  (bin.gcc): Skip if CC not set.
  (check-target?, add-target): Skip if target is not set.
2017-07-26 11:36:07 +02:00
Jan Nieuwenhuizen b708c5de8b build: Fix snarf dependencies.
* guile/guix/make.scm (compile.gcc compile.mescc bin.mescc m1-asm):
  Accept and forward dependencies.
* make.scm (gcc-snarf-targets): Remove explicit defaults.
2017-07-26 11:36:07 +02:00
Jan Nieuwenhuizen aef03ebd39 build: Use released M0 intead of M1. 2017-07-26 11:36:07 +02:00
Jan Nieuwenhuizen 6a391df5e0 mescc: Import tinycc test suite.
* make.scm (check-scaffold-tinycc): New target.
* guile/guix/make.scm (<target>): Add baseline field.
  (method-check): Handle baseline.
* scaffold/tinycc/00_assignment.c: New file.
* scaffold/tinycc/00_assignment.expect: New file.
* scaffold/tinycc/01_comment.c: New file.
* scaffold/tinycc/01_comment.expect: New file.
* scaffold/tinycc/02_printf.c: New file.
* scaffold/tinycc/02_printf.expect: New file.
* scaffold/tinycc/03_struct.c: New file.
* scaffold/tinycc/03_struct.expect: New file.
* scaffold/tinycc/04_for.c: New file.
* scaffold/tinycc/04_for.expect: New file.
* scaffold/tinycc/05_array.c: New file.
* scaffold/tinycc/05_array.expect: New file.
* scaffold/tinycc/06_case.c: New file.
* scaffold/tinycc/06_case.expect: New file.
* scaffold/tinycc/07_function.c: New file.
* scaffold/tinycc/07_function.expect: New file.
* scaffold/tinycc/08_while.c: New file.
* scaffold/tinycc/08_while.expect: New file.
* scaffold/tinycc/09_do_while.c: New file.
* scaffold/tinycc/09_do_while.expect: New file.
* scaffold/tinycc/10_pointer.c: New file.
* scaffold/tinycc/10_pointer.expect: New file.
* scaffold/tinycc/11_precedence.c: New file.
* scaffold/tinycc/11_precedence.expect: New file.
* scaffold/tinycc/12_hashdefine.c: New file.
* scaffold/tinycc/12_hashdefine.expect: New file.
* scaffold/tinycc/13_integer_literals.c: New file.
* scaffold/tinycc/13_integer_literals.expect: New file.
* scaffold/tinycc/14_if.c: New file.
* scaffold/tinycc/14_if.expect: New file.
* scaffold/tinycc/15_recursion.c: New file.
* scaffold/tinycc/15_recursion.expect: New file.
* scaffold/tinycc/16_nesting.c: New file.
* scaffold/tinycc/16_nesting.expect: New file.
* scaffold/tinycc/17_enum.c: New file.
* scaffold/tinycc/17_enum.expect: New file.
* scaffold/tinycc/18_include.h: New file.
* scaffold/tinycc/18_include.c: New file.
* scaffold/tinycc/18_include.expect: New file.
* scaffold/tinycc/19_pointer_arithmetic.c: New file.
* scaffold/tinycc/19_pointer_arithmetic.expect: New file.
* scaffold/tinycc/20_pointer_comparison.c: New file.
* scaffold/tinycc/20_pointer_comparison.expect: New file.
* scaffold/tinycc/21_char_array.c: New file.
* scaffold/tinycc/21_char_array.expect: New file.
* scaffold/tinycc/22_floating_point.c: New file.
* scaffold/tinycc/22_floating_point.expect: New file.
* scaffold/tinycc/23_type_coercion.c: New file.
* scaffold/tinycc/23_type_coercion.expect: New file.
* scaffold/tinycc/24_math_library.c: New file.
* scaffold/tinycc/24_math_library.expect: New file.
* scaffold/tinycc/25_quicksort.c: New file.
* scaffold/tinycc/25_quicksort.expect: New file.
* scaffold/tinycc/26_character_constants.c: New file.
* scaffold/tinycc/26_character_constants.expect: New file.
* scaffold/tinycc/27_sizeof.c: New file.
* scaffold/tinycc/27_sizeof.expect: New file.
* scaffold/tinycc/28_strings.c: New file.
* scaffold/tinycc/28_strings.expect: New file.
* scaffold/tinycc/29_array_address.c: New file.
* scaffold/tinycc/29_array_address.expect: New file.
* scaffold/tinycc/30_hanoi.c: New file.
* scaffold/tinycc/30_hanoi.expect: New file.
* scaffold/tinycc/31_args.c: New file.
* scaffold/tinycc/31_args.expect: New file.
* scaffold/tinycc/32_led.c: New file.
* scaffold/tinycc/32_led.expect: New file.
* scaffold/tinycc/33_ternary_op.c: New file.
* scaffold/tinycc/33_ternary_op.expect: New file.
* scaffold/tinycc/34_array_assignment.c: New file.
* scaffold/tinycc/34_array_assignment.expect: New file.
* scaffold/tinycc/35_sizeof.c: New file.
* scaffold/tinycc/35_sizeof.expect: New file.
* scaffold/tinycc/36_array_initialisers.c: New file.
* scaffold/tinycc/36_array_initialisers.expect: New file.
* scaffold/tinycc/37_sprintf.c: New file.
* scaffold/tinycc/37_sprintf.expect: New file.
* scaffold/tinycc/38_multiple_array_index.c: New file.
* scaffold/tinycc/38_multiple_array_index.expect: New file.
* scaffold/tinycc/39_typedef.c: New file.
* scaffold/tinycc/39_typedef.expect: New file.
* scaffold/tinycc/40_stdio.c: New file.
* scaffold/tinycc/40_stdio.expect: New file.
* scaffold/tinycc/41_hashif.c: New file.
* scaffold/tinycc/41_hashif.expect: New file.
* scaffold/tinycc/42_function_pointer.c: New file.
* scaffold/tinycc/42_function_pointer.expect: New file.
* scaffold/tinycc/43_void_param.c: New file.
* scaffold/tinycc/43_void_param.expect: New file.
* scaffold/tinycc/44_scoped_declarations.c: New file.
* scaffold/tinycc/44_scoped_declarations.expect: New file.
* scaffold/tinycc/45_empty_for.c: New file.
* scaffold/tinycc/45_empty_for.expect: New file.
* scaffold/tinycc/46_grep.c: New file.
* scaffold/tinycc/46_grep.expect: New file.
* scaffold/tinycc/47_switch_return.c: New file.
* scaffold/tinycc/47_switch_return.expect: New file.
* scaffold/tinycc/48_nested_break.c: New file.
* scaffold/tinycc/48_nested_break.expect: New file.
* scaffold/tinycc/49_bracket_evaluation.c: New file.
* scaffold/tinycc/49_bracket_evaluation.expect: New file.
* scaffold/tinycc/50_logical_second_arg.c: New file.
* scaffold/tinycc/50_logical_second_arg.expect: New file.
* scaffold/tinycc/51_static.c: New file.
* scaffold/tinycc/51_static.expect: New file.
* scaffold/tinycc/52_unnamed_enum.c: New file.
* scaffold/tinycc/52_unnamed_enum.expect: New file.
* scaffold/tinycc/54_goto.c: New file.
* scaffold/tinycc/54_goto.expect: New file.
* scaffold/tinycc/55_lshift_type.c: New file.
* scaffold/tinycc/55_lshift_type.expect: New file.
* scaffold/tinycc/56_btype_excess-1.c: New file.
* scaffold/tinycc/56_btype_excess-1.expect: New file.
* scaffold/tinycc/57_btype_excess-2.c: New file.
* scaffold/tinycc/57_btype_excess-2.expect: New file.
* scaffold/tinycc/58_function_redefinition.c: New file.
* scaffold/tinycc/58_function_redefinition.expect: New file.
* scaffold/tinycc/59_function_array.c: New file.
* scaffold/tinycc/59_function_array.expect: New file.
* scaffold/tinycc/60_enum_redefinition.c: New file.
* scaffold/tinycc/60_enum_redefinition.expect: New file.
* scaffold/tinycc/61_undefined_enum.c: New file.
* scaffold/tinycc/61_undefined_enum.expect: New file.
* scaffold/tinycc/62_enumerator_redefinition.c: New file.
* scaffold/tinycc/62_enumerator_redefinition.expect: New file.
* scaffold/tinycc/63_local_enumerator_redefinition.c: New file.
* scaffold/tinycc/63_local_enumerator_redefinition.expect: New file.
* scaffold/tinycc/64_macro_nesting.c: New file.
* scaffold/tinycc/64_macro_nesting.expect: New file.
* scaffold/tinycc/67_macro_concat.c: New file.
* scaffold/tinycc/67_macro_concat.expect: New file.
* scaffold/tinycc/70_floating_point_literals.c: New file.
* scaffold/tinycc/70_floating_point_literals.expect: New file.
* scaffold/tinycc/71_macro_empty_arg.c: New file.
* scaffold/tinycc/71_macro_empty_arg.expect: New file.
* scaffold/tinycc/72_long_long_constant.c: New file.
* scaffold/tinycc/72_long_long_constant.expect: New file.
* scaffold/tinycc/73_arm64.c: New file.
* scaffold/tinycc/73_arm64.expect: New file.
* scaffold/tinycc/74_nocode_wanted.c: New file.
* scaffold/tinycc/74_nocode_wanted.expect: New file.
* scaffold/tinycc/75_array_in_struct_init.c: New file.
* scaffold/tinycc/75_array_in_struct_init.expect: New file.
* scaffold/tinycc/76_dollars_in_identifiers.c: New file.
* scaffold/tinycc/76_dollars_in_identifiers.expect: New file.
* scaffold/tinycc/77_push_pop_macro.c: New file.
* scaffold/tinycc/77_push_pop_macro.expect: New file.
* scaffold/tinycc/78_vla_label.c: New file.
* scaffold/tinycc/78_vla_label.expect: New file.
* scaffold/tinycc/79_vla_continue.c: New file.
* scaffold/tinycc/79_vla_continue.expect: New file.
* scaffold/tinycc/80_flexarray.c: New file.
* scaffold/tinycc/80_flexarray.expect: New file.
* scaffold/tinycc/81_types.c: New file.
* scaffold/tinycc/81_types.expect: New file.
* scaffold/tinycc/82_attribs_position.c: New file.
* scaffold/tinycc/82_attribs_position.expect: New file.
* scaffold/tinycc/83_utf8_in_identifiers.c: New file.
* scaffold/tinycc/83_utf8_in_identifiers.expect: New file.
* scaffold/tinycc/84_hex-float.c: New file.
* scaffold/tinycc/84_hex-float.expect: New file.
* scaffold/tinycc/85_asm-outside-function.c: New file.
* scaffold/tinycc/85_asm-outside-function.expect: New file.
* scaffold/tinycc/86_memory-model.c: New file.
* scaffold/tinycc/86_memory-model.expect: New file.
* scaffold/tinycc/87_dead_code.c: New file.
* scaffold/tinycc/87_dead_code.expect: New file.
* scaffold/tinycc/88_codeopt.c: New file.
* scaffold/tinycc/88_codeopt.expect: New file.
* scaffold/tinycc/89_nocode_wanted.c: New file.
* scaffold/tinycc/89_nocode_wanted.expect: New file.
* scaffold/tinycc/90_struct-init.c: New file.
* scaffold/tinycc/90_struct-init.expect: New file.
* scaffold/tinycc/91_ptr_longlong_arith32.c: New file.
* scaffold/tinycc/91_ptr_longlong_arith32.expect: New file.
* scaffold/tinycc/92_enum_bitfield.c: New file.
* scaffold/tinycc/92_enum_bitfield.expect: New file.
* scaffold/tinycc/93_integer_promotion.c: New file.
* scaffold/tinycc/93_integer_promotion.expect: New file.
* scaffold/tinycc/COPYING: New file.
* scaffold/tinycc/LICENSE: New file.

include
2017-07-26 11:36:07 +02:00
Jan Nieuwenhuizen 64db2eaf7d test: Split-up Mescc scaffold test.
* make.scm (check-scaffold, check-scaffold-tests): New targets.
* mlibc/include/00-test.i: New file.
* mlibc/include/30-test.i: New file.
* mlibc/mini-libc-mes.c (puts): New function.
* scaffold/tests/00-exit-0.c: : New file.
* scaffold/tests/01-return-0.c: : New file.
* scaffold/tests/02-return-1.c: : New file.
* scaffold/tests/03-call.c: : New file.
* scaffold/tests/04-call-0.c: : New file.
* scaffold/tests/05-call-1.c: : New file.
* scaffold/tests/06-call-!1.c: : New file.
* scaffold/tests/10-if-0.c: : New file.
* scaffold/tests/11-if-1.c: : New file.
* scaffold/tests/12-if-==.c: : New file.
* scaffold/tests/13-if-!=.c: : New file.
* scaffold/tests/14-if-goto.c: : New file.
* scaffold/tests/15-if-!f.c: : New file.
* scaffold/tests/16-if-t.c: : New file.
* scaffold/tests/20-while.c: : New file.
* scaffold/tests/21-char[].c: : New file.
* scaffold/tests/22-while-char[].c: : New file.
* scaffold/tests/30-strlen.c: : New file.
* scaffold/tests/31-eputs.c: : New file.
* scaffold/tests/32-compare.c: : New file.
* scaffold/tests/33-and-or.c: : New file.
* scaffold/tests/34-pre-post.c: : New file.
* scaffold/tests/35-compare-char.c: : New file.
* scaffold/tests/36-compare-arithmetic.c: : New file.
* scaffold/tests/37-compare-assign.c: : New file.
* scaffold/tests/38-compare-call.c: : New file.
* scaffold/tests/40-if-else.c: : New file.
* scaffold/tests/41-?.c: : New file.
* scaffold/tests/42-goto-label.c: : New file.
* scaffold/tests/43-for-do-while.c: : New file.
* scaffold/tests/44-switch.c: : New file.
* scaffold/tests/45-void-call.c: : New file.
* scaffold/tests/50-assert.c: : New file.
* scaffold/tests/51-strcmp.c: : New file.
* scaffold/tests/52-itoa.c: : New file.
* scaffold/tests/53-strcpy.c: : New file.
* scaffold/tests/54-argv.c: : New file.
* scaffold/tests/60-math.c: : New file.
* scaffold/tests/61-array.c: : New file.
* scaffold/tests/63-struct-cell.c: : New file.
* scaffold/tests/64-make-cell.c: : New file.
* scaffold/tests/65-read.c: : New file.
* scaffold/tests/66-struct-array.c: : New file.
* scaffold/t.c: Remove.
* scaffold/t-tcc.c: Remove.
2017-07-09 09:24:07 +02:00
Jan Nieuwenhuizen 637c40aeb9 mescc: Avoid warnings in recursve functions.
* module/language/c99/compiler.mes (expr->accu): Avoid warnings in recursve functions.
2017-07-09 11:01:30 +02:00
Jan Nieuwenhuizen f8865ab276 mescc: undefine __GNUC__.
* module/language/c99/compiler.mes (c99-input->full-ast): Remove
  __GNUC__=0.  Should help compiling pcc, libguile/eval.c.
2017-07-09 09:26:04 +02:00
Jan Nieuwenhuizen ebb15c72a3 mescc: Support stdarg.
* mlibc/include/stdarg.h (va_list): New type.
  (va_start, va_arg, va_end, va_copy): New macro.
  (vprintf): New declaration.
* mlibc/libc-mes.c (vprintf): New function.
  (printf): Rewrite using vprintf.
* module/language/c99/compiler.mes (expr->accu, expr->accu*): Handle
  any array.  Limitation: element size must be 4/sizeof (expression).
  (make-type): Add value pointer to type.
  (type:type, type:size, type:pointer, type:description): New functions.
  (ast->info): Handle typedef with pointer.
2017-07-05 18:48:08 +02:00
Jan Nieuwenhuizen fa4fdad623 build: Remove make.
* GNUmakefile: trivial convenience-frontend to ./make.scm
* make/*.make: Remove.
* */*.make: Remove.
2017-07-02 12:03:29 +02:00
Jan Nieuwenhuizen 83a43b81b3 mescc: Produce M1 output instead of hex2.
Use: ./make.scm [TARGET]
     ./make.scm check

* stage0/x86.M1: New file.
* mlibc/mini-libc-mes.c (exit, write): Use M1 instead of .byte.
* mlibc/libc-mes.c (_start, exit, read, write, open, access, brk,
  fsync, printf): Use M1 instead of .byte.
* module/mes/as-i386.mes: Use M1.
* module/mes/make.scm: New file.
* make.scm: New file.
* guile/guix/records.scm: New File.
* guile/guix/shell-utils.scm: New file.
* module/mes/M1.mes: Rename from hex2.mes.
* module/mes/M1.scm: Rename from hex2.scm.
* scripts/mescc.mes: Update callers.
* guile/mescc.scm: Update callers.
2017-07-02 16:25:14 +02:00
Jan Nieuwenhuizen 03ecebd594 mescc: Add headers for guile:eval.c.
* mlibc/include/alloca.h: New file.
* mlibc/include/stdint.h: New file.
* mlibc/include/inttypes.h: Remove definitionss, include stdint.h.
2017-06-18 17:54:33 +02:00
Jan Nieuwenhuizen cf7211e8a7 mescc: Add headers for 8cc.
* mlibc/include/libgen.h: New file.
* mlibc/include/locale.hh: New file.
* mlibc/include/stdbool.h: New file.
* mlibc/include/stdnoreturn.h: New file.
* mlibc/include/time.h: Add time_t.
2017-06-18 16:12:15 +02:00
Jan Nieuwenhuizen e2fef673a2 guix: Add missing module.
* guix.scm: Use (guix download).  Fixes compilation with mescc-tools included.
2017-06-27 07:53:29 +02:00
Jan Nieuwenhuizen e4d188907d guix: Add mescc-tools.
* guix.scm (mescc-tools): New variable.  Fixes using guix.scm.  Thanks paroneayea!
2017-06-26 20:29:49 +02:00
Jan Nieuwenhuizen f92470a1f0 Release 0.8.
* configure (VERSION): Bump.
2017-06-25 18:36:25 +02:00
Jan Nieuwenhuizen bf4608ff94 build: Release update.
* configure (main): Make hex2 required.
* guix.scm (mes): Add mescc-tools to propagated-inputs.  Update commit, hash.
2017-06-25 17:40:38 +02:00
Jan Nieuwenhuizen 97951fd47e doc: Release update.
* NEWS: Update.
* INSTALL: Update.
* HACKING: Update.
* doc/ANNOUNCE-0.8: New file.
2017-06-08 20:39:24 +02:00
Jan Nieuwenhuizen c44df4ed8a mescc: Remove ELF creation, handled by hex2 now.
* module/language/c99/compiler.scm (make-global, global:type,
  global:pointer, global:value): Move from elf-util.mes
* module/mes/as.mes: New file.
* module/mes/as-i386.mes: Use it.
* module/mes/as-i386.scm: Use it.
* module/mes/elf-util.mes: Remove.
* module/mes/elf.mes (elf32-addr, elf32-half, elf32-off, elf32-word,
  make-elf, write-any, object->elf): Remove
  (hex2->elf): New function with dummy implementation.
* module/mes/elf.scm: Update exports.
* module/mes/hex2.mes (object->elf): New function.
* module/mes/hex2.scm: Export it.
2017-06-25 09:26:25 +02:00
Jan Nieuwenhuizen 1de0f33020 mescc: Produce object files in hex2 format, remove hex3.
* GNUmakefile (HEX2_FLAGS): New variable.
* make/mescc-guile.make ($(OUT)/$(TARGET)): Use HEX2 for linking.
* make/mescc-mes.make ($(OUT)/$(TARGET)): Likewise.
* guile/mescc.scm (main): Remove hex3 support.
* scripts/mescc.mes (main): Likewise.
* stage0/elf32-0header.hex2: New file, merging of elf32.hex and elf32-header.hex2.
* stage0/elf-0footer.hex2: New file.
* stage0/elf32-header.hex2: Rename from elf32-header-exit-42.hex2,
  repurpose as generic debug heder.
* stage0/elf32-footer-single-main.hex2: Rename from elf32-footer-exit-42.hex2,
  repurpose as generic debug footer for single-main source.
* stage0/exit-42.c: New file.
* stage0/stage0.make ($(OUT)/0exit-42): Test 0header, 0footer.
  ($(OUT)/exit-42.guile): Test generic debug header, footer.
* stage0/elf32.hex2: Remove.
2017-06-25 09:33:55 +02:00
Jan Nieuwenhuizen bb0f82d5aa build: Add stage0 hex2 test.
* configure (HEX2): Check for hex2 from MESCC_tools.
* INSTALL: Mention it.
* GNUmakefile (SUBDIRS): Add stage0.
* make/check-cc.make: New file.
* make/check.make: Remove CC-not-empty guard.
* scaffold/scaffold.make: Update CC check targets.
2017-06-23 20:18:09 +02:00
Jan Nieuwenhuizen afb5c207a9 stage0: Move to-be-generated part of body to footer.
* stage0/elf32-footer-exit-42.hex2: Add ELF_str, ELF_sym from body.
* stage0/elf32-body-exit-42.hex2: Remove ELF_str, ELF_sym.
2017-06-21 07:05:26 +02:00
Jan Nieuwenhuizen cfca4c5cc1 stage0: Leverage label>base in stage0 gdb header.
* stage0/elf32-header-exit-42.hex2: Replace calculated addresses with label>base.
* stage0/elf32-body-exit-42.hex2: Likewise.
2017-06-19 22:45:51 +02:00
Jan Nieuwenhuizen f63d278cec stage0: Move stage0's section-headers before text.
* stage0/elf32-header-exit-42.hex2: Add section-headers.
* stage0/elf32-body-exit-42.hex2: Update.
* stage0/elf32-footer-exit-42.hex2: Remove section-headers.
2017-06-19 09:52:27 +02:00
Jan Nieuwenhuizen 3b82abdfa5 stage0: Add stage0 hex2 gdb header and footer example.
* stage0/elf32-header-exit-42.hex2: New file.
* stage0/elf32-footer-exit-42.hex2: New file.
2017-06-18 21:06:27 +02:00
Jan Nieuwenhuizen 77dfdd44b7 mescc: Remove jump calculation, use labels: rename jumps.
* module/mes/as-i386.mes (i386:jump, i386:jump-byte-z, i386:jump-g,
  i386:jump-ge, i386:jump-nc, i386:jump-ncz, i386:jump-nz,
  i386:jump-z): Rename from i386:jump-label*.
* module/mes/as-i386.scm (mes): Update exports.
* module/language/c99/compiler.mes (ast->info): Update callers.
2017-06-13 20:31:03 +02:00
Jan Nieuwenhuizen 5bbcce7c67 mescc: Remove jump calculation, use labels: remove offset-jumps.
* module/mes/as-i386.mes (i386:XXjump, i386:Xjump, i386:Xjump-c,
  i386:Xjump-cz, i386:Xjump-g, i386:Xjump-ge, i386:Xjump-l,
  i386:Xjump-le, i386:Xjump-nc, i386:Xjump-ncz, i386:Xjump-ncz",
  i386:Xjump-nz, i386:Xjump-z, i386:jump, i386:jump-byte-nz,
  i386:jump-byte-z, i386:jump-c, i386:jump-cz, i386:jump-le,
  i386:jump-nc, i386:jump-ncz, i386:jump-nz, i386:jump-z,
  i386:test-jump-z): Remove.
* module/mes/as-i386.scm: Remove export.
2017-06-13 20:27:40 +02:00
Jan Nieuwenhuizen bdd80babb8 mescc: Remove jump calculation, use labels: cleanup.
* module/language/c99/compiler.mes (test->jump->info): Remove.
2017-06-12 20:58:49 +02:00
Jan Nieuwenhuizen 7d7126bf0d mescc: Remove jump calculation, use labels: switch.
* module/language/c99/compiler.mes (expr->accu): Refactor (switch ...).
  (clause->info): Refactor.
2017-06-13 20:20:38 +02:00
Jan Nieuwenhuizen 36e0219af3 mescc: Remove jump calculation, use labels: and, or.
* module/language/c99/compiler.mes (expr->accu): Refactor (and
  ...), (or ...).
2017-06-12 22:11:19 +02:00
Jan Nieuwenhuizen 0a94b499fa mescc: Remove jump calculation, use labels: if.
* module/language/c99/compiler.mes (ast->info): Refactor (if ...)
  using test-jump-label->info.
2017-06-12 20:11:37 +02:00
Jan Nieuwenhuizen 4e564c3ce3 mescc: Remove jump calculation, use labels: for.
* module/language/c99/compiler.mes (ast->info): Refactor (for ...)
  using test-jump-label->info.
2017-06-12 19:46:35 +02:00
Jan Nieuwenhuizen 0f19aba1a8 mescc: Remove jump calculation, use labels: do while.
* module/language/c99/compiler.mes (ast->info): Refactor (do-while
  ...)  using test-jump-label->info.
2017-06-12 19:00:24 +02:00
Jan Nieuwenhuizen 42ca62b075 mescc: Remove jump calculation, use labels: ?.
* module/language/c99/compiler.mes (ast->info): Refactor (cond-expr
  ...)  using test-jump-label->info.
2017-06-12 18:43:25 +02:00
Jan Nieuwenhuizen 44a97b03d9 mescc: Support continue in while.
* module/language/c99/compiler.mes (make): Add continue field.
  (.continue): New function.
  (clone): Support continue field.
  (ast->info): Support continue.
* scaffold/t.c (test): Test it.
2017-06-12 17:10:29 +02:00
Jan Nieuwenhuizen 9843f88d74 mescc: Remove jump calculation, use labels: while.
* module/language/c99/compiler.mes (ast->info): Refactor (while ...)
  using test-jump-label->info.
2017-06-12 21:06:12 +02:00
Jan Nieuwenhuizen 5bf3c92938 mescc: Remove jump calculation, use labels: prepare.
* module/language/c99/compiler.mes (test-jump-label->info): New
  function.
* module/mes/as-i386.mes (i386:jump-label-z,i386:jump-label-byte-z,
  i386:jump-label-g, i386:jump-label-ge,i386:jump-label-nz): New
  functions.
* module/mes/as-i386.scm: Export them.
2017-06-12 21:00:50 +02:00
Jan Nieuwenhuizen 7cce8c6090 mescc: Remove duplication of string globals.
* module/language/c99/compiler.mes (expr->global): Curry-in globals.
  Update callers.
  (initzer->global): Likewise.
2017-06-12 10:49:31 +02:00
Jan Nieuwenhuizen d46994f2fe mescc: Unify labels.
* module/language/c99/compiler.mes: Use (#:address label) (#local
  label) (#:relative label) thoughout.
* module/mes/elf-util.mes (add-s:-prefix, drop-s:-prefix): Remove.
  (function->text): Update.
* module/mes/hex2.mes (write-hex2): Update.
2017-06-11 18:05:56 +02:00
Jan Nieuwenhuizen 1263d6e278 mescc: Write object files in hex2 or hex3 format.
* stage0/elf32.hex2: New file.
* module/mes/hex2.mes: New file.
* module/mes/hex2.scm: New file.
* module/language/c99/compiler.mes: Eradicate object lamdas.
  (current-eval, dec-xhex, function:-object->text, object->elf,
  object->objects, merge-objects, alist-add): Remove.
* module/mes/elf.mes (object->elf): New function, move from compiler.mes.
* module/mes/elf.scm: Export it.
* guile/mescc.scm (parse-opts): Add -g.
  (main): Use it.
* scripts/mescc.mes: Likewise.
* scripts/mescc-guile.make (MESCC.scm, MESLD.scm): Add -g flag.
* scripts/mescc-mes.make (MESCC.mes, MESLD.mes): Likewise.
* scaffold/m.c: Add proper includes.
* scaffold/argv.c: New file.
* scaffold/hello.c: Simplify.
* scaffold/micro-mes.c: Add proper includes.
* scaffold/t.c: Add proper includes.
2017-06-11 13:11:40 +02:00
Jan Nieuwenhuizen 766cfeab9a core: %moduledir ends with /.
* make/install.make (MODULEDIR): Append /.
  (install): Remove /.
* src/mes.c (load_env, bload_env): Update.
2017-06-12 17:18:31 +02:00
Jan Nieuwenhuizen 4479540aed mescc: Put _start at top of mlibc.
* mlibc/libc-mes.c (_start): Move to top.
* mlibc/mini-libc-mes.c (_start): Likewise.
* module/mes/elf-util.mes (function-prefix): Update for _start == 0.
  (function-offset): Likewise.
2017-06-11 13:01:46 +02:00
Jan Nieuwenhuizen 01b4c0846b mes: Add list-index.
* module/srfi/srfi-1.scm (list-index): New function.
2017-06-11 14:45:01 +02:00
Jan Nieuwenhuizen 2c0f5c346c build: Bugfix add prepocess dependency on snarfing mes.
* src/src.make ($(OUT)/$(DIR)/mes.guile-E, $(OUT)/$(DIR)/mes.mes-E):
  Depend on mes snarfing.
2017-06-08 06:57:24 +02:00
Jan Nieuwenhuizen d148f78a5c test: Support for non-Guix[SD]: cater for missing CC/CC32 compilers.
* make/check.make: Skip if CC is not set.
* make/check-mlibc.make: New file.
* scaffold/scaffold.make: Use it for mlibc targets.
* tinycc/tinycc.make: Skip mlibc targets if CC32 not set.
2017-06-20 19:47:15 +02:00
Jan Nieuwenhuizen c1d91c722d mescc: Support for non-Guix[SD] builds.
* module/language/c99/compiler.mes (c99-input->full-ast): Cater for
  C_INCLUDE_PATH not set.  Fixes non-Guix[SD] builds.
2017-06-20 19:42:37 +02:00
Jan Nieuwenhuizen 19bed9b466 build: Support for non-Guix[SD]: make CC/CC32 optional in configure too.
* configure (optional): New global.
  (BUILD_TRIPLET): Use Guile value.
  (check-version): Add keyword argument #:optional.
  (main): Make CC optional (--with-courage).  Only check for stdio.h,
  limits.h if CC is found.
  Make CC32 check optional.
* scripts/scripts.make: Skip if CC is not set.
2017-06-20 19:42:33 +02:00
Jan Nieuwenhuizen 86b891ecb6 mescc: Bugfix for merging objects.
* mlibc/libc-mes.c (main): Declare.
* mlibc/mini-libc-mes.c (g_stdin): Define.
  (main): Declare.
* module/language/c99/compiler.mes (alist-add): Thinko.  Fixes merging
  objects when first declares function of next.
2017-06-05 11:42:15 +02:00
Jan Nieuwenhuizen 5267247991 guix hash: 0fvzr1ai2rmi46zdi5b2bdjb6s8ip78mkmsk02yxl46rajmp2pb1 2017-06-03 21:53:56 +02:00