aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/spirv.zig
AgeCommit message (Collapse)Author
2022-06-09introduce std.debug.TraceAndrew Kelley
And use it to debug a LazySrcLoc in stage2 that is set to a bogus value. The actual fix in this commit is: ```diff - try sema.emitBackwardBranch(&child_block, call_src); + try sema.emitBackwardBranch(block, call_src); ```
2022-04-27std: replace usage of std.meta.bitCount() with @bitSizeOf()Isaac Freund
2022-04-20stage2: use indexes for Decl objectsAndrew Kelley
Rather than allocating Decl objects with an Allocator, we instead allocate them with a SegmentedList. This provides four advantages: * Stable memory so that one thread can access a Decl object while another thread allocates additional Decl objects from this list. * It allows us to use u32 indexes to reference Decl objects rather than pointers, saving memory in Type, Value, and dependency sets. * Using integers to reference Decl objects rather than pointers makes serialization trivial. * It provides a unique integer to be used for anonymous symbol names, avoiding multi-threaded contention on an atomic counter.
2022-03-22stage2: lazy `@alignOf`Andrew Kelley
Add a `target` parameter to every function that deals with Type and Value.
2022-01-28spirv: spir-v dedicated type systemRobin Voetter
2022-01-28spirv: new moduleRobin Voetter
This introduces a dedicated struct that handles module-wide information.
2022-01-28spirv: keep track of air & liveness so that it can be used in flush()Robin Voetter
2022-01-24stage2: rework a lot of stuffAndrew Kelley
AstGen: * rename the known_has_bits flag to known_non_opv to make it better reflect what it actually means. * add a known_comptime_only flag. * make the flags take advantage of identifiers of primitives and the fact that zig has no shadowing. * correct the known_non_opv flag for function bodies. Sema: * Rename `hasCodeGenBits` to `hasRuntimeBits` to better reflect what it does. - This function got a bit more complicated in this commit because of the duality of function bodies: on one hand they have runtime bits, but on the other hand they require being comptime known. * WipAnonDecl now takes a LazySrcDecl parameter and performs the type resolutions that it needs during finish(). * Implement comptime `@ptrToInt`. Codegen: * Improved handling of lowering decl_ref; make it work for comptime-known ptr-to-int values. - This same change had to be made many different times; perhaps we should look into merging the implementations of `genTypedValue` across x86, arm, aarch64, and riscv.
2021-11-30allocgate: std Allocator interface refactorLee Cannon
2021-11-01Fix ensureTotalCapacity calls that should be ensureUnusedCapacity callsRyan Liptak
If these functions are called more than once, then the array list would no longer be guaranteed to have enough capacity during the appendAssumeCapacity calls. With ensureUnusedCapacity, they will always be guaranteed to have enough capacity regardless of how many times the function is called.
2021-10-21stage2: more division supportAndrew Kelley
AIR: * div is renamed to div_trunc. * Add div_float, div_floor, div_exact. - Implemented in Sema and LLVM codegen. C backend has a stub. Improvements to std.math.big.Int: * Add `eqZero` function to `Mutable`. * Fix incorrect results for `divFloor`. Compiler-rt: * Add muloti4 to the stage2 section.
2021-10-02Delete Module.Scope, move Block into SemaMartin Wickham
2021-10-02Remove my dumb "namespace decl" hackMartin Wickham
2021-09-24Spelling corrections (#9833)Josh Soref
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2021-09-19Update all ensureCapacity calls to the relevant non-deprecated versionRyan Liptak
2021-07-20stage2: update LLVM backend to new AIR memory layoutAndrew Kelley
Also fix compile errors when not using -Dskip-non-native
2021-07-20stage2: Air and Liveness are passed ephemerallyAndrew Kelley
to the link infrastructure, instead of being stored with Module.Fn. This moves towards a strategy to make more efficient use of memory by not storing Air or Liveness data in the Fn struct, but computing it on demand, immediately sending it to the backend, and then immediately freeing it. Backends which want to defer codegen until flush() such as SPIR-V must move the Air/Liveness data upon `updateFunc` being called and keep track of that data in the backend implementation itself.
2021-07-20stage2: first pass over Module.zig for AIR memory layoutAndrew Kelley
2021-07-20stage2: update Liveness, SPIR-V for new AIR memory layoutAndrew Kelley
also do the inline assembly instruction
2021-07-20stage2: rework AIR memory layoutAndrew Kelley
This commit changes the AIR file and the documentation of the memory layout. The actual work of modifying the surrounding code (in Sema and codegen) is not yet done.
2021-07-12C backend: TypedefMap is now ArrayHashMapAndrew Kelley
The C backend depends on insertion order into this map so that type definitions will be declared before they are used.
2021-06-21std, src, doc, test: remove unused variablesJacob G-W
2021-06-10zig fmtAndrew Kelley
2021-06-03Breaking hash map changes for 0.8.0Martin Wickham
- hash/eql functions moved into a Context object - *Context functions pass an explicit context - *Adapted functions pass specialized keys and contexts - new getPtr() function returns a pointer to value - remove functions renamed to fetchRemove - new remove functions return bool - removeAssertDiscard deleted, use assert(remove(...)) instead - Keys and values are stored in separate arrays - Entry is now {*K, *V}, the new KV is {K, V} - BufSet/BufMap functions renamed to match other set/map types - fixed iterating-while-modifying bug in src/link/C.zig
2021-05-22Merge pull request #8852 from Snektron/spirvAndrew Kelley
SPIR-V: More codegen
2021-05-22stage2: rename ir.zig to air.zigAndrew Kelley
We've settled on the nomenclature for the artifacts the compiler pipeline produces: 1. Tokens 2. AST (Abstract Syntax Tree) 3. ZIR (Zig Intermediate Representation) 4. AIR (Analyzed Intermediate Representation) 5. Machine Code Renaming `ir` identifiers to `air` will come with the inevitable air-memory-layout branch that I plan to start after the 0.8.0 release.
2021-05-22SPIR-V: Make functions which always return a null result return void insteadRobin Voetter
2021-05-22SPIR-V: Generate locals at the start of a functionRobin Voetter
2021-05-22SPIR-V: Debug line info/source infoRobin Voetter
2021-05-22SPIR-V: DeclGen constructor/destructorRobin Voetter
2021-05-22SPIR-V: branchingRobin Voetter
2021-05-22SPIR-V: Pass source location to genType and genConstant for better error ↵Robin Voetter
reporting
2021-05-22SPIR-V: Preliminary alloc/store/load generationRobin Voetter
2021-05-22SPIR-V: Split out genCmp from genBinOpRobin Voetter
2021-05-22SPIR-V: Preliminary integer constant encodingRobin Voetter
2021-05-22SPIR-V: ResultId and Word aliases to improve code clarityRobin Voetter
2021-05-22SPIR-V: Put types in SPIRVModule, some general restructuringRobin Voetter
2021-05-22SPIR-V: Use Value.toFloat instead of switching on value tag when generating ↵Robin Voetter
float constants
2021-05-17Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgenAndrew Kelley
Conflicts: * src/codegen/spirv.zig * src/link/SpirV.zig We're going to want to improve the stage2 test harness to print the source file name when a compile error occurs otherwise std lib contributors are going to see some confusing CI failures when they cause stage2 AstGen compile errors.
2021-05-16SPIR-V: Unary not operationRobin Voetter
2021-05-16SPIR-V: bool binary operationsRobin Voetter
2021-05-16SPIR-V: comparison and equality operationsRobin Voetter
2021-05-16SPIR-V: More bitwise binary operationsRobin Voetter
2021-05-16SPIR-V: More binary operationsRobin Voetter
2021-05-16SPIR-V: genBinOp setupRobin Voetter
2021-05-16SPIR-V: Some initial floating point constant generationRobin Voetter
2021-05-16SPIR-V: Some instructions + constant generation setupRobin Voetter
2021-05-16SPIR-V: Function parameter generationRobin Voetter
2021-05-16SPIR-V: OpFunction/OpFunctionEnd generationRobin Voetter
2021-05-16SPIR-V: Proper floating point type generationRobin Voetter