by Pannoniae · 2w ago · 0 comments
But I mean more like
- being able to explicitly tell to unroll this loop N times
- native support for builtin SIMD vector types (it can use platform-dependent instructions, whatever)
- specifying aliasing manually, built-in support for range types
- having explicit control over switch statement code generation
- good metaprogramming (doesn't matter if compile-time maths doesn't exactly match runtime behaviour), compile-time code generation/modification
- [[likely]] hints but actually respected i.e. having a guaranteed effect on code layout
- of course no headers, the unit of compilation being a whole library
I don't think it really needs to be single-pass in order to be fast, just cut out most of the heuristic-based optimisations from the backend and make them explicit keywords/attributes in the code...
What you are describing is what Zig spent years to try to become while running away from LLVM. Sure thing there are other less popular attempts which I can't even bother to list here, not because they are somehow worse, but because they are even further away from gamedev practice that I care about.
I don't know what the economy of generated code would be. It is up for debate right now.
What I can definitely see now is that human-only code made this way is not going to pay off. It can only be an expense for someone who has unlimited budget to spend on a whim.