aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
AgeCommit message (Collapse)Author
2019-12-03fix `zig builtin`Andrew Kelley
2019-12-03WinMainCRTStartup implies defaulting to console subsystemAndrew Kelley
2019-12-03activate start code when pub main existsAndrew Kelley
and rename LinkType->LinkMode, OutType->OutputMode
2019-12-03correct caching and add test for missing fn nameVexu
2019-12-03move more startup code to std libVexu
2019-12-02Accept comptime-known expression for asmLemonBoy
2019-12-01inline ConstGlobalRefs into ZigValueAndrew Kelley
Having ConstGlobalRefs be a pointer in ZigValue was a hack that caused plenty of bugs. It was used to work around difficulties in type coercing array values into slices. However, after #3787 is merged, array values no longer type coerce into slices, and so this provided an opportunity to clean up the code. This has the nice effect of reducing stage1 peak RAM usage during the std lib tests from 3.443 GiB to 3.405 GiB (saving 39 MiB). There is one behavior test failing in this branch, which I plan to debug after merging #3787.
2019-11-30Merge pull request #3284 from Sahnvour/export_variablesAndrew Kelley
Improved support for exporting variables
2019-11-25stage1: consolodate interningMichael Dusan
- merge const_void_val → intern.x_void - move const_zero_byte → intern.zero_byte - wrap intern access
2019-11-25const interning for 1-possible-value typesMichael Dusan
2019-11-25unembed ZigValue from IrInstructionMichael Dusan
2019-11-25rename ConstExprValue → ZigValueMichael Dusan
2019-11-24Merge remote-tracking branch 'origin/master' into null-terminated-pointersAndrew Kelley
2019-11-24gen-h: register the need for stdbool.h and stdint.h when exploring types ↵Sahnvour
recursively otherwise they wouldn't be included when only a struct contains them
2019-11-24gen-h: add a pass for exported variablesSahnvour
2019-11-24refactored gen_h_file to improve maintainability and outputSahnvour
- extracted functions - factorised extern "C" into a block containing all function prototypes instead of writing macros all over the place - using intermediate buffers instead of writing directly to the output file
2019-11-24all tests passingAndrew Kelley
2019-11-23update the stage1 implementation to the new proposalAndrew Kelley
See #3731
2019-11-21improve broken llvm module error messageVexu
2019-11-21string literals are now null terminatedAndrew Kelley
this also deletes C string literals from the language, and then makes the std lib changes and compiler changes necessary to get the behavior tests and std lib tests passing again.
2019-11-21add null terminated pointers and arrays to self-hostedAndrew Kelley
as well as `@typeInfo` and `@Type`
2019-11-14Update discriminant value also for zero-sized unionsLemonBoy
Fixes #3681
2019-11-14rework layout of struct type fieldsAndrew Kelley
This removes the remaining hack in the implementation of anonymous struct literals, and they can now therefore now have greater than 16 fields/elements.
2019-11-14rework comptime struct value layout, removing 1/2 hacksAndrew Kelley
in the implementation of anonymous struct literals
2019-11-13Merge pull request #3675 from Vexu/atomic-storeAndrew Kelley
Add @atomicStore builtin
2019-11-12fix anonymous struct literal assigned to variableAndrew Kelley
closes #3667
2019-11-12fn parameters participate in result location semanticsAndrew Kelley
See #3665
2019-11-13add @atomicStore builtinVexu
2019-11-11fix unresolved type making it to codegenAndrew Kelley
found this trying to build oxid
2019-11-08introduce `@as` builtin for type coercionAndrew Kelley
This commit also hooks up type coercion (previously called implicit casting) into the result location mechanism, and additionally hooks up variable declarations, maintaining the property that: var a: T = b; is semantically equivalent to: var a = @as(T, b); See #1757
2019-11-07correctly use llvm undef in release modesShawn Landden
2019-11-07Fix ptrCast of array references to fnLemonBoy
Closes #3607
2019-11-05implement storing vector elements via runtime indexAndrew Kelley
2019-11-05implement loading vector elements via runtime indexAndrew Kelley
2019-11-05implement store of vector element with comptime indexAndrew Kelley
2019-11-05runtime load vector element with comptime indexAndrew Kelley
2019-10-28detect async fn recursion and emit compile errorAndrew Kelley
2019-10-28synchronize the target features for compiling C codeAndrew Kelley
d91fc0fdd8f42dc8c38347e1a0ec87fd583c1d3d changed zig's behavior to disable the SSE feature when cross compiling for i386-freestanding. This commit does the same when compiling C Code.
2019-10-26Don't use SSE on freestandingNoam Preil
2019-10-26Don't save/restore stack on newStackCall to noreturn functionNoam Preil
2019-10-26Translate-c: Fix a segfault when to many errors are emittedTimon Kruiper
This was already fixed when doing `@cImport`, but not yet when running `zig translate-c`.
2019-10-25stage1: fix compile error on macOS Xcode 11.2Michael Dusan
src/codegen.cpp:7713:33: error: unused variable 'global_linkage_values' [-Werror,-Wunused-const-variable] static const GlobalLinkageValue global_linkage_values[] = {
2019-10-24avoid passing -march=native when not supportedAndrew Kelley
Clang does not support -march=native for all targets. Arguably it should always work, but in reality it gives: error: the clang compiler does not support '-march=native' If we move CPU detection logic into Zig itelf, we will not need this, instead we will always pass target features and CPU configuration explicitly. For now, we simply avoid passing the flag when it is known to not be supported.
2019-10-24implement partial C ABI support for aarch64Andrew Kelley
2019-10-23move types from builtin to stdAndrew Kelley
* All the data types from `@import("builtin")` are moved to `@import("std").builtin`. The target-related types are moved to `std.Target`. This allows the data types to have methods, such as `std.Target.current.isDarwin()`. * `std.os.windows.subsystem` is moved to `std.Target.current.subsystem`. * Remove the concept of the panic package from the compiler implementation. Instead, `std.builtin.panic` is always the panic function. It checks for `@hasDecl(@import("root"), "panic")`, or else provides a default implementation. This is an important step for multibuilds (#3028). Without this change, the types inside the builtin namespace look like different types, when trying to merge builds with different target settings. With this change, Zig can figure out that, e.g., `std.builtin.Os` (the enum type) from one compilation and `std.builtin.Os` from another compilation are the same type, even if the target OS value differs.
2019-10-22implement safety for resuming non-suspended functionAndrew Kelley
closes #3469
2019-10-22integrate stage1 progress display with semantic analysisAndrew Kelley
2019-10-19Fix crash when generating constant unions with single fieldLemonBoy
2019-10-17improve progress reportingAndrew Kelley
* use erase rest of line escape code. * use `stderr.supportsAnsiEscapeCodes` rather than `isTty`. * respect `--color off` * avoid unnecessary recursion * add `Progress.log` * disable the progress std lib test since it's noisy and uses `time.sleep()`. * enable/integrate progress printing with the default test runner
2019-10-17rework the progress module and integrate with stage1Andrew Kelley