tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] [PATCH 0/4] stdatomic: code generators


From: grischka
Subject: Re: [Tinycc-devel] [PATCH 0/4] stdatomic: code generators
Date: Mon, 15 Feb 2021 08:11:12 +0100
User-agent: Thunderbird 2.0.0.23 (Windows/20090812)

Dmitry Selyutin wrote:
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.

Why not just provide functions as a library and wrap them into
macros from stdatomic.h?  No or almost no changes to tcc's generator
would be needed.

The point is to reuse as much as possible from what exists and not
to do everything slightly different.

In the best case patches add features by removing lines.  Maybe you
have some interesting ideas that can make tcc's generators smaller
and still support atomic inline.

--- grischka


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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]