aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/llvm/bindings.zig
AgeCommit message (Collapse)Author
2023-09-19LLVM: update backend to LLVM 17Andrew Kelley
* LLVMConstSelect is removed (see https://discourse.llvm.org/t/rfc-remove-most-constant-expressions/63179) * a couple functions use uint64_t instead of int now which means we no longer need `@intCast`. release/17.x branch, commit 8f4dd44097c9ae25dd203d5ac87f3b48f854bba8
2023-09-19update for LLVM 17 new target dataAndrew Kelley
New OSs: * UEFI * LiteOS New ABI: * OpenHOS Also update the LLD driver API wrappers.
2023-08-08llvm: finish converting globalsJacob Young
2023-08-08llvm: cleanup even more unused LLVM API bindingsJacob Young
2023-08-08llvm: finish converting instructionsJacob Young
2023-08-08llvm: finish converting intrinsicsJacob Young
2023-08-08llvm: convert vector reduction intrinsicsJacob Young
Scratch that thing I said about one pass. :)
2023-08-08llvm: finish converting attributes to use Builder and the C LLVM APIJacob Young
2023-08-08llvm: convert intrinsics to using `Builder`Jacob Young
2023-08-06Implement bitop intrinsics in new LLVM IR builderantlilja
* llvm.bitreverse * llvm.bswap * llvm.ctpop * llvm.ctlz * llvm.cttz
2023-08-06Implement fp intrinsics in new LLVM IR builderantlilja
Intrinsics implemented * llvm.ceil * llvm.cos * llvm.exp * llvm.exp2 * llvm.fabs * llvm.floor * llvm.log * llvm.log10 * llvm.log2 * llvm.round * llvm.sin * llvm.trunc * llvm.fma
2023-08-01llvm: fix data layout calculation for experimental llvm targetsJacob Young
Closes #16616
2023-07-28llvm: fix SysV C abi for structs smaller than two eightbytesJacob Young
Closes #16038 Closes #16288
2023-07-23llvm: convert global assemblyJacob Young
2023-07-23llvm: convert attributes and non-intrinsic callsJacob Young
2023-07-19llvm: convert most instructionsJacob Young
2023-07-19llvm: convert basic block creationJacob Young
2023-07-19llvm: cleanup management and implement more const functionsJacob Young
2023-07-19llvm: finish converting `lowerValue`Jacob Young
2023-07-19llvm: convert all calls to `constInt`Jacob Young
2023-07-19llvm: finish converting `lowerType`Jacob Young
2023-07-19llvm: compute data layout without help like a grownup compilerJacob Young
2023-07-19llvm: start tracking more things without relying on the llvm apiJacob Young
2023-06-24all: migrate code to new cast builtin syntaxmlugg
Most of this migration was performed automatically with `zig fmt`. There were a few exceptions which I had to manually fix: * `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten * `@truncate`'s fixup is incorrect for vectors * Test cases are not formatted, and their error locations change
2023-06-23llvm: fixup elem_count argument of ZigLLVMCreateDebugArrayType to be i64kcbanner
The signature is `getOrCreateSubrange(int64_t Lo, int64_t Count)`, so this updates the bindings to match. This fixes a crash in `lowerDebugTypeImpl` when analyzing slices that have a length of 2^32 or larger (up to `2^64 >> 3`, which still crashes, because above that the array size in bits overflows u64).
2023-06-19all: zig fmt and rename "@XToY" to "@YFromX"Eric Joldasov
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-04-21cbe: fix issues with atomic floatsJacob Young
Since the Zig language documentation claims support for `.Min` and `.Max` in `@atomicRmw` with floats, allow in Sema and implement for both the llvm and C backends.
2023-04-20Expose an option for producing 64-bit DWARF formatDavid Gonzalez Martin
This commit enables producing 64-bit DWARF format for Zig executables that are produced through the LLVM backend. This is achieved by exposing both command-line flags and CompileStep flags. The production of the 64-bit format only affects binaries that use the DWARF format and it is disabled on MacOS due to it being problematic. This commit, despite generating the interface for the Zig user to be able to tell the compile which format is wanted, is just implemented for the LLVM backend, so clang and the self-hosted backends will need this to be implemented in a future commit. This is an effort to work around #7962, since the emission of the 64-bit format automatically produces 64-bit relocations. Further investigation will be needed to make DWARF 32-bit format to emit bigger relocations when needed and not make the linker angry.
2023-04-20llvm: emit metadata for exported global variables (#15349)Tw
* llvm: emit metadata for global variable One use case is to genearte BTF information from global variable's metadata. Signed-off-by: Tw <weii.tan>
2023-04-05Merge remote-tracking branch 'origin/master' into llvm16Andrew Kelley
2023-03-30llvm: fix crashes when loading a struct fieldJacob Young
The result of buildStructGEP is not always a GEP (sorry), so we can't use getGEPResultElementType on it. Closes #14641
2023-03-17Merge remote-tracking branch 'origin/master' into llvm16Andrew Kelley
2023-03-17main: add debug option to dump unoptimized llvm irJacob Young
2023-01-26update CPU features to LLVM 16Andrew Kelley
2023-01-25update zig_llvm.cpp and zig_llvm.h to LLVM 16Andrew Kelley
2023-01-04Sema: implement AVR address spacesMaciej 'vesim' KuliƄski
Co-authored-by: Veikka Tuominen <git@vexu.eu>
2023-01-03add -fopt-bisect-limitGuillaume Wenzek
2022-12-27llvm: cleanup code no longer needed with opaque pointersJacob Young
When using llvm opaque pointers, typed pointers and pointer bitcasts are no longer needed. This also avoids needing packed struct layouts that are nested inside pointers, letting us avoid computing struct layouts in Sema that could cause unnecessary dependency loops.
2022-12-17implement defining C variadic functionsVeikka Tuominen
2022-11-20llvm: add attributes to the arguments of function pointer callsVeikka Tuominen
Closes #13605
2022-11-16llvm: implement arbitrary precision debug enumeratorsVeikka Tuominen
Closes #645
2022-10-12stage2: improve addrspace handlingRobin Voetter
This commit changes the way Zig is intended to deal with variable declaration for exotic targets. Where previously the idea was to enfore local/global variables to be placed into their respective address spaces, depending on the target, this is now fixed to the generic address space. To facilitate this for targets where local variables _must_ be generated into a specific address space (ex. amdgcn where locals must be generated into the private address space), the variable allocations (alloca) are generated into the right address space and then addrspace-casted back to the generic address space. While this could be less efficient in theory, LLVM will hopefull deal with figuring out the actual correct address space for a pointer for us. HIP seems to do the same thing in this regard. Global variables are handled in a similar way.
2022-09-21LLVM: remove purposeless const qualifiersAndrew Kelley
These const qualifiers on pointers to opaque types do not serve any purpose. If anything they are misleading since the underlying pointers very likely point to objects that are in fact mutated. This commit does not change any behavior.
2022-09-13properly annotate nullability of ZigLLVMCreateDebugForwardDeclTypeAndrew Kelley
This bug manifested as a segfault in stage1 when calling this function. The C++ code looks like this: ```c++ entry->llvm_di_type = ZigLLVMCreateDebugForwardDeclType(g->dbuilder, ZigLLVMTag_DW_structure_type(), full_name, import ? ZigLLVMFileToScope(import->data.structure.root_struct->di_file) : nullptr, import ? import->data.structure.root_struct->di_file : nullptr, line); ``` There is actually no problem here - what happened is that because cross-language LTO was enabled between zig and c++ code, and because Zig annotated the file parameter (3rd line) as being non-null, the C++ code assumed that parameter could not be null, and eagerly dereferenced `import->...`, causing a segfault, since it was null. I verified that this commit fixed the problem and I also verified this hypothesis by disabling LTO and noticing that it indeed avoided the problem.
2022-08-29Merge remote-tracking branch 'origin/master' into llvm15Andrew Kelley
2022-08-19LLVM: add DLL export attributeAndrew Kelley
This was present in stage1 but missing from self-hosted.
2022-08-10stage2 llvm: implement more C ABIVeikka Tuominen
2022-08-10LLVM: respect linksection for exported variablesAndrew Kelley
2022-08-01LLVM backends: work around poorly designed C APIAndrew Kelley
As part of the Opaque Pointers upgrade documentation, LLVM says that the function LLVMGetGEPSourceElementType() can be used to obtain element type information in lieu of LLVMGetElementType(), however, this function actually returns the struct type, not the field type. The GEP instruction does store the information we need, however, this is not exposed in the C API. It seems like they accidentally exposed the wrong field, because one would never need the struct type since one must already pass it directly to the GEP instruction, so one will always have it handy, whereas one will usually not have the field type handy.
2022-08-01stage2: LLVM lowering to opaque pointers APIAndrew Kelley