From 79610f324861f32fff88ac34c97e6bc5a7f3bda8 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Fri, 13 May 2022 10:57:30 +0200 Subject: fixed main documentation --- miniany/README.html | 58 +++--- miniany/README.txt | 580 ++++++++++++++++++++++++++++++++++++++++++++++++++++ miniany/cc.wg | 72 ++++--- 3 files changed, 652 insertions(+), 58 deletions(-) create mode 100644 miniany/README.txt diff --git a/miniany/README.html b/miniany/README.html index a736885..ab8a828 100644 --- a/miniany/README.html +++ b/miniany/README.html @@ -73,8 +73,8 @@ cat c4.c4 EOF c4.c EOF cc.c EOF hello.c | ./c4
  • required features from the operating system: for instance the requirement for a POSIX layer
  • ugliness of the resulting code: it doesn't make sense to omit features which are somewhat hard to implement but can render readability of the code much better: best examples are the switch/case vs. if/else and the funny array indexing vs. structures in C4.
  • -

    So we collect some ideas here about features we add or do not add and why. We also collect here what their implications are, when we are implementing them.

    -

    We also have to be careful what C4 can do for us and either add it there (but only if small enough) in order no to loose this test case.

    +

    So we collect some ideas here about features we add or do not add and why. We also collect here the implications when we are implementing them.

    +

    We also have to be careful what C4 can do for us and either add it there (but only if small enough) in order not to loose this test case.

    Preprocessor for modularisation

    Implementation status: no

    Reasoning:

    @@ -90,6 +90,7 @@ cat c4.c4 EOF c4.c EOF cc.c EOF hello.c | ./c4

    Preprocessor for conditional compilation

    Implementation status: no

    @@ -144,8 +145,8 @@ cat c4.c4 EOF c4.c EOF cc.c EOF hello.c | ./c4

    Some general notes:

    GNU inline asm statement has become the de-facto standard (which is too complicated IMHO): I would require sort of a .byte 0xXX instruction only, for readablility maybe simple fasm-like syntax. We must be careful that our invention of an inline assembler can be mapped somehow to the GNU inline asm version, so that we can use that one on the host with gcc/clang/tcc/pcc..

    c.c in swieros (the c4 successor) has asm(NOP), this is something we could implement easily. u.h contains an enum with opcodes (most likely doable or an easy architecture like the one in swieros, I doubt this works for Intel opcodes, but we should check if it works for our simplified Intel opcode subset).

    -

    There should though be only one single point of information for opcodes per architecture, so asm gets sort of an inline string generator for the assembly output. Or we share a common C-file with enums for the opcodes and cat it to both the assembler and the compiler during the build (should not result in increaed code size, as those are enums).

    -

    The asm(x) or asm(x,y) constructs can be mapped on the host compilers to asm __volatile__ .byte ugliness. In cc and c4 we can take the swieros approach. This should give us nice lowlevel inline assembly in a really simplified way (basically embedding bytes).

    +

    There should though be only one single point of information for opcodes per architecture, so asm gets sort of an inline string generator for the assembly output. Or we share a common C-file with enums for the opcodes and cat it to both the assembler and the compiler during the build (should not result in increaed code size, as those are enums).

    +

    The asm(x) or asm(x,y) constructs can be mapped on the host compilers to asm __volatile__ .byte ugliness. In cc and c4 we can take the swieros approach. This should give us nice lowlevel inline assembly in a really simplified way (basically embedding bytes).

    Not having inline assembly means you need compilation units written and linked to the program in assembly, which - well - adds a linker and calling conventions, which might be too early in bootstrapping.

    Object formats and linkers

    Implementation status: no

    @@ -158,7 +159,7 @@ cat c4.c4 EOF c4.c EOF cc.c EOF hello.c | ./c4
  • make compilation units from a bunch of source code, this results in bigger binaries, as we cannot share too much. This might be acceptable for early bootstrapping. Later on it would be nice to add a linker as an optional addon (which can be used outside of bootstrapping).
  • Forward declarations of function prototypes

    -

    Implementation status: yes (TODO)

    +

    Implementation status: yes

    Reasoning: