aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
AgeCommit message (Collapse)Author
2018-01-06Darwin -> MacOSX, added Zen. See #438Andrea Orru
2017-12-26self-hosted: build against zig_llvm and embedded LLDAndrew Kelley
Now the self-hosted compiler re-uses the same C++ code for interfacing with LLVM as the C++ code. It also links against the same LLD library files.
2017-12-24fix segfault when passing union enum with sub byte...Andrew Kelley
...field to const slice parameter we use a packed struct internally to represent a const array of disparate union values, and needed to update the internal getelementptr instruction to recognize that. closes #664
2017-12-23translate-c: set up debug scope for translated functionsAndrew Kelley
2017-12-22fix endianness of sub-byte integer fields in packed structsAndrew Kelley
closes #307
2017-12-19fix crash when implicitly casting array of len 0 to sliceAndrew Kelley
closes #660
2017-12-19bring back code that uses export and fix testsAndrew Kelley
partial revert of 1fdebc1dc4881a00766f7c2b4b2d8ee6ad6e79b6
2017-12-18wip export rewriteAndrew Kelley
2017-12-08translate-c: more complex logic for translating a C cast in a macroAndrew Kelley
2017-12-06add higher level arg-parsing API + misc. changesAndrew Kelley
* add @noInlineCall - see #640 This fixes a crash in --release-safe and --release-fast modes where the optimizer inlines everything into _start and clobbers the command line argument data. If we were able to verify that the user's code never reads command line args, we could leave off this "no inline" attribute. * add i29 and u29 primitive types. u29 is the type of alignment, so it makes sense to be a primitive. probably in the future we'll make any `i` or `u` followed by digits into a primitive. * add `aligned` functions to Allocator interface * add `os.argsAlloc` and `os.argsFree` so that you can get a `[]const []u8`, do whatever arg parsing you want, and then free it. For now this uses the other API under the hood, but it could be reimplemented to do a single allocation. * add tests to make sure command line argument parsing works.
2017-12-05add implicit cast from enum to unionAndrew Kelley
when the enum is the tag type of the union and is comptime known to be of a void field of the union See #642
2017-12-05translate-c: fix not printing clang errorsAndrew Kelley
2017-12-04fix incorrect LLVM IR for union constant when active field is voidAndrew Kelley
found in the llvm6 branch with llvm assertions on
2017-12-04rename builtin.is_big_endian to builtin.endianAndrew Kelley
See #307
2017-12-03rename @EnumTagType to @TagType. add tests for union-enumsAndrew Kelley
See #618
2017-12-03rework enums and unions and their relationship to each otherAndrew Kelley
* @enumTagName renamed to @tagName and it works on enums and union-enums * Remove the EnumTag type. Now there is only enum and union, and the tag type of a union is always an enum. * unions support specifying the tag enum type, and they support inferring an enum tag type. * Enums no longer support field types but they do support setting the tag values. Likewise union-enums when inferring an enum tag type support setting the tag values. * It is now an error for enums and unions to have 0 fields. * switch statements support union-enums closes #618
2017-12-02ability to set tag values of enumsAndrew Kelley
also remove support for enums with 0 values closes #305
2017-12-01packed structs can have enums with explicit tag typesAndrew Kelley
See #305
2017-11-30ability to specify tag type of enumsAndrew Kelley
see #305
2017-11-24rename "parsec" to "translate-c"Andrew Kelley
2017-11-16fix codegen for union init with runtime valueAndrew Kelley
see #144
2017-11-16debug safety for unionsAndrew Kelley
2017-11-16union secret field is the tag index instead of distinct type indexAndrew Kelley
See #144
2017-11-15unions have a secret field for the typeAndrew Kelley
See #144
2017-11-15basic union supportAndrew Kelley
See #144
2017-11-10fix test failuresAndrew Kelley
put all the codegen for fn prototypes to the same place
2017-11-10fix bug when multiple function definitions existAndrew Kelley
This might be related to #529
2017-11-08fix enum sizes too largeAndrew Kelley
closes #598
2017-11-06add @memberType and @memberName builtin functionsAndrew Kelley
see #383 there is a plan to unify most of the reflection into 2 builtin functions, as outlined in the above issue, but this gives us needed features for now, and we can iterate on the design in future commits
2017-11-04add compile-time reflection for function arg typesAndrew Kelley
See #383
2017-11-03Add emit command-line option (#580)Marc Tiehuis
Add emit command-line option
2017-11-01windows: use the same libc search within a compilation unitAndrew Kelley
2017-11-01WIN32: Linking with the CRT at runtime. (#570)Dimenus
Disclaimer: Forgive me if my format sucks, I've never submitted a PR before! Fixes: #517 I added a few things to allow zig to link with the CRT properly both statically and dynamically. In Visual Studio 2017, Microsoft changed how the c-runtime is factored again. With this change, they also added a COM interface to allow you to query the respective Visual Studio instance for two of them. This does that and also falls back on a registry query for 2015 support. If you're using a Visual Studio instance older than 2015, you'll have to use the existing options available with the zig compiler. Changes are listed below along with a general description of the changes. all_types.cpp: The separate variables for msvc/kern32 have been removed and all win32 libc directory paths have been combined into a ZigList since we're querying more than two directories and differentiating one from another doesn't matter to lld. analyze.cpp: The existing functions were extended to support querying libc libs & libc headers at runtime. codegen.cpp/hpp: Microsoft uses the new 'Universal C Runtime' name now. Doesn't matter from a functionality standpoint. I left the compiler switches as is to not introduce any breaking changes. link.cpp: We're linking 4 libs and generating another in order to support the UCRT. Dynamic: msvcrt/d, vcruntime/d, ucrt/d, legacy_stdio_definitions.lib Static: libcmt/d, libvcruntime/d libucrt/d, legacy_stdio_definitions.lib main.cpp: Update function call names. os.cpp/hpp: COM/Registry interface for querying Windows UCRT/SDK. Sources: [Windows CRT](https://docs.microsoft.com/en-us/cpp/c-runtime-library/crt-library-features) [VS 2015 Breaking Changes](https://msdn.microsoft.com/en-us/library/bb531344.aspx)
2017-10-27Merge branch 'master' into self-hostedAndrew Kelley
2017-10-27use llvm named structs for const values when possibleAndrew Kelley
normally we want to use llvm types for constants. but union constants (which are found inside enums) when they are initialized with the non-most-aligned-member must be unnamed structs. these bubble up to all aggregate types. if a constant of an aggregate type contains, recursively, a union constant with a non-most-aligned-member initialized, the aggregate typed constant must be unnamed too. this fixes some of the asserts that were coming in from llvm master branch.
2017-10-25cleaner verbose flags and zig build prints failed commandAndrew Kelley
2017-10-24fix missing compiler_rt in release modesAndrew Kelley
the optimizer was deleting compiler_rt symbols, so I changed the linkage type from LinkOnce to Weak also changed LinkOnce to mean linkonce_odr in llvm and Weak to mean weak_odr in llvm. See #563
2017-10-24wip self hosted codeAndrew Kelley
2017-10-21fix compiler crash regarding type name of undefinedAndrew Kelley
See #547
2017-10-17add uwtable attribute to functions on windowsAndrew Kelley
See #516 now we have at least a callstack. we still need updated LLD to get stack traces.
2017-10-16fix codegen of enum name table having wrong LLVM typesAndrew Kelley
See https://bugs.llvm.org/show_bug.cgi?id=34952
2017-10-16look for libc at runtime on windowsAndrew Kelley
See #539 before we close the issue we should also detect MSVC 2017 but this gets us started with supporting MSVC 2015
2017-10-16ability to make a DLLAndrew Kelley
See #302
2017-10-15clean up some resourcesAndrew Kelley
2017-10-15fix windows argument parsingAndrew Kelley
2017-10-15disable byval parameters on windows to work around llvm bugAndrew Kelley
See #536
2017-10-14build-exe allows direct export of WinMainCRTStartupAndrew Kelley
2017-10-10add module flag to emit CodeView for COFF object filesAndrew Kelley
see #516
2017-10-03use __chkstk_ms compiler-rt functions for __chkstkAndrew Kelley
I had to revert the target native features thing because there is still some incorrect behavior with f128. Reopens #508 partially reverts b5054625093ef22b3f228199b6fbf70e1c50b703 See #302
2017-10-03replace __chkstk function with a stub that does not crashAndrew Kelley
Closes #508 See #302