Description
After solving #16268 which is a prerequisite to this issue, this issue is to further reduce dependency on Clang by using Aro to compile .c files.
I suggest, at least at first, this happens by taking advantage of translate-c, and then passing the outputted .zig code through the full pipeline. I experimented a bit with upstreaming Aro in #10795 in which I attempted to lower C AST to AIR, and this was my conclusion:
I'm starting to wonder... should we perhaps lower to ZIR instead of AIR? The integration would be a lot less messy, and it's much more obvious how to parallelize it. One .c file would produce exactly one corresponding ZIR file. 🤔🤔🤔
So the two options I think are worth exploring:
- C code => Aro C AST => Translate C AST => zig source code
- From there, potentially give an additional lowering to Translate C AST:
- => zig source code
- => ZIR
Another possibility would be straight from Aro C AST to ZIR. There could be additional C-specific ZIR instructions added if necessary.