RealNeGate / Cuik

A Modern C11 compiler (STILL EARLY)
MIT License
656 stars 32 forks source link

Tilde Requests #14

Open gingerBill opened 1 year ago

gingerBill commented 1 year ago

I will add to this as I go along when I see things which may be missing.

API

Instructions

"Intrinsics"

IR Debugging

Debug Information

Questions

RealNeGate commented 1 year ago

For the questions, currently tb_inst_set_region_name does not require unique names but it will bite you once i make the flattened IR form if you reuse the same name.

If you wanna know the previous "instructions" to a region, you can check the inputs list and it'll tell you all the predecessors, you can do tb_get_parent_region(region->inputs[i]) if you want the top of that predecessor, but the actual inputs[i] is almost always a projection (TB_PROJ) stemming from a branch, you can reach the branch with another ->inputs[0].

RealNeGate commented 1 year ago

image

There we go, linearized IR printing. It uses the TB_FuncOpt which is usually is preserved for optimizations but i might rename it because it's really just for analysis/transformations and flattening the IR is a form of analysis.

gingerBill commented 1 year ago

Feature Request:

ngortheone commented 1 month ago

@gingerBill @RealNeGate I have a crazy off-topic idea/question for you guys. Odin is "done". So why not write a C compiler(or at least compiler backend) in Odin?

I imagine Odin will provide great productivity gains and correctness as well.

(I am currently playing with Odin and I love it, and I heard that GB wants to replace LLVM with Tilde)