Skip to content

Add GCC backend using libgccjit #22812

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed

Conversation

BreadTom
Copy link

@BreadTom BreadTom commented Feb 8, 2025

GCC has a JIT C API which allows Zig to compile to GCC using gcc_jit_context_compile_to_file().

Once Zig no longer depends on LLVM, this can be merged.

I do not know how to make zig link with libgccjit.

  • Link Zig with libgccjit
  • Convert most Air.Inst.Ref to gcc_jit_type
  • Convert most Air.Inst.Tag to expressions
  • Generate function like llvm.FuncGen

@alexrp
Copy link
Member

alexrp commented Feb 8, 2025

Setting aside that this is a non-starter due to the GPL, this would just be replacing one set of problems with another. The end goal is for Zig to not link to any third-party compiler infrastructure library.

@BreadTom
Copy link
Author

BreadTom commented Feb 8, 2025

Setting aside that this is a non-starter due to the GPL, this would just be replacing one set of problems with another. The end goal is for Zig to not link to any third-party compiler infrastructure library.

Forgot about the GPL licensing in the header. Going to close this pull request.

@BreadTom BreadTom closed this Feb 8, 2025
@andrewrk
Copy link
Member

andrewrk commented Feb 8, 2025

If GCC has a stable IR, equivalent to LLVM .bc files, then a gcc backend can be considered

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants