Repository navigation
Closed
Labels
backend-llvmThe LLVM backend outputs an LLVM IR Module.contributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.enhancementSolving this issue will likely involve adding new logic or components to the codebase.frontendTokenization, parsing, AstGen, Sema, and Liveness.
Milestone
Description
Relevant source locations:
Lines 416 to 431 in ab7ea53
| // Make a decision on whether to use LLVM or our own backend. | |
| const use_llvm = if (options.use_llvm) |explicit| explicit else blk: { | |
| // If we have no zig code to compile, no need for LLVM. | |
| if (options.root_pkg == null) | |
| break :blk false; | |
| // If we are the stage1 compiler, we depend on the stage1 c++ llvm backend | |
| // to compile zig code. | |
| if (build_options.is_stage1) | |
| break :blk true; | |
| // We would want to prefer LLVM for release builds when it is available, however | |
| // we don't have an LLVM backend yet :) | |
| // We would also want to prefer LLVM for architectures that we don't have self-hosted support for too. | |
| break :blk false; | |
| }; |
Here we will want to add link.File.LLVM, alongside ELF, WASM, Macho, COFF, etc.
Lines 152 to 164 in ab7ea53
| pub fn openPath(allocator: *Allocator, options: Options) !*File { | |
| const use_stage1 = build_options.is_stage1 and options.use_llvm; | |
| if (use_stage1 or options.emit == null) { | |
| return switch (options.object_format) { | |
| .coff, .pe => &(try Coff.createEmpty(allocator, options)).base, | |
| .elf => &(try Elf.createEmpty(allocator, options)).base, | |
| .macho => &(try MachO.createEmpty(allocator, options)).base, | |
| .wasm => &(try Wasm.createEmpty(allocator, options)).base, | |
| .c => unreachable, // Reported error earlier. | |
| .hex => return error.HexObjectFormatUnimplemented, | |
| .raw => return error.RawObjectFormatUnimplemented, | |
| }; | |
| } |
Metadata
Metadata
Assignees
Labels
backend-llvmThe LLVM backend outputs an LLVM IR Module.contributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.enhancementSolving this issue will likely involve adding new logic or components to the codebase.frontendTokenization, parsing, AstGen, Sema, and Liveness.
Activity
andrewrk commentedon Dec 29, 2020
This was done by @FireFox317, landed in 2df2f00. Follow-up issues with the LLVM backend will be separate issues.