aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
AgeCommit message (Collapse)Author
2018-12-18ir: delete dead codeAndrew Kelley
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-26stage1: better file path handlingAndrew Kelley
* better message printed when cache hash fails * better handling of '/' as root source file * os_path_split parses '/' and '/a' correctly closes #1693 closes #1746
2018-11-24refactor type_requires_comptime to have possible errorAndrew Kelley
fixes a compiler crash when building https://github.com/AndreaOrru/zen
2018-11-24fix @intCast not catching negative numbers to unsignedAndrew Kelley
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-16Fixed #1663 and removed IrInstructionArrayLenJimmi Holst Christensen
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-06limit integer types to maximum bit width of 65535Andrew Kelley
closes #1541
2018-10-26remove @minValue,@maxValue; add std.math.minInt,maxIntAndrew Kelley
closes #1466 closes #1476
2018-10-15Solve the return type ambiguity (#1628)Jimmi Holst Christensen
Changed container and initializer syntax * <container> { ... } -> <container> . { ... } * <exrp> { ... } -> <expr> . { ...}
2018-10-09more efficient builtin library code generationAndrew Kelley
* introduce --disable-pic option which can generally be allowed to be the default. compiler_rt.a and builtin.a get this option when you build a static executable. * compiler_rt and builtin libraries are not built for build-lib --static * posix_spawn instead of fork/execv * disable the error limit on LLD. Fixes the blank lines printed
2018-10-09support building static librariesAndrew Kelley
closes #1493 closes #54
2018-10-04refactor ir.cppAndrew Kelley
Analysis functions no longer return `ZigType *`. Instead they return `IrInstruction *`.
2018-09-30Fixes --emit asm on windows and makes C header file generation explicit. (#1612)Sahnvour
* build: only do codegen_link when emitting an actual binary. Fixes #1371 * build: only output C header file when explicitely asked to
2018-09-27add dll export storage class where appropriateAndrew Kelley
closes #1443
2018-09-26the last number in a packed ptr is host int bytesAndrew Kelley
See #1121
2018-09-21Merge branch 'BitByteOffsetOfs' of https://github.com/raulgrell/zig into ↵Andrew Kelley
raulgrell-BitByteOffsetOfs
2018-09-20better string literal caching implementationAndrew Kelley
We were caching the ConstExprValue of string literals, which works if you can never modify ConstExprValues. This premise is broken with `comptime var ...`. So I implemented an optimization in ConstExprValue arrays, where it stores a `Buf *` directly rather than an array of ConstExprValues for the elements, and then similar to array of undefined, it is expanded into the canonical form when necessary. However many operations can happen directly on the `Buf *`, which is faster. Furthermore, before a ConstExprValue array is expanded into canonical form, it removes itself from the string literal cache. This fixes the issue, because before an array element is modified it would have to be expanded. closes #1076
2018-09-18Merge remote-tracking branch 'origin/master' into llvm7Andrew Kelley
2018-09-17fix codegen for @intCast to u0Andrew Kelley
2018-09-16Merge remote-tracking branch 'origin/master' into llvm7Andrew Kelley
2018-09-14fix alignment of structsAndrew Kelley
closes #1248 closes #1052 closes #1154
2018-09-14fix tagged union with all void payloads but meaningful tagAndrew Kelley
closes #1322
2018-09-13fix assertion failure on compile-time `@intToPtr` of functionAndrew Kelley
2018-09-13remove `this`. add `@This()`.Andrew Kelley
closes #1283
2018-09-13remove the scope parameter of setFloatModeAndrew Kelley
also document that scopes inherit this value. See #367 See #1283
2018-09-13stage1: put test output artifact back in zig-cache folderAndrew Kelley
close #1508
2018-09-11rename --enable-timing-info to -ftime-report to match clangAndrew Kelley
and have it print llvm's internal timing info
2018-09-11bring back zig-cacheAndrew Kelley
we need somewhere to put .o files and leave them while the user executes their program, so that stack traces on MacOS can find the .o files and get at the DWARF info. if we try to clean up old global tmp dir files, first of all that's a hard and complicated problem, and secondly it's not clear how that is better than dumping the .o file inside zig-cache locally.
2018-09-11stage1: clean up timing report in test modeAndrew Kelley
2018-09-11fix docgen testsAndrew Kelley
2018-09-11Merge remote-tracking branch 'origin/master' into stage1-cachingAndrew Kelley
2018-09-11fix incorrect error union const value generationAndrew Kelley
closes #1442 zig needed to insert explicit padding into this structure before it got bitcasted.
2018-09-11fix incorrect union const value generationAndrew Kelley
closes #1381 The union was generated as a 3 byte struct when it needed to be 4 bytes so that the packed struct bitcast could work correctly. Now it recognizes this situation and adds padding bytes to become the correct size so that it can fit into an array.
2018-09-11ability to disable cache. off by default except for...Andrew Kelley
...zig run, zig build, compiler_rt.a, and builtin.a
2018-09-10stage1 caching: zig no longer uses zig-cacheAndrew Kelley
2018-09-10caching is workingAndrew Kelley
* add almost all the input parameter state to the hash - missing items are the detected MSVC installation on Windows and detected libc installation on POSIX - also missing are C files and .h files that libclang finds * artifacts are created in global cache directory instead of zig-cache. - exception: builtin.zig is still in zig-cache * zig run uses the new cache correctly * zig run uses execv on posix systems
2018-09-10Merge remote-tracking branch 'origin/master' into llvm7Andrew Kelley
2018-09-10stage1: always optimize blake and softfloat even in debug modeAndrew Kelley
2018-09-09basic compiler id hash workingAndrew Kelley
2018-09-07C ABI: support returning large structs on x86_64Andrew Kelley
also panic instead of emitting bad code for returning small structs See #1481
2018-09-07C ABI: support medium size structs & unions for x86_64 paramsAndrew Kelley
See #1481
2018-09-07stage1: function to classify x86_64 abi typesAndrew Kelley
2018-09-07builtin functions: @byteOffsetOf and @bitOffsetOfraulgrell
2018-09-07add C ABI test for big unionsAndrew Kelley
2018-09-07stage1: refactor variable inits to use c abi fn walkAndrew Kelley
2018-09-07stage1: refactor param vars for C ABIAndrew Kelley
2018-09-07stage1: refactor fn type analysis to use C ABI walk fnAndrew Kelley
2018-09-07stage1: c abi for big struct worksAndrew Kelley