aboutsummaryrefslogtreecommitdiff
path: root/src/analyze.cpp
AgeCommit message (Collapse)Author
2020-09-21rename src-self-hosted/ to src/Andrew Kelley
2020-09-18stage2 now supports using stage1 as a backend for compiling zig codeAndrew Kelley
* move stage2.cpp code into zig0.cpp for simplicity * add -ftime-report and some more CLI options to stage2 * stage2 compites the llvm cpu features string * classifyFileExt understands more file extensions * correction to generateBuiltinZigSource using the wrong allocator (thanks dbandstra!) * stage2 is now able to build hello.zig into hello.o using stage1 as a library however it fails linking due to missing compiler-rt * remove dead code * simplify zig0 builtin.zig source * fix not resolving builtin.zig source path causing duplicate imports * fix stage1.h not being valid C code * fix stage2.h not being valid C code
2020-09-17delete all stage1 c++ code not directly related to compiling stage2Andrew Kelley
Deleted 16,000+ lines of c++ code, including: * an implementation of blake hashing * the cache hash system * compiler.cpp * all the linking code, and everything having to do with building glibc, musl, and mingw-w64 * much of the stage1 compiler internals got slimmed down since it now assumes it is always outputting an object file. More stuff: * stage1 is now built with a different strategy: we have a tiny zig0.cpp which is a slimmed down version of what stage1 main.cpp used to be. Its only purpose is to build stage2 zig code into an object file, which is then linked by the host build system (cmake) into stage1. zig0.cpp uses the same C API that stage2 now has access to, so that stage2 zig code can call into stage1 c++ code. - stage1.h is - stage2.h is - stage1.zig is the main entry point for the Zig/C++ hybrid compiler. It has the functions exported from Zig, called in C++, and bindings for the functions exported from C++, called from Zig. * removed the memory profiling instrumentation from stage1. Abandon ship! * Re-added the sections to the README about how to build stage2 and stage3. * stage2 now knows as a comptime boolean whether it is being compiled as part of stage1 or as stage2. - TODO use this flag to call into stage1 for compiling zig code. * introduce -fdll-export-fns and -fno-dll-export-fns and clarify its relationship to link_mode (static/dynamic) * implement depending on LLVM to detect native target cpu features when LLVM extensions are enabled and zig lacks CPU feature detection for that target architecture. * C importing is broken, will need some stage2 support to function again.
2020-09-14Merge remote-tracking branch 'origin/master' into stage2-zig-ccAndrew Kelley
2020-09-14Merge pull request #6172 from tadeokondrak/@Type(.Union)Veikka Tuominen
Implement @Type for Union
2020-09-12Merge remote-tracking branch 'origin/master' into stage2-zig-ccAndrew Kelley
Master branch added in the concept of library versioning being optional to main.cpp. It will need to be re-added into this branch before merging back into master.
2020-09-10stage1: fix crash with slice typeAndrew Kelley
2020-09-10Merge pull request #5527 from shawnanastasio/ppc64leAndrew Kelley
Implement support for powerpc64{,le}
2020-09-07@Type for union fixesTadeo Kondrak
2020-09-07Implement @Type for UnionTadeo Kondrak
This removes TypeInfo.UnionField.enum_field, which is redundant with TypeInfo.Union.tag_type.
2020-09-03remove deprecated fields from typesVexu
2020-08-21Implement @Type for EnumTadeo Kondrak
2020-08-19Implement @Type for structs without decls supportTadeo Kondrak
2020-08-17stage1: fix non-exhaustive enums with one fieldxackus
2020-08-13stage1: fix enums having wrong debug infoAndrew Kelley
It wasn't wrong info, but e.g. GDB couldn't handle non-power-of-two enum tags. Now we tell debug info that enum tags are always power of two size. closes #4526 closes #5432
2020-07-28stage1: hot path for resolving types of primitivesAndrew Kelley
This is an attempt to save memory when building self-hosted. before: Total bytes allocated: 5.941 GiB, deallocated: 2.259 GiB, remaining: 3.681 GiB after: Total bytes allocated: 5.933 GiB, deallocated: 2.253 GiB, remaining: 3.680 GiB
2020-07-18allow non-pointer extern opaque variablesVexu
2020-07-12update compile error tests and some doc commentsVexu
2020-07-11add 'anytype' to stage1 and langrefVexu
2020-07-08fix missing check on extern variables with no typeVexu
2020-07-01Implement required ABI bits for powerpc{,64,64le}Shawn Anastasio
2020-06-24Copy union const values correctlyAlexandros Naskos
2020-06-18Merge pull request #5203 from tadeokondrak/@type-for-even-more-typesAndrew Kelley
implement @typeInfo for Frame and implement @Type for Frame, EnumLiteral, and ErrorSet
2020-05-26Merge pull request #5440 from kubkon/align-fn-error-wasmAndrew Kelley
Make align expr on fns a compile error in Wasm
2020-05-26Add caller location tracking for asserts (ir_assert, src_assert, ↵foobles
ir_assert_gen) (#5393)
2020-05-26Make align expr on fns a compile error in WasmJakub Konka
In Wasm, specifying alignment of function pointers makes little sense since function pointers are in fact indices to a Wasm table, therefore any alignment check on those is invalid. This can cause unexpected behaviour when checking expected alignment with `@ptrToInt(fn_ptr)` or similar. This commit proposes to make `align` expressions a compile error when compiled to Wasm architecture. Some references: [1] [Mozilla: WebAssembly Tables](https://developer.mozilla.org/en-US/docs/WebAssembly/Understanding_the_text_format#WebAssembly_tables) [2] [Sunfishcode's Wasm Ref Manual](https://github.com/sunfishcode/wasm-reference-manual/blob/master/WebAssembly.md#indirect-call)
2020-05-23fix regression in compile errorsAndrew Kelley
2020-05-20stage1: fix false positive redeclared variable compile errorAndrew Kelley
2020-05-17Merge pull request #5057 from xackus/opaque-paramAndrew Kelley
stage1: fix assert fail on opaque fn ptr param
2020-05-05remove nakedcc/stdcallcc/async fn/extern fn fnprotoTadeo Kondrak
2020-05-05Rename noasync to nosuspend in C++ compilerTadeo Kondrak
2020-05-04stage1: remove unneeded switchxackus
2020-05-04stage1: fix assert fail on opaque fn ptr paramxackus
2020-05-02Implement @typeInfo for @Frame()Tadeo Kondrak
Closes https://github.com/ziglang/zig/issues/3066
2020-04-24Add mips support to standard libraryTimon Kruiper
2020-04-22stage1: Prevent the creation of illegal pointer typesLemonBoy
Changing the pointer length from Unknown to Single/C now resets the sentinel value too. Closes #5134
2020-04-22stage1: Another hack for the C ABI compatibilityLemonBoy
Applying the wrong ABI is slightly better than using the Zig ABI, the whole thing is so wrong it should be burned to the ground.
2020-04-20stage1: Handle errors when generating block IRLemonBoy
Closes #5005
2020-04-17add error for non-exter variadic functionsVexu
2020-04-17stage1: Fix several bugs in constant generationLemonBoy
The codegen would sometimes change the LLVM type for some constants to an unnamed structure in order to accomodate extra padding. This is fine as long as the alignment of each field is still respected and it was not the case for structure types, leading to ill-formed constants being generated. Optional types suffer from this to a lower extent as their layout is quite lucky, the only missing piece was the tail padding. Closes #4530 Closes #4594 Closes #4295 Closes my will to live
2020-04-07stage1: Respect the specified name for extern varLemonBoy
Extend the logic used for function definitions to variables. Closes #4947
2020-04-05type_has_one_possible_value takes comptime struct fields into accountAndrew Kelley
Before, type_has_one_possible_value would return false for the value `.{1}`. But actually, that type is a tuple with a single comptime field. Such a type, in fact, has one possible value. This plus the corresponding adjustment to get_the_one_possible_value solves #3878.
2020-04-02Fix multiplication overflow in `hash_const_val`Timon Kruiper
In some cases the compiler was actually emitting an 64 bit signed multiplication, instead of a 32 bit unsigned one.
2020-04-01stage1: make C++ switch fallthrough an errorMichael Dusan
Make fallthrough an error when compiler supports it. This requires a new macro that is defined with such compilers to be used as a statement, at all fallthrough sites: switch (...) { case 0: ... ZIG_FALLTHROUGH; case 1: ... break; default: ... break; } If we ever move to C++17 as minimal requirement, then the macro can be replaced with `[[fallthrough]];` at statement sites.
2020-04-01Make sure that ZigTypeVector and ZigTypeArray have the same memory layoutTimon Kruiper
Throughout the stage1 code it is assumed that these have the same layout, but that was not the case. This caused an issue on 32-bit hardware.
2020-03-26ability to compile c++ hello world with `zig c++`Andrew Kelley
closes #4786
2020-03-190-bit array type does not resolve child typeAndrew Kelley
2020-03-19`@ptrCast` supports casting a slice to pointerAndrew Kelley
2020-03-19fixes in semantic analysis needed to support this featureAndrew Kelley
2020-03-19slicing with comptime start and end results in arrayAndrew Kelley
implements #863