aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
AgeCommit message (Collapse)Author
2023-06-10stage2: start the InternPool transitionAndrew Kelley
Instead of doing everything at once which is a hopelessly large task, this introduces a piecemeal transition that can be done in small increments at a time. This is a minimal changeset that keeps the compiler compiling. It only uses the InternPool for a small set of types. Behavior tests are not passing. Air.Inst.Ref and Zir.Inst.Ref are separated into different enums but compile-time verified to have the same fields in the same order. The large set of changes is mainly to deal with the fact that most Type and Value methods now require a Module to be passed in, so that the InternPool object can be accessed.
2023-06-06llvm: stop generating FPU code if there is no FPUDavid Gonzalez Martin
Fixes https://github.com/ziglang/zig/issues/14465 For aarch64, LLVM was crashing because Zig commands it to generate FPU code even when there is no FPU present. This commit implements the necessary checks to avoid this undesired situation and aarch64 can be compiled again with no FPU.
2023-05-30spirv: eliminate remaining uses of emitConstantRobin Voetter
2023-05-30spirv: rename TypeConstantCache -> CacheRobin Voetter
2023-05-30spirv: translate remaining typesRobin Voetter
2023-05-30spirv: translate remaining typesRobin Voetter
2023-05-30spirv: cache strings for debug namesRobin Voetter
2023-05-30spirv: translate structs to cache keyRobin Voetter
2023-05-30spirv: translate vectors to cache keyRobin Voetter
2023-05-30spirv: cache pointersRobin Voetter
2023-05-30spirv: cache function prototypesRobin Voetter
2023-05-30spirv: cache for intsRobin Voetter
2023-05-30spirv: cache for floatsRobin Voetter
2023-05-30spirv: basic setup for using new type constant cacheRobin Voetter
2023-05-30spirv: TypeConstantCacheRobin Voetter
2023-05-26std.Target adjustmentsVeikka Tuominen
* move `ptrBitWidth` from Arch to Target since it needs to know about the abi * double isn't always 8 bits * AVR uses 1-byte alignment for everything in GCC
2023-05-25llvm: fix vector type in vector_store_elemVeikka Tuominen
Closes #15848
2023-05-23std.sort: add pdqsort and heapsortAli Chraghi
2023-05-23Merge pull request #15235 from Vexu/safetyVeikka Tuominen
add runtime safety for noreturn function returning
2023-05-22llvm: also generate metadata for extern global variablesTw
Signed-off-by: Tw <tw19881113@gmail.com>
2023-05-20Merge pull request #15753 from Snektron/spirv-more-testsAndrew Kelley
spirv: make more tests pass
2023-05-20spirv: make constant handle float, errorset, errorunionRobin Voetter
This is in preparation of removing indirect lowering again. Also modifies constant() to accept a repr so that both direct as well as indirect representations can be generated. Indirect is not yet used, but will be used for globals.
2023-05-20spirv: don't generate union tag type if it doesnt existRobin Voetter
Previously the tag type was generated even if it was nonexistant, triggering an assertion that an integer type should never have zero bits. Now its only generated when the tag type is actually emitted.
2023-05-20spirv: ptr_elem_valRobin Voetter
Implements the ptr_elem_val air tag. Implementation is unified with ptr_elem_ptr.
2023-05-20spirv: ptr_subRobin Voetter
Implments the ptr_sub air tag. The code is unified with that of ptr_add.
2023-05-20spirv: pointer bitcastingRobin Voetter
2023-05-20spirv: lower integer pointer constantsRobin Voetter
2023-05-20spirv: ptr_addRobin Voetter
Implements the ptr_add air tag for spirv. The implementation for slices is probably wrong, but there seems to be no test for this...
2023-05-20spirv: use extractField moreRobin Voetter
reduce some code duplication
2023-05-20spirv: fix some (Ptr)AccessChain usesRobin Voetter
The first dereference of PtrAccessChain returns a pointer of the same type as the base pointer, in contrast to AccessChain, where the first dereference returns a pointer of the dereferenced type of the base pointer.
2023-05-20spirv: dont use OpIAddCarryRobin Voetter
This instruction is not really working well in the LLVM SPIRV translator, as it is not implemented. This commit also intruces the constructStruct helper function to initialize structs at runtime. This is ALSO buggy in the translator, and we must work around OpCompositeConstruct not working when some of the constituents are runtime-known only. Some other improvements are made: - improved variable() so that it is more useful and no longer requires the address space. It always puts values in the Function address space, and returns a pointer to the Generic address space - adds a boolToInt utility function
2023-05-20spirv: use intInfo instead of arithmeticTypeInfo in airIntCastRobin Voetter
This ensures that we can also cast enums and error sets here. In the future this function will need to be changed to support composite and strange integers, but that is fine.
2023-05-20spirv: implement pointer comparison in for air cmpRobin Voetter
It turns out that the Khronos LLVM SPIRV translator does not support OpPtrEqual. Therefore, this instruction is emitted using a series of conversions. This commit breaks intToEnum, because enum was removed from the arithmetic type info. The enum should be converted to an int before this function is called.
2023-05-20spirv: lower get_union_tagAli Chraghi
2023-05-16add runtime safety for noreturn function returningVeikka Tuominen
Closes #15221
2023-05-15spirv: lower ptrtoint & ignore dbg_inline instructionsAli Chraghi
2023-05-15spirv: implement arithmeticTypeInfo for Enum (`@intToEnum`)Ali Chraghi
2023-05-15spirv: lower float_to_int and int_to_floatAli Chraghi
2023-05-12Merge pull request #15240 from Snektron/spirv-basicAndrew Kelley
spirv: attempting to get the 'basic' behavior tests running
2023-05-12Optimize access of array member in a structure.shwqf
2023-05-11spirv: lower store_safe, trunc and trapAli Chraghi
2023-05-11spirv: make decl deps a hash map instead of an arraylistRobin Voetter
The same declaration can be added to the dependency set multiple times, and in this case we still need to emit it once. By making this list a hash map instead, we can do that quite easily. This commit also introduces some additional debug logging regarding decls.
2023-05-11spirv: lower wrap_optionalRobin Voetter
This implements the wrap_optional AIR instruction.
2023-05-11spirv: lower air optional_payloadRobin Voetter
Implements lowering the AIR tag optional_payload. Also fixes an issue with lowering constant ints.
2023-05-11spirv: lower air is_null, is_non_nullRobin Voetter
Implements AIR lowering for is_null and is_non_null tags. Additionally this cleans up and centralizes the logic to convert from 'direct' representation to 'indirect' representation and vice-versa. The related functions, as well as the functions that use it, are all moved near eachother so that the conversion logic remains in a central place. Extracting/inserting fields and loading/storing pointers should go through these functions.
2023-05-11spirv: fix invalid code generated by br-with-valueRobin Voetter
The result-id and result-type-id of the OpPhi used to merge the break values was not properly emitted, as some of the operands were not written out. This caused an invalid spir-v module.
2023-05-11spirv: lower air wrap_errunion_errRobin Voetter
2023-05-11spirv: lower air unwrap_error_union_errRobin Voetter
2023-05-11spirv: lower air tryRobin Voetter
Implements code generation for the try air tag. This commit also adds a utility `errorUnionLayout` function that helps keeping the layout of a spir-v error union consistent.
2023-05-11spirv: fix OpFunctionCall parameters interleaving with instsRobin Voetter
resolve() is now able to emit instructions. If usage of this function is interleaved with calls to emitRaw() and writeOperand(), then an instruction may get inserted between operands, causing an invalid module. The solution here is to just perform a temporary allocation.