The second patch adjusts tokenizer and generator appropriately, and
also fixes some minor issues. From now on, the count of tokens matches
count of atomic routines, and calls platform-specific code instead of
calling usual functions. I'd like to keep this approach in order to
make the code a bit more flexible. This is not for speed but, rather,
for being able to tune per-platform code in the future. I'm totally
open for the discussion.
The third patch extends x86_64 code generator to generate code from
the binary buffers, not byte-by-byte, as with g() routine. This
functionality will be used in the ultimate patch, if it gets accepted.
The last patch is the implementation for x86_64. This patch is likely
a controversial one. I tried to make the code somewhat generic to
different argument sizes, at the same time making it look like a
function call. It's also caused by the fact that I checked the code
generated by gcc for cases when usual stdatomic routines are wrapped
into simple routines. I'm pretty sure a lot there can be improved;
perhaps many of you will find the approach to be unorthodox to some
degree. This is just the idea; I'm totally open for discussion.
This is my first journey into tcc code generation; please, don't be
too severe. :-)
P.S. If the implementation is acceptable, we might re-use or even
share the code from x86_64 in i386. That said, I'd rather like seeing
other registers on i386 (e.g. eax/edx/ecx, not edi/esi/edx).
Dmitry Selyutin (4):
stdatomic: atomic generator routines
stdatomic: refactor atomic parser and generator
x86_64: multibyte code emit
stdatomic: x86_64 implementation
arm-gen.c | 55 +++++++++
arm64-gen.c | 55 +++++++++
c67-gen.c | 55 +++++++++
i386-gen.c | 55 +++++++++
riscv64-gen.c | 56 +++++++++
tcc.h | 18 +++
tccgen.c | 137 +++++++++++----------
tcctok.h | 31 ++---
x86_64-gen.c | 323 ++++++++++++++++++++++++++++++++++++++++++++++++++
9 files changed, 704 insertions(+), 81 deletions(-)
--
2.30.0
_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel