[Top][All Lists]

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

Re: [Tinycc-devel] Resources/questions for porting?

From: Daniel Glöckner
Subject: Re: [Tinycc-devel] Resources/questions for porting?
Date: Tue, 26 Sep 2017 05:36:01 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

Forgive me the brevity of my reply, but I should be asleep right now.

On Mon, Sep 25, 2017 at 09:16:12PM -0400, Charles Lohr wrote:
> To do this, I need to port TCC to xtensa specifically lx6 with no floating
> point.

It won't be easy to support floating point without floating point
registers. TinyCC is not prepared to keep floating point values in
integer registers. And you will need a soft float library like libgcc
that probably can't be built with TinyCC unless you also implement an

> (1) How does one get involved in coding for the core of TinyCC?

Usually by submitting patches.

> (2) I could use a C-to-JS compiler for this project.  If I did succeed and
> it worked well, would you consider it for inclusion considering emscripten
> is a bloated mess.

If you write it anyway, you might as well ask for inclusion.

We keep these C67 and IL backends around, even though I have never
heard of anyone using them.

> (3) If I do get this xtensa output working, would there be interest for
> inclusion in mainline?

I'd say yes.

> (4) Is there a better community (chat/discord/etc.) for discussing tinyCC?

No, this is the best place.

> (5) Currently, I am working by pulling from the repo.or.cz and pusing to my
> git branch.  Is this a reasonable thing to do before I am ready to try to
> get into mob?

Yes, it is.
Please post the patches to the mailing list first.
People pushing controverse patches to the mob branch has caused bad
blood on the mailing list several times in the past.

> (6) An in-depth discussion of what all goes into the -gen and -link files?
> I think I've got it mostly figured out with the definitions in
> xxx-[link|gen].c in tcc.h.

I don't believe there is any documentation.
When I wrote the ARM backend, I tried to mimic what the i386 code did.

> (7) Register assignments.  When I write my prolog and see code generation
> requests, they seem to do some very dumb things almost assuming I have zero
> registers. I don't understand how the management is supposed to work. It
> feels rather muttled.  I saw register assignment help in the ARM port, but,
> it felt integrally tied into TCC in ways that are difficult to mirror for
> xtensa.

TinyCC forgets what is inside the registers as soon as it has emitted
the code for a statement. There is no optimization across statements
(which simplifies creating test cases for bugs btw.).

> (8) Rationales behind emitting code directly from the -gen, -link.  I.e.
> Has anyone ever done a video or presentation on the big WHY.  It feels VERY
> different from other compilers in that it seems almost directly geared away
> from having multiple steps.  Which, is fast.  But... may be suboptimal?

It was done to have a small compiler.
TinyCC was born as an IOCCC submission.

> (9) Anything that discusses how optimization really goes on.  Or is TCC's
> approach always "you write slow C code, you get slow C code."

It is mostly like that.
There is a litte optimization inside expressions and someone once wrote
code to not emit dead if/else branches (Did that code get merged?), but
that's all that comes to mind right now.

Best regards,


reply via email to

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