r/Compilers • u/rootkid1920 • Oct 22 '26
Advices for young compiler engineers
Hi everyone, I am quite new to work as a compiler engineer, but I am quite confident with my day to day loop (find optimization opportunities or fixing any broken stuff). Most of my work is on the backend (and also most of my knowledge).
However, sometimes I am lacking of intresting ideas to implement, I also (almost) never touch LLVM middle end, yet.
Often times, I am in the "now what ?" situation. I would love to know how to keep improving and get better at compiler engineering.
Thanks.
51
Upvotes
10
u/recursion_is_love Oct 22 '26
What about getting into FPGA and write your own CPU for using as a target?
6
u/hexed Oct 23 '26
Reinvent the wheel a bit to understand it: look at the tests for LICM and try to re-implement it perhaps. It'll give you firsthand knowledge of dealing with the relevant APIs and interfaces, and you'll run head-first into the numerous difficulties involved, considerations to be tracked, etc. Getting experience dealing with these things will guide your thinking when designing solutions in the future.
(People get physically fitter through exercise, often involving in running in circles and not going anywhere. The same is true of mental work).
4
u/Schoens Oct 24 '26
My advice is simple: actually use the compiler/toolchain, identify pain points, and then focus on solving those pains. You will better understand users of the compiler and their needs (and thus avoid wasting time on things that don't serve those needs); you will get more familiar with the compiler toolchain end-to-end, and especially how to diagnose issues (or identify missing tools/diagnostics that would be useful to help diagnose issues you are encountering); and lastly, it's more rewarding to implement a feature or improvement and then be able to see the benefits of that change.
If you don't use the tool you are building, you will always perpetually feel that lack of direction - because you don't really understand what it is you are building.
If for some reason you can't meaningfully use the compiler you are working on, then sit down with a user or two that are interested in helping you solve their pain points - at the very least it will help you identify issues with documentation or whatever that are causing them to "hold it wrong", but more likely is that you will uncover a variety of gaps that you can use as motivation.
If you are interested in a particular area of compiler engineering, or feel you are lacking skills there (or both), but there isn't work to be done in that area on your particular compiler project, then you have two options:
To sum up: if you want to be good at something, you have to do a lot of it; if you want to understand something, you have to get your hands dirty with it. Find and solve real problems, and you'll never run out of stuff to do.
3
u/mark-sed Oct 23 '26
You could pickup some open tasks/issues in llvm upstream from the parts which interest you and try working on them.
2
u/lalbahadursastri1996 Oct 23 '26
Commenting so i would also learn.
2
u/MitchAlsup Oct 24 '26
The very first thing you should do is to READ all of the SOURCE CODE--several times--until you can draw a call-graph of large sections of the compiler-phase. You won't understand it, but it provides the knomenclature the rest of the compiler uses and the structures the compiler uses to organize its activities.
1
u/dreamingforward Oct 26 '26
Make a front-end that will compile to any language if a BNF for the language is specified. There aren't that many semantic constructs, I'd presume, that differ between languages (perhaps the biggest is C++ vs. C), so you only have to implement the semantic forms....
1
u/GunpowderGuy Oct 26 '26
Try using idris2. Has a lovely system for building new backends.
1
u/Business-Weather-217 Oct 27 '26
Same here. Writing interpreters and compilers are one of the hardest topics in programming. What i have wrote didnt pass a dead simple shell interpreter, a brainfuck compiler and a DSL.
1
u/machine-education 26d ago
The front-end stuff is boring, and only updated with new versions of a programming language or for bug fixes.
The middle-end is where the fun stuff is, and where the better compiler designers work.
The back-end is somewhat boring, since the instrution set architecture (ISA) is typically fixed and there is only so much room for performance improvement.
Domain-specific compilers is where the money is at.
1
u/ZookeepergameOk5975 22d ago
commenting to learn
-6
u/lagoatech Oct 22 '26
Perhaps avoiding compilers at all and writting common lisp to generate machine instructions directly and then a mini kernel optimizing.
No python (specially), no C, no Rust no clunky toolchain.