aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
AgeCommit message (Collapse)Author
2017-03-22unify main entry point regardless of whether linking libcAndrew Kelley
closes #248
2017-03-18lazy analysis of top level declarationsAndrew Kelley
previously, we had lazy analysis of top level declarations, but if a declaration was referenced within a compile-time if or switch statement, that would still add the top level declaration to the resolution queue. now we have a declref ir instruction, which is only resolved if we analyze the instruction. this takes into account comptime branching. closes #270
2017-03-16introduce new test syntaxAndrew Kelley
* remove setFnTest builtin * add test "name" { ... } syntax * remove --check-unused argument. functions are always lazy now.
2017-03-13add --each-lib-rpath option and corresponding config optionAndrew Kelley
This adds an rpath entry for each used dynamic library directory. This is necessary on some systems such as NixOS.
2017-03-13use lld instead of system linkerAndrew Kelley
2017-03-10codegen nullable void the same way as boolAndrew Kelley
See #104
2017-03-10add default value for macosx version min when compiling nativelyAndrew Kelley
closes #264
2017-03-10update to llvm 4.0Andrew Kelley
2017-02-27fix inability to write to global in some casesAndrew Kelley
before, when we initialized a variable by copying the initialization value, it made the internal const value references point to a duplicate value, resulting in a phony duplicate global value being updated instead of the real on. now the behavior is as expected. thanks to hoppetosse for pointing out this bug on IRC.
2017-02-24add compile error for ignoring return valueAndrew Kelley
also introduce the _ identifier which you can assign to to discard a return value closes #219
2017-02-22fix regression with bit fields that align properlyAndrew Kelley
2017-02-22bitfields support for array of non-store-aligned packed structsAndrew Kelley
2017-02-16pointers with bit offset contain lengthAndrew Kelley
adds compile error when passing pointer that is byte-aligned at the beginning but not the end to a function expecting a fully byte aligned pointer closes #261
2017-02-16ability to write to bit fieldsAndrew Kelley
See #261
2017-02-16support arithmetic for non byte aligned integer typesAndrew Kelley
see #261
2017-02-16reading from a bit field partially worksAndrew Kelley
See #261 Still need to do: * reading a field that has bit offset 0 but still needs to shift and truncate * writing a field
2017-02-16move int and array types to central tableAndrew Kelley
2017-02-15ability to declare const bitfieldsAndrew Kelley
See #261
2017-02-14add runtime debug safety for dividing integer min value by -1Andrew Kelley
closes #260
2017-02-12slice and array re-work plus some misc. changesAndrew Kelley
* `@truncate` builtin allows casting to the same size integer. It also performs two's complement casting between signed and unsigned integers. * The idiomatic way to convert between bytes and numbers is now `mem.readInt` and `mem.writeInt` instead of an unsafe cast. It works at compile time, is safer, and looks cleaner. * Implicitly casting an array to a slice is allowed only if the slice is const. * Constant pointer values know if their memory is from a compile- time constant value or a compile-time variable. * Cast from [N]u8 to []T no longer allowed, but [N]u8 to []const T still allowed. * Fix inability to pass a mutable pointer to comptime variable at compile-time to a function and have the function modify the memory pointed to by the pointer. * Add the `comptime T: type` parameter back to mem.eql. Prevents accidentally creating instantiations for arrays.
2017-02-11rework compile-time known pointer valuesAndrew Kelley
See #257
2017-02-09remove the depends_on_compile_var codeAndrew Kelley
cleanup from the decision in commit 8a859afd580f438f549ee69a to remove "unnecessary if statement" error
2017-02-09lots of miscellaneous things all in one big commitAndrew Kelley
* add `@compileLog(...)` builtin function - Helps debug code running at compile time - See #240 * fix crash when there is an error on the start value of a slice * add implicit cast from int and float types to int and float literals if the value is known at compile time * make array concatenation work with slices in addition to arrays and c string literals * fix compile error message for something not having field access * fix crash when `@setDebugSafety()` was called from a function being evaluated at compile-time * fix compile-time evaluation of overflow math builtins. * avoid debug safety panic handler in builtin.o and compiler_rt.o since we use no debug safety in these modules anyway * add compiler_rt functions for division on ARM - Closes #254 * move default panic handler to std.debug so users can call it manually * std.io.printf supports a width in the format specifier
2017-02-07variables, memcpy, and memset all get alignmentAndrew Kelley
See #37
2017-02-06coldcc works betterAndrew Kelley
* Only use Cold Calling Convention on x86 * Add the cold attribute to functions marked with coldcc
2017-02-06improved behavior on debug safety crashAndrew Kelley
* instead of emitting a breakpoint for a debug safety crash, zig calls a panic function which prints an error message and a stack trace and then calls abort. * on freestanding OS, this panic function has a default implementation of a simple infinite loop. * users can override the panic implementation by providing `pub fn panic(message: []const u8) -> unreachable { }` * workaround for LLVM segfaulting when you try to use cold calling convention on ARM. closes #245
2017-02-05fix volatile not respected for loadsAndrew Kelley
2017-02-05all functions are nounwind because zig does not support exceptionsAndrew Kelley
2017-02-05`%=` in inline assembly survives optimizationAndrew Kelley
2017-02-05setGlobalSection and setGlobalAlign work for functionsAndrew Kelley
2017-02-05even external functions which provide definitions get nounwindAndrew Kelley
2017-02-04inline assembly supports `%=` syntaxAndrew Kelley
it outputs a number that is unique to each instance of the asm statement in the entire compilation. useful when creating local labels and referring to them multiple times in a single template that generates multiple assembler instructions
2017-02-04memcpy and memset builtins support volatile pointersAndrew Kelley
See #238
2017-02-04remove volatileStore builtin; add volatile pointersAndrew Kelley
closes #238
2017-02-04ability to set global variable alignment and ...Andrew Kelley
..section in the initialization expression
2017-02-03preserve names of exported variablesAndrew Kelley
2017-02-03add volatileStore() builtin functionAndrew Kelley
See #238 We can revisit how volatile will work later - for now here's a builtin function to do it.
2017-02-03add setGlobalAlign and setGlobalSection builtin functionsAndrew Kelley
closes #241
2017-02-03add ability to set linker scriptAndrew Kelley
2017-02-03typedefs work for binary math operationsAndrew Kelley
2017-02-03exported global variables get emitted as external in LLVMAndrew Kelley
2017-02-02update outdated commentAndrew Kelley
2017-02-02prefix op maybe and error are for types onlyAndrew Kelley
2017-01-31fix crash when passing void to var args functionAndrew Kelley
closes #235
2017-01-24printf var args proof of conceptAndrew Kelley
See #167 Need to troubleshoot when we send 2 slices to printf. It goes into an infinite loop. This commit introduces 4 builtin functions: * `@isInteger` * `@isFloat` * `@canImplictCast` * `@typeName`
2017-01-23basic support for functions with variable length argumentsAndrew Kelley
See #77
2017-01-22remove staticEval builtin in favor of comptime expressionAndrew Kelley
2017-01-22introduce comptime expressionAndrew Kelley
closes #221
2017-01-16get rid of zeroes literalAndrew Kelley
closes #222
2017-01-16fix handling of const values for 2d arraysAndrew Kelley