aboutsummaryrefslogtreecommitdiff
path: root/src/ir_print.cpp
AgeCommit message (Collapse)Author
2019-05-30no-copy semantics for basic runtime function call variable initAndrew Kelley
```zig export fn entry() void { var x: Foo = foo(); } ``` ```llvm define void @entry() #2 !dbg !37 { Entry: %x = alloca %Foo, align 4 call fastcc void @foo(%Foo* sret %x), !dbg !48 call void @llvm.dbg.declare(metadata %Foo* %x, metadata !41, metadata !DIExpression()), !dbg !49 ret void, !dbg !50 } ```
2019-05-28no "use of undeclared identifer" in dead comptime branchesAndrew Kelley
2019-05-26introduce @hasDecl builtin functionAndrew Kelley
closes #1439
2019-05-24Implement @unionInitRobert Scott
2019-05-19Fix too eager comptime evaluation of error ptrLemonBoy
2019-05-16breaking changes to all bit manipulation intrinsicsShawn Landden
* `@clz`, `@ctz`, `@popCount`, `@bswap`, `@bitreverse` now have a type parameter * rename @bitreverse to @bitReverse * rename @bswap to @byteSwap Closes #2119 Closes #2120
2019-05-14switching on error sets makes new error set for capture valuesAndrew Kelley
closes #769
2019-05-14else value when switching on error set hasAndrew Kelley
optional capture value which is subset. see #769
2019-05-08C pointers support .? operatorAndrew Kelley
see #1967
2019-05-06stage1: add @hasField() built-inShawn Landden
This was quite straight-forward Closes: #1439
2019-04-06fixed 1726Jimmi Holst Christensen
2019-03-20add docs for assembly and fix global assembly parsingAndrew Kelley
Previously, global assembly was parsed expecting it to have the template syntax. However global assembly has no inputs, outputs, or clobbers, and thus does not have template syntax. This is now fixed. This commit also adds a compile error for using volatile on global assembly, since it is meaningless. closes #1515
2019-03-15breaking changes to std.mem.Allocator interface APIAndrew Kelley
Before, allocator implementations had to provide `allocFn`, `reallocFn`, and `freeFn`. Now, they must provide only `reallocFn` and `shrinkFn`. Reallocating from a zero length slice is allocation, and shrinking to a zero length slice is freeing. When the new memory size is less than or equal to the previous allocation size, `reallocFn` now has the option to return `error.OutOfMemory` to indicate that the allocator would not be able to take advantage of the new size. For more details see #1306. This commit closes #1306. This commit paves the way to solving #2009. This commit also introduces a memory leak to all coroutines. There is an issue where a coroutine calls the function and it frees its own stack frame, but then the return value of `shrinkFn` is a slice, which is implemented as an sret struct. Writing to the return pointer causes invalid memory write. We could work around it by having a global helper function which has a void return type and calling that instead. But instead this hack will suffice until I rework coroutines to be non-allocating. Basically coroutines are not supported right now until they are reworked as in #1194.
2019-02-22fix `@bitCast` when src/dest types have mismatched handle_is_ptrAndrew Kelley
* separate BitCast and BitCastGen instructions * closes #991 * closes #1934 * unrelated: fix typo in docs (thanks gamester for pointing it out)
2019-02-21better handling of arrays in packed structsAndrew Kelley
* Separate LoadPtr IR instructions into pass1 and pass2 variants. * Define `type_size_bits` for extern structs to be the same as their `@sizeOf(T) * 8` and allow them in packed structs. * More helpful error messages when trying to use types in packed structs that are not allowed. * Support arrays in packed structs even when they are not byte-aligned. * Add compile error for using arrays in packed structs when the padding bits would be problematic. This is necessary since we do not have packed arrays. closes #677
2019-02-21`@sliceToBytes` works at comptimeAndrew Kelley
closes #262
2019-02-07fix using the result of @intCast to u0Andrew Kelley
closes #1817
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-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-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-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-11-16Fixed #1663 and removed IrInstructionArrayLenJimmi Holst Christensen
2018-10-26remove @minValue,@maxValue; add std.math.minInt,maxIntAndrew Kelley
closes #1466 closes #1476
2018-09-26the last number in a packed ptr is host int bytesAndrew Kelley
See #1121
2018-09-07builtin functions: @byteOffsetOf and @bitOffsetOfraulgrell
2018-09-04add compile error for comptime control flow inside runtime blockAndrew Kelley
closes #834
2018-08-02src/ir_print.cpp: support `@handle()`;kristopher tate
Tracking Issue #1296 ;
2018-07-26add compile error for ignoring return value of while loop bodiesAndrew Kelley
closes #1049
2018-07-11ir: refactor lvaluesAndrew Kelley
2018-07-07add @popCount intrinsicAndrew Kelley
2018-06-19remove enum to/from int casting syntax; add `@enumToInt`/`@intToEnum`Andrew Kelley
see #1061
2018-06-18remove []u8 casting syntax. add `@bytesToSlice` and `@sliceToBytes`Andrew Kelley
See #1061
2018-06-18remove error set casting syntax. add `@errSetCast`Andrew Kelley
See #1061
2018-06-18remove bool to int syntax. add @boolToIntAndrew Kelley
add missing docs See #1061
2018-06-17remove integer and float casting syntaxAndrew Kelley
* add `@intCast` * add `@floatCast` * add `@floatToInt` * add `@intToFloat` See #1061
2018-06-09breaking syntax change: ??x to x.? (#1095)Andrew Kelley
See #1023 This also renames Nullable/Maybe to Optional
2018-06-07remove @canImplicitCast builtinAndrew Kelley
nobody will miss it
2018-05-31use * for pointer type instead of &Andrew Kelley
See #770 To help automatically translate code, see the zig-fmt-pointer-reform-2 branch. This will convert all & into *. Due to the syntax ambiguity (which is why we are making this change), even address-of & will turn into *, so you'll have to manually fix thes instances. You will be guaranteed to get compile errors for them - expected 'type', found 'foo'
2018-04-24One step towards @typeInfoAlexandros Naskos
2018-04-19Optimized field ptr ir for hot path and fix assignment bugJimmi Holst Christensen
2018-04-19Added field builtin functionJimmi Holst Christensen
2018-04-15add @atomicLoad builtinAndrew Kelley
See #174
2018-04-15add @sqrt built-in functionAndrew Kelley
See #767
2018-04-08error return traces work with async return caseAndrew Kelley
2018-04-08put the error return addresses in the coro frameAndrew Kelley
2018-04-08error return traces for the early return caseAndrew Kelley
it would work but LLVM is not correctly spilling the addresses. See #821
2018-03-24add promise->T syntax parsingAndrew Kelley
closes #857
2018-03-24fix async fns with inferred error setsAndrew Kelley
closes #856
2018-03-24move error ret tracing codegen to zig irAndrew Kelley
progress towards #821