aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
AgeCommit message (Collapse)Author
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
2019-10-15fix non-byte-aligned packed struct field...Andrew Kelley
...passed as generic fn parameter causing invalid LLVM IR. closes #3460
2019-10-12Correctly mangle frameaddress intrinsic nameLemonBoy
2019-10-11merge dumps tool: merging ast nodesAndrew Kelley
-fgenerate-docs is replaced ith -femit-docs -fno-emit-bin is added to prevent outputting binary
2019-10-10codegen.cpp: remove unused variableAndrew Kelley
2019-10-09Remove x86/Windows name mangling hackLemonBoy
Let's fix this properly by generating the correct lib files from the mingw sources.
2019-10-09add comments about why we choose pentium4 for i386 targetAndrew Kelley
See #3389
2019-10-09improve names of error sets when using merge error sets operatorAndrew Kelley
2019-10-09Merge pull request #3389 from LemonBoy/win32Andrew Kelley
Win32
2019-10-06generated docs: docs/ instead of doc/Andrew Kelley
This appears to be more of a standard directory name. See #21
2019-10-06Initial support for i386-windows-msvc targetLemonBoy
2019-10-04proof of concept of stage1 doc generationAndrew Kelley
This commit adds `-fgenerate-docs` CLI option, and it outputs: * doc/index.html * doc/data.js * doc/main.js In this strategy, we have 1 static html page and 1 static javascript file, which loads the semantic analysis dump directly and renders it using dom manipulation. Currently, all it does is list the declarations. But there is a lot more data available to work with. The next step would be making the declarations hyperlinks, and handling page navigation. Another strategy would be to generate a static site with no javascript, based on the semantic analysis dump that zig now provides. I invite the Zig community to take on such a project. However this version which heavily relies on javascript will also be a direction explored. I also welcome contributors to improve the html, css, and javascript of what this commit started, as well as whatever improvements are necessary to the static analysis dumping code to provide more information. See #21.
2019-10-03fix noreturn attribute for msvcAndrew Kelley
2019-10-03add -fdump-analysis to dump type information to jsonAndrew Kelley
This commit adds -fdump-analysis which creates a `$NAME-analysis.json` file with all of the finished semantic analysis that the stage1 compiler produced. It contains types, packages, declarations, and files. This is an initial implementation; some data will be missing. However it's easy to improve the implementation, which is in `src/dump_analysis.cpp`. The next step for #21 will be to create Zig code which parses this json file and creates user-facing HTML documentation. This feature has other uses, however; for example, it could be used for IDE integration features until the self-hosted compiler is available.
2019-10-01fix tripping LLVM assertion in const unionsAndrew Kelley