aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
AgeCommit message (Collapse)Author
2020-09-21rename src-self-hosted/ to src/Andrew Kelley
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-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-05Merge pull request #6246 from Vexu/fieldVeikka Tuominen
Remove deprecated fields on `type`
2020-09-04langref: atomic ops are allowed on pointersVexu
Closes #6217
2020-09-03remove deprecated fields from typesVexu
2020-09-02Merge pull request #6229 from LemonBoy/fix-6054Andrew Kelley
ir: Typecheck the sentinel value in *[N:S1]T to [S2]T casts
2020-09-02builtin: Add TypeInfo.StructField.is_comptimeTadeo Kondrak
2020-09-01ir: Typecheck the sentinel value in *[N:S1]T to [S2]T castsLemonBoy
Closes #6054
2020-08-30Remove @OpaqueTypeTadeo Kondrak
2020-08-24fix error note using invalid source nodeVexu
Closes #6153
2020-08-24add error checks to `@Type`Vexu
2020-08-22Merge pull request #6119 from tadeokondrak/@Type(.Enum)Andrew Kelley
Implement @Type for Enum
2020-08-22Remove TypeInfo.Error.valueTadeo Kondrak
2020-08-21@Type for Enum fix: use correct decls_scopeTadeo Kondrak
2020-08-21Implement @Type for EnumTadeo Kondrak
2020-08-19Small fixes for @Type(.Struct)Tadeo Kondrak
2020-08-19Implement @Type for structs without decls supportTadeo Kondrak
2020-08-19Remove offset field from TypeInfo.StructFieldTadeo Kondrak
This isn't needed with @bitOffsetOf/@byteoffsetOf and complicates @Type handling.
2020-08-18Merge pull request #5495 from xackus/fix_5314Veikka Tuominen
stage1: fix non-exhaustive enums with one field
2020-08-17Handle singular param count word in error messages (#6073)Ashish Shekar
2020-08-17fix cast from invalid non-exhaustive enum to unionVexu
2020-08-17disallow '_' prong when switching on non-exhaustive tagged unionVexu
A tagged union cannot legally be initiated to an invalid enumeration
2020-08-17stage1: fix non-exhaustive enums with one fieldxackus
2020-08-13add error for unused/duplicate block labelsVexu
2020-08-07std: introduce GeneralPurposeAllocatorAndrew Kelley
`std.GeneralPurposeAllocator` is now available. It is a function that takes a configuration struct (with default field values) and returns an allocator. There is a detailed description of this allocator in the doc comments at the top of the new file. The main feature of this allocator is that it is *safe*. It prevents double-free, use-after-free, and detects leaks. Some deprecation compile errors are removed. The Allocator interface gains `old_align` as a new parameter to `resizeFn`. This is useful to quickly look up allocations. `std.heap.page_allocator` is improved to use mmap address hints to avoid obtaining the same virtual address pages when unmapping and mapping pages. The new general purpose allocator uses the page allocator as its backing allocator by default. `std.testing.allocator` is replaced with usage of this new allocator, which does leak checking, and so the LeakCheckAllocator is retired. stage1 is improved so that the `@typeInfo` of a pointer has a lazy value for the alignment of the child type, to avoid false dependency loops when dealing with pointers to async function frames. The `std.mem.Allocator` interface is refactored to be in its own file. `std.Mutex` now exposes the dummy mutex with `std.Mutex.Dummy`. This allocator is great for debug mode, however it needs some work to have better performance in release modes. The next step will be setting up a series of tests in ziglang/gotta-go-fast and then making improvements to the implementation.
2020-08-02add compile error for alignCasting zero sized typesVexu
2020-07-28add helpful error note for when function cannot return an errorVexu
This has caused frequent confusion since it looks like you are handling errors correctly with a try but you forgot to change your return type.
2020-07-26Merge pull request #5693 from antlilja/switch-unreachable-elseAndrew Kelley
Add error message for unreachable else prong in switch
2020-07-24Revert "Support taking extern pointers at comptime"Andrew Kelley
This reverts commit d3ebd428650748e60db70dd2171cc044855814b1. This caused a build failure on multiple targets.
2020-07-24Support taking extern pointers at comptimeyvt
This commit makes it possible to obtain pointers to `extern` variables at comptime. - `ir_get_var_ptr` employs several checks to determine if the given variable is eligible for obtaining its pointer at comptime. This commit alters these checks to consider `extern` variables, which have runtime values, as eligible. - After this change, it's now possible for `render_const_val` to be called for `extern` variables. This commit modifies `render_const_val` to suppress the value generation for `extern` variables. - `do_code_gen` now creates `ZigValue::llvm_global` of `extern` variables before iterating through module-level variables so that other module-level variables can refer to them. This solution is incomplete since there are several cases still failing: - `global_var.array[n..m]` - `&global_var.array[i]` - `&global_var.inner_struct.value` - `&global_array[i]` Closes #5349
2020-07-21fix comptime comparisons of different sized floatsVexu
2020-07-18allow non-pointer extern opaque variablesVexu
2020-07-18fix floatCast type check regressionVexu
Closes #5900
2020-07-17add is_tuple field to struct typeinfoVexu
part of #4335
2020-07-14follow up from previous commit for generic methodsAndrew Kelley
2020-07-14fix ability to call methods on enums with pointer-to-selfAndrew Kelley
closes #3218
2020-07-13check for invalid sentinel when creating pointer with `@Type`Vexu
2020-07-11add 'anytype' to stage1 and langrefVexu
2020-07-11use correct cast function when doing `@floatCast` at comptimeVexu
2020-07-09Revert "use correct cast function when doing `@floatCast` at comptime"Andrew Kelley
This reverts commit 2e1bdd0d14f490a80bbed3ee0e0479a908715d33. Test failures
2020-07-09use correct cast function when doing `@floatCast` at comptimeVexu
Closes #5832
2020-07-01Add new error message for unreachable else prongsantlilja
* Adds error message for types: enum, int and bool * Adds compile error tests
2020-06-28Merge pull request #5696 from alexnask/async_call_tupleAndrew Kelley
@asyncCall now takes arguments as a tuple instead of varargs
2020-06-24Fix issue #5618 (#5685)arbrk1
* fix issue #5618 * A test for the issue #5618 added. Also inserted a comma in the neighboring test to make it more zigfmt-friendly.
2020-06-24Fixed crash when resolving peer types of *[N:s]const T and [*:s]const TAlexandros Naskos
2020-06-24Store else node in IrInstSrcCheckSwitchProngsantlilja
* Remove have_else_prong (bool) * Add else_prong (AstNode*)
2020-06-24Small fixes, fixed tests, added test for argument tuple typeAlexandros Naskos
2020-06-24@asyncCall now requires an argument tupleAlexandros Naskos