Skip to content

When the compiler is built without LLVM, use Aro to compile C code instead of Clang #16269

Closed as not planned
@andrewrk

Description

@andrewrk

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:

  1. C code => Aro C AST => Translate C AST => zig source code
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementSolving this issue will likely involve adding new logic or components to the codebase.proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.zig ccZig as a drop-in C compiler feature

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions