qdbplang / qdbp

MIT License
51 stars 1 forks source link

Add guaranteed TCO #12

Open qdbplang opened 1 year ago

qdbplang commented 1 year ago

Currently, we compile with clang -O2. Unfortunately, while most(all?) of the time clang will optimize tail calls, it is not a guarantee. We should alter the produced LLVM IR to force TCO.

dghosef commented 1 year ago

One potential way is to do:

Something that will potentially simplify things is if we put everything into one file.

We should implement this with qdbp :)

dghosef commented 1 year ago

Mark all invoke fns as optnone and always inline

Insert inline asm as annotation. Mark all definitions as tailcc

Run tail call elimination pass and remove optnone annotations

dghosef commented 1 year ago

You can just tailcc mark all metbods and method calls. No need for inline asm