aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
AgeCommit message (Collapse)Author
2019-02-04SIMD: array to vector, vector to array, wrapping int addAndrew Kelley
also vectors and arrays now use the same ConstExprVal representation See #903
2019-02-02Fix slice concatenationMatthew McAllister
This was causing an underflow error
2019-02-01Fix runtime assignment to comptime aggregate fieldMatthew McAllister
This was causing a segfault
2019-02-01add compile errror for @bitCast when bit counts mismatchAndrew Kelley
fixes invalid LLVM IR from previous commit
2019-01-30introduce vector type for SIMDAndrew Kelley
See #903 * create with `@Vector(len, ElemType)` * only wrapping addition is implemented This feature is far from complete; this is only the beginning.
2019-01-29backport copy elision changesAndrew Kelley
This commit contains everything from the copy-elision-2 branch that does not have to do with copy elision directly, but is generally useful for master branch. * All const values know their parents, when applicable, not just structs and unions. * Null pointers in const values are represented explicitly, rather than as a HardCodedAddr value of 0. * Rename "maybe" to "optional" in various code locations. * Separate DeclVarSrc and DeclVarGen * Separate PtrCastSrc and PtrCastGen * Separate CmpxchgSrc and CmpxchgGen * Represent optional error set as an integer, using the 0 value. In a const value, it uses nullptr. * Introduce type_has_one_possible_value and use it where applicable. * Fix debug builds not setting memory to 0xaa when storing undefined. * Separate the type of a variable from the const value of a variable. * Use copy_const_val where appropriate. * Rearrange structs to pack data more efficiently. * Move test/cases/* to test/behavior/* * Use `std.debug.assertOrPanic` in behavior tests instead of `std.debug.assert`. * Fix outdated slice syntax in docs.
2019-01-29simpler implementation of `&&` and `||` hintsAndrew Kelley
This accomplishes the same goal, but with less changes, so that I can backport copy elision stuff easier.
2019-01-25Hint at use of and/or when &&/|| is improperly used (#1886)kristopher tate
2019-01-09when rendering llvm const values, ensure the types alignAndrew Kelley
the representation of the const expr val in zig, and the type that we tell LLVM it is.
2019-01-08`@typeInfo`: more correct return type infoAndrew Kelley
2019-01-06Removed oops commentsJimmi HC
2019-01-06Fixed issue where TypeInfo would use types from a prev CodeGen instanceJimmi HC
When doing multible codegen passes (such as building compiler_rt and then something else) the TypeInfo cache code would point to types from the prev code gen (such as the prev 'bool' type), giving us errors like "expected type 'bool', but found type 'bool'" This disabling of caching might have a performance hit, but correctness is better than speed, so let's have this for now, until someone optimizes this correctly (probably in stage2)
2019-01-06Implemented buf_read_value_bytes for ZigTypeIdArrayJimmi HC
* Only for x_array.special == ConstArraySpecialNone
2019-01-06Respect the type system instead of ConstExprValue when getting fieldJimmi HC
2019-01-04Mark comptime int hardcoded address pointee as a run time variable #1171 (#1868)vegecode
* Mark comptime int hardcoded address as a run time variable #1171 * test case for dereferencing hardcoded address intToPtr
2019-01-02@bitreverse intrinsic, part of #767 (#1865)vegecode
* bitreverse - give bswap behavior * bitreverse, comptime_ints, negative values still not working? * bitreverse working for negative comptime ints * Finished bitreverse test cases * Undo exporting a bigint function. @bitreverse test name includes ampersand * added docs entry for @bitreverse
2018-12-26Switching on bools with duplicate and missing value detection: Issue 1768alexander
2018-12-22comptime: ability to @ptrCast to an extern struct and read fieldsAndrew Kelley
2018-12-19Fixed intToPtr to fn type when the address is hardcoded (#1842)Jimmi Holst Christensen
* Fixed intToPtr to fn type * Added test * Import inttoptr.zig in behavior.zig
2018-12-18ir: delete dead codeAndrew Kelley
2018-12-17fix comptime pointer reinterpretation array index offsetAndrew Kelley
closes #1835
2018-12-16implement comptime pointer castAndrew Kelley
closes #955 closes #1835
2018-12-12breaking API changes to all readInt/writeInt functions & moreAndrew Kelley
* add `@bswap` builtin function. See #767 * comptime evaluation facilities are improved to be able to handle a `@ptrCast` with a backing array. * `@truncate` allows "truncating" a u0 value to any integer type, and the result is always comptime known to be `0`. * when specifying pointer alignment in a type expression, the alignment value of pointers which do not have addresses at runtime is ignored, and always has the default/ABI alignment * threw in a fix to freebsd/x86_64.zig to update syntax from language changes * some improvements are pending #863 closes #638 closes #1733 std lib API changes * io.InStream().readIntNe renamed to readIntNative * io.InStream().readIntLe renamed to readIntLittle * io.InStream().readIntBe renamed to readIntBig * introduced io.InStream().readIntForeign * io.InStream().readInt has parameter order changed * io.InStream().readVarInt has parameter order changed * io.InStream().writeIntNe renamed to writeIntNative * introduced io.InStream().writeIntForeign * io.InStream().writeIntLe renamed to writeIntLittle * io.InStream().writeIntBe renamed to writeIntBig * io.InStream().writeInt has parameter order changed * mem.readInt has different parameters and semantics * introduced mem.readIntNative * introduced mem.readIntForeign * mem.readIntBE renamed to mem.readIntBig and different API * mem.readIntLE renamed to mem.readIntLittle and different API * introduced mem.readIntSliceNative * introduced mem.readIntSliceForeign * introduced mem.readIntSliceLittle * introduced mem.readIntSliceBig * introduced mem.readIntSlice * mem.writeInt has different parameters and semantics * introduced mem.writeIntNative * introduced mem.writeIntForeign * mem.writeIntBE renamed to mem.readIntBig and different semantics * mem.writeIntLE renamed to mem.readIntLittle and different semantics * introduced mem.writeIntSliceForeign * introduced mem.writeIntSliceNative * introduced mem.writeIntSliceBig * introduced mem.writeIntSliceLittle * introduced mem.writeIntSlice * removed mem.endianSwapIfLe * removed mem.endianSwapIfBe * removed mem.endianSwapIf * added mem.littleToNative * added mem.bigToNative * added mem.toNative * added mem.nativeTo * added mem.nativeToLittle * added mem.nativeToBig
2018-12-05implement compile error note for function parameter type mismatchAndrew Kelley
2018-11-24refactor type_requires_comptime to have possible errorAndrew Kelley
fixes a compiler crash when building https://github.com/AndreaOrru/zen
2018-11-19Crash fixes and small improvements to inline asm. (#1756)Sahnvour
* codegen: LLVMConstInlineAsm is deprecated. * codegen: replace commas in asm constraint strings by pipes as required by LLVM. * ir: enforce usage of '=' constraint modifier for inline assembly outputs. Others are not currently supported and this was just asserted alter in `ir_render_asm`. * asm: forbid comptime_int/floats as inputs in favor of explicitely sized constants. Fixes a crash due to comptime_int/floats having no type_ref. * asm: handle inputs with integers of <8 or non power of 2 bitsize. We widen them to the next highest power of two.
2018-11-19improve error message when wrong type returnedAndrew Kelley
closes #1650
2018-11-18fix assertion failure related to @intToEnumAndrew Kelley
2018-11-18all numbers with comptime known values implicitly castAndrew Kelley
to all number types. If the value does not fit, a compile error is emitted. closes #422 closes #1712
2018-11-16Fixed #1663 and removed IrInstructionArrayLenJimmi Holst Christensen
2018-11-14** and ++ operators force comptime on operandsAndrew Kelley
closes #1707
2018-11-13New Zig formal grammar (#1685)Jimmi Holst Christensen
Reverted #1628 and changed the grammar+parser of the language to not allow certain expr where types are expected
2018-11-11ir: remove redundant casting codeAndrew Kelley
2018-11-09array type syntax implies comptimeAndrew Kelley
2018-11-06limit integer types to maximum bit width of 65535Andrew Kelley
closes #1541
2018-10-31simplify logic of pass1 ir for while on error unionsAndrew Kelley
2018-10-30remove implicit cast from number literal to enumAndrew Kelley
I missed this code when removing explicit cast syntax.
2018-10-29remove another implicit cast to const pointerAndrew Kelley
* remove implicit cast from *T to ?*const T * remove implicit cast from T to ?*const T when T is a struct/union
2018-10-26remove @minValue,@maxValue; add std.math.minInt,maxIntAndrew Kelley
closes #1466 closes #1476
2018-10-25remove 3 more implicit casts to const pointersAndrew Kelley
see #1465
2018-10-15remove implicit cast from T to *const TAndrew Kelley
closes #1465
2018-10-15Solve the return type ambiguity (#1628)Jimmi Holst Christensen
Changed container and initializer syntax * <container> { ... } -> <container> . { ... } * <exrp> { ... } -> <expr> . { ...}
2018-10-04fix missing .h filesAndrew Kelley
closes #1634
2018-10-04refactor ir.cppAndrew Kelley
Analysis functions no longer return `ZigType *`. Instead they return `IrInstruction *`.
2018-09-26fix crash when compile error evaluating return...Andrew Kelley
...type of inferred error set. closes #1591
2018-09-26the last number in a packed ptr is host int bytesAndrew Kelley
See #1121
2018-09-26fix implicit casting to *c_voidAndrew Kelley
closes #1588 also some small std lib changes regarding posix sockets and one doc typo fix
2018-09-25fix crash on runtime index into slice of comptime typeAndrew Kelley
closes #1435
2018-09-22fix @compileLog having unintended side effectsAndrew Kelley
closes #1459
2018-09-22add compile error for slice of undefined sliceAndrew Kelley
closes #1293