aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-01-19SPIR-V: Make emitting binary more efficientRobin Voetter
2021-01-19SPIR-V: Add glsl450 and vulkan spir-v operating system definitionsRobin Voetter
2021-01-19SPIR-V: Linking and codegen setupRobin Voetter
2021-01-19SPIR-V: Initial architecture definitions and setupRobin Voetter
2021-01-19SPIR-V: Add generated specificationRobin Voetter
2021-01-19SPIR-V: Spec generatorRobin Voetter
2021-01-19Merge pull request #7818 from kubkon/macho-more-cleanupJakub Konka
Macho more cleanup
2021-01-19astgen: eliminate rlWrapPtr and all its callsitesAndrew Kelley
The following AST avoids unnecessary derefs now: * error set decl * field access * array access * for loops: replace ensure_indexable and deref on the len_ptr with a special purpose ZIR instruction called indexable_ptr_len. Added an error note when for loop operand is the wrong type. I also accidentally implemented `@field`.
2021-01-18Merge branch 'stage2: rework ZIR/TZIR for optionals and error unions'Andrew Kelley
closes #7730 closes #7662
2021-01-18stage2: rework ZIR/TZIR for optionals and error unionsAndrew Kelley
* fix wrong pointer const-ness when unwrapping optionals * allow grouped expressions and orelse as lvalues * ZIR for unwrapping optionals: no redundant deref - add notes to please don't use rlWrapPtr, this function should be deleted * catch and orelse: better ZIR for non-lvalue: no redundant deref; operate entirely on values. lvalue case still works properly. - properly propagate the result location into the target expression * Test harness: better output when tests fail due to compile errors. * TZIR: add instruction variants. These allow fewer TZIR instructions to be emitted from zir_sema. See the commit diff for per-instruction documentation. - is_null - is_non_null - is_null_ptr - is_non_null_ptr - is_err - is_err_ptr - optional_payload - optional_payload_ptr * TZIR: removed old naming convention instructions: - isnonnull - isnull - iserr - unwrap_optional * ZIR: add instruction variants. These allow fewer ZIR instructions to be emitted from astgen. See the commit diff for per-instruction documentation. - is_non_null - is_null - is_non_null_ptr - is_null_ptr - is_err - is_err_ptr - optional_payload_safe - optional_payload_unsafe - optional_payload_safe_ptr - optional_payload_unsafe_ptr - err_union_payload_safe - err_union_payload_unsafe - err_union_payload_safe_ptr - err_union_payload_unsafe_ptr - err_union_code - err_union_code_ptr * ZIR: removed old naming convention instructions: - isnonnull - isnull - iserr - unwrap_optional_safe - unwrap_optional_unsafe - unwrap_err_safe - unwrap_err_unsafe - unwrap_err_code
2021-01-18stage2: fix orelse at comptimeg-w1
There was just some untested code that did not work. .isnull -> .isnonnull and I had to add a .ref resultloc to make types match up.
2021-01-18macho: add missing DWARF line no update in codegenJakub Konka
2021-01-18stage2 macho: cleanup indirect symbol table writesJakub Konka
Also, force rewriting of code signature padding at every update so that we take into account possible section relocs and expansion of the last preceeding section, e.g., the string table. This commit also tweak the logic responsible for managing debug lines in `DebugSymbols`. In particular, in case we update the same function, we'd previously incorrectly create a cycle adding pointer to the same `SrcFn` to itself.
2021-01-18stage2 AArch64: implement jumpjoachimschmidt557
2021-01-18update wasm backend to match new Module APIAndrew Kelley
Fixes a logical merge conflict that I didn't notice before.
2021-01-18Merge pull request #7797 from Luukdegram/wasm-refactorAndrew Kelley
stage2: wasm - Refactor codegen for wasm similar to other backends
2021-01-18Merge pull request #7814 from LemonBoy/fix-7760Andrew Kelley
std: Fixed pipe2 fallback
2021-01-18translate-c: Add Wide, UTF-16, and UTF-32 character literalsEvan Haas
Add support for L'<wchar_t>', u'<char16_t>', and U'<char32_t>'. Currently this just translates wide char literals to \u{NNNNNN} escape codes (e.g. U'💯' -> '\u{1f4af}') Another approach would be to emit UTF-8 encoded character literals directly, but in my opinion this approaches Unicode-complete because it would require knowledge of which Unicode codepoints have graphical representations for the emitted source to be readable. We could also just emit integer literals, but the current method makes it clear that we have translated a wide character literal and not just an integer constant.
2021-01-18stage2: use %type not @type for libc stubsJulian Maingot
Missed a couple places last time so just doing the rest.
2021-01-18update error return docJulian Maingot
Docs were out of sync with code
2021-01-18Merge pull request #7808 from joachimschmidt557/stage2-aarch64Jakub Konka
Stage2 AArch64: Fix genSetStack
2021-01-18std: Add missing cast when calling fcntl w/ constant argsLemonBoy
comptime_int arguments are a big no no.
2021-01-18std: define pipe2 only for os that support itLemonBoy
2021-01-18std: Fixed pipe2 fallbackLemonBoy
Use both F_SETFD and F_SETFL depending on what flag we're setting. Closes #7760
2021-01-17stage2 AArch64: update function prologue and epilogue to include stackjoachimschmidt557
offsets
2021-01-17stage2 AArch64: add add/subtract (immediate) instructionsjoachimschmidt557
2021-01-17stage2 AArch64: fix stack offsets in genSetStackjoachimschmidt557
2021-01-17macho: refactor undef symbol handlingJakub Konka
Now, we don't erroneously write to the string table on every write of global and undef symbols.
2021-01-17macho: improve x86_64 tests; clean fixups on errorJakub Konka
When codegen ends in failure, we need to manually clean up any fixups that may have been gathered during that `codegen.generateSymbol` call. Otherwise, we will end trapping.
2021-01-17stage2 aarch64: add basic function pro/epilogueJakub Konka
Fix typo in `nop` implementation. Simplify `aarch64` macOS tests.
2021-01-17stage2 aarch64: add basic genSetStackJakub Konka
2021-01-17Merge branch 'stage2 error notes'Andrew Kelley
Closes #7555 There was still some extra work @Vexu did in that PR having to do with adding more compile errors and notes for switch expressions, but that can be added in a follow-up commit.
2021-01-17stage2: add compile error for label redefinitionAndrew Kelley
Also fix incorrectly destroying notes. This work is based on Vexu's patch in #7555.
2021-01-16stage2: slight cleanup of Module by calling astgen functionsAndrew Kelley
2021-01-16stage2: implement error notes and regress -femit-zirAndrew Kelley
* Implement error notes - note: other symbol exported here - note: previous else prong is here - note: previous '_' prong is here * Add Compilation.CObject.ErrorMsg. This object properly converts to AllErrors.Message when the time comes. * Add Compilation.CObject.failure_retryable. Properly handles out-of-memory and other transient failures. * Introduce Module.SrcLoc which has not only a byte offset but also references the file which the byte offset applies to. * Scope.Block now contains both a pointer to the "owner" Decl and the "source" Decl. As an example, during inline function call, the "owner" will be the Decl of the caller and the "source" will be the Decl of the callee. * Module.ErrorMsg now sports a `file_scope` field so that notes can refer to source locations in a file other than the parent error message. * Some instances where a `*Scope` was stored, now store a `*Scope.Container`. * Some methods in the `Scope` namespace were moved to the more specific type, since there was only an implementation for one particular tag. - `removeDecl` moved to `Scope.Container` - `destroy` moved to `Scope.File` * Two kinds of Scope deleted: - zir_module - decl * astgen: properly use DeclVal / DeclRef. DeclVal was incorrectly changed to be a reference; this commit fixes it. Fewer ZIR instructions processed as a result. - declval_in_module is renamed to declval - previous declval ZIR instruction is deleted; it was only for .zir files. * Test harness: friendlier diagnostics when an unexpected set of errors is encountered. * zir_sema: fix analyzeInstBlockFlat by properly calling resolvingInst on the last zir instruction in the block. Compile log implementation: * Write to a buffer rather than directly to stderr. * Only keep track of 1 callsite per Decl. * No longer mutate the ZIR Inst struct data. * "Compile log statement found" errors are only emitted when there are no other compile errors. -femit-zir and support for .zir source files is regressed. If we wanted to support this again, outputting .zir would need to be done as yet another backend rather than in the haphazard way it was previously implemented. For parsing .zir, it was implemented previously in a way that was not helpful for debugging. We need tighter integration with the test harness for it to be useful; so clearly a rewrite is needed. Given that a rewrite is needed, and it was getting in the way of progress and organization of the rest of stage2, I regressed the feature.
2021-01-16std.ArrayHashMap: add "AssertDiscard" function variantsAndrew Kelley
* Add `swapRemoveAssertDiscard` * Add `orderedRemoveAssertDiscard` * Deprecate `removeAssertDiscard`
2021-01-16Merge pull request #7716 from koachan/sparc64-libsAndrew Kelley
stage1: SPARCv9 f128 enablement
2021-01-16stage2 ARM: add extra load/store instructionsjoachimschmidt557
2021-01-16stage2 AArch64: add very basic return valuesjoachimschmidt557
2021-01-16Generate correct opcode for 'addGen' depending on typeLuuk de Gram
2021-01-16Add tests and move tests to wasm's own fileLuuk de Gram
2021-01-15Cleanup and 'add' instruction for bigger test areaLuuk de Gram
2021-01-15stage2: refactor wasm backend - similar to the other backendsLuuk de Gram
2021-01-15macho: ensure that strtab always follows symtabJakub Konka
In rare occassions, it may happen that string table is allocated free space preceeding symbol table. This is an error in the eyes of the `dyld` dynamic loader and thus has to forbidden by the linker.
2021-01-15crypto: add legacy keccak hash functionsGuillaume Ballet
2021-01-15translate-c: ensure bools are cast to int when necessaryEvan Haas
Fixes two scenarios where @boolToInt() calls were missing: 1. Boolean expression cast to different-size int (char, long, etc) 2. Boolean expression used as parameter for function with int argument
2021-01-15Merge pull request #7785 from ziglang/std-thread-primitivesAndrew Kelley
organize std lib concurrency primitives and add RwLock
2021-01-15Fix _Qp_cmp definitionKoakuma
2021-01-15Fix f128 codegen on BE hostsKoakuma
2021-01-15Add compiler-rt stub for SPARC CPUsKoakuma