aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
AgeCommit message (Collapse)Author
2019-09-19fixups for `@splat`Andrew Kelley
* Fix codegen for splat - instead of giving vectors of length N to shufflevector for both of the operands, it gives vectors of length 1. The mask vector is the only one that needs N elements. * Separate Splat into SplatSrc and SplatGen; the `len` is not needed once it gets to codegen since it is redundant with the result type. * Refactor compile error for wrong vector element type so that the compile error message is not duplicated in zig source code * Improve implementation to correctly handle comptime values such as undefined and lazy values. * Improve compile error for bad vector element type to point to the correct place. * Delete dead code. * Modify behavior test to use an array cast instead of vector element indexing since I'm merging this splat commit out-of-order from Shawn's patch set.
2019-09-19`@splat`Shawn Landden
2019-09-19implement runtime `@byteSwap` and other fixupsAndrew Kelley
* update docs for `@byteSwap`. * fix hash & eql functions for ZigLLVMFnIdBswap not updated to include vector len. this was causing incorrect bswap function being called in unrelated code * fix `@byteSwap` behavior tests only testing comptime and not runtime operations * implement runtime `@byteSwap` * fix incorrect logic in ir_render_vector_to_array and ir_render_array_to_vector with regards to whether or not to bitcast * `@byteSwap` accepts an array operand which it will cast to vector * simplify `@byteSwap` semantic analysis code and various fixes
2019-09-18@byteSwap on vectorsShawn Landden
2019-09-18rework the implementationAndrew Kelley
* update documentation - move `@shuffle` to be sorted alphabetically - remove mention of LLVM - minor clarifications & rewording * introduce ir_resolve_vector_elem_type to avoid duplicate compile error message and duplicate vector element checking logic * rework ir_analyze_shuffle_vector to solve various issues * improve `@shuffle` to allow implicit cast of arrays * the shuffle tests weren't being run
2019-09-18stage1: add @shuffle() shufflevector supportShawn Landden
I change the semantics of the mask operand, to make it a little more flexible. There is no real danger in this because it is a compile-error if you do it the LLVM way (and there is an appropiate error to tell you this). v2: avoid problems with double-free
2019-09-18remove TODO regarding lazy valuesAndrew Kelley
The question was: > // TODO do we need lazy values on vector comparisons? Nope, in fact the existing code already was returning ErrorNotLazy for that particular type, and would already goto never_mind_just_calculate_it_normally. So the explicit check for ZigTypeIdVector is not needed. I appreciate the caution though.
2019-09-18stage1: proper return type on vector comparisonsShawn Landden
2019-09-18Fix array->vector and vector->array for many types. Allow vector of bool.Shawn Landden
Vectors do not have the same packing as arrays, and just bitcasting is not the correct way to convert them.
2019-09-17fix peer result location with typed parent, ...Andrew Kelley
...runtime condition, comptime prongs. closes #3244
2019-09-10Resolve lazy arguments passed to @compileLogLemonBoy
Closes #3193
2019-09-10Accept void argument for @cDefine valueLemonBoy
Closes #2612
2019-09-09Merge pull request #3200 from LemonBoy/eq-tagged-unionAndrew Kelley
Allow comparison between union tag and enum literal
2019-09-09fix bad LLVM IR when for target expr needs to be spilledAndrew Kelley
Also reduce the size of ZigVar in memory by making the name a `const char *` rather than a `Buf`.
2019-09-09Comptime folding of enum/union comparisonsLemonBoy
2019-09-09Allow comparison between union tag and enum literalLemonBoy
Closes #2810
2019-09-07fix suspensions inside for loops generating invalid LLVM IRAndrew Kelley
closes #3076
2019-09-07implement spills when expressions used across suspend pointsAndrew Kelley
closes #3077
2019-09-05implement `noasync` function callsAndrew Kelley
See #3157
2019-09-05Add compiler error when negating invalid typeTimon Kruiper
2019-09-05prefer result type casting to peer type resolutionAndrew Kelley
See #2749
2019-09-05Add compile error when shifting amount is not an int typeTimon Kruiper
2019-09-05Add Array support to @TypeJonathan Marler
2019-09-05stage1 enhance IR printMichael Dusan
- print fn name in pass1 - replace scalar with enum IrPass for clarity
2019-09-04Implicit cast from enum literal to optional enum and implicit cast to ↵Timon Kruiper
payload of error union
2019-09-04fixups and add documentation for `@Type`Andrew Kelley
2019-09-03Add @Type builtinJonathan Marler
2019-09-03error message and test for alignment of variables of zero-bit typesSahnvour
2019-09-03fix union field ptr ir instructionAndrew Kelley
2019-09-02omit prefix data for async functions sometimesAndrew Kelley
When `@frameSize` is never called, and `@asyncCall` on a runtime-known pointer is never used, no prefix data for async functions is needed. Related: #3160
2019-09-02fix recursive call of await @asyncCall with struct return typeAndrew Kelley
2019-09-02fix using @typeOf on a generic function callAndrew Kelley
2019-09-01fix `@typeOf` an async function call of generic fn with error union typeAndrew Kelley
2019-08-31stage1 enhance IR printMichael Dusan
- pass2 now prints missing instructions in a trailing fashion - instruction struct name added to print as column 2
2019-08-31improvements to `@asyncCall`Andrew Kelley
* `await @asyncCall` generates better code. See #3065 * `@asyncCall` works with a real `@Frame(func)` in addition to a byte slice. Closes #3072 * `@asyncCall` allows passing `{}` (a void value) as the result pointer, which uses the result location inside the frame. Closes #3068 * support `await @asyncCall` on a non-async function. This is in preparation for safe recursion (#1006).
2019-08-31`@typeOf` now guarantees no runtime side effectsAndrew Kelley
related: #1627
2019-08-30support recursive async and non-async functionsAndrew Kelley
which heap allocate their own frames related: #1006
2019-08-30align(@alignOf(T)) T does not force resolution of TAndrew Kelley
2019-08-30fix stage1 to build on macOS + xcode/clangMichael Dusan
2019-08-29fix regressionsAndrew Kelley
2019-08-29await does not force async if callee is blockingAndrew Kelley
closes #3067
2019-08-29avoid unnecessarily requiring alignment for array elem pointersAndrew Kelley
2019-08-29comparing against zero participates in lazy valuesAndrew Kelley
2019-08-29make `@sizeOf` lazyAndrew Kelley
2019-08-28implement lazy values for error union typesAndrew Kelley
closes #3129
2019-08-27support self-referential struct through a slice of optionalAndrew Kelley
by making optionals even more lazy closes #1805
2019-08-27fix not properly casting align valuesAndrew Kelley
and add check for alignment specified on enum fields
2019-08-27implement and test struct field explicit alignmentAndrew Kelley
2019-08-26fix regression in one of the doc examplesAndrew Kelley
2019-08-26fix more compile error regressionsAndrew Kelley