tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] [PATCH] stdatomic: ld/st/xchg/cmpxchg on simple types


From: grischka
Subject: Re: [Tinycc-devel] [PATCH] stdatomic: ld/st/xchg/cmpxchg on simple types
Date: Sat, 20 Mar 2021 12:05:51 +0100
User-agent: Thunderbird 2.0.0.23 (Windows/20090812)

Dmitry Selyutin wrote:
    Actually, why don't you try to use just the normal tcc function parser?

    It knows how to type-check arguments, it knows how to assign the correct
    return type, it knows how to call functions according to ABI conventions
    on Linux and Windows as well, and it knows how to pass small structs in
    registers.


Can this be apted to case where we dynamically determine the type of the
function to be called, and when the same function can be called with
actually different (though binary compatible) arguments? I haven't find
the code which fits my needs; if there's one, I'm OK with adopting it.

I would suggest mutual adoption of the needs with what exists and
with what you can actually handle (easily).

Probably something basic could be made up even without any changes
to TCC itself:

    #define atomic_load(o) \
        (typeof(*o)) __atomic_load_impl(o, sizeof *o, __ATOMIC_SEQ_CST)

    long long __atomic_load_impl(void *o, int s, int mm)
    {
        switch (s) {
        case 1: ...
        case 2: ...
        case 4: ...
        case 8: ...

--- grischka



reply via email to

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