aboutsummaryrefslogtreecommitdiff
path: root/src/arch/x86_64/CodeGen.zig
AgeCommit message (Collapse)Author
2022-10-27Sema: use `runtime_value` instead of creating allocsVeikka Tuominen
2022-10-24Plan9: deal with unnamed declsJacob G-W
Hello World works again!
2022-10-23Merge pull request #13251 from Vexu/c-abiAndrew Kelley
implement ARM C ABI, separate C ABI tests from standalone tests
2022-10-22add C ABI tests for simd vectorsVeikka Tuominen
2022-10-21stage2: Add `.save_err_return_trace_index` AIR opCody Tapscott
This is encoded as a primitive AIR instruction to resolve one corner case: A function may include a `catch { ... }` or `else |err| { ... }` block but not call any errorable fn. In that case, there is no error return trace to save the index of and codegen needs to avoid interacting with the non-existing error trace. By using a primitive AIR op, we can depend on Liveness to mark this unused in this corner case.
2022-10-18all: rename `@maximum` to `@max` and `@minimum` to `@min`Ali Chraghi
2022-10-12stage2: add @addrSpaceCast builtinRobin Voetter
2022-10-05fix(text): hyphenate "comptime" adjectivesr00ster91
2022-09-13stage2: remove pointless discards from source codeAndrew Kelley
Good riddance!
2022-09-10x86_64: combine got_load, direct_load and imports_load into linker_load MCVJakub Konka
2022-09-07x86_64: fix SystemV calling conventionJakub Konka
2022-09-07x86_64: allow for any index register in complex SIB encodingsJakub Konka
This relieves register pressure, and reduce generated code size (since now we can use the same index register for both `mov_scale_src` and `mov_scale_dst` MIR instructions). Fix lowering of ModRM + SIB encodings where index register is extended - previously, we would carelessly ignore the fact generating incorrect encodings.
2022-09-07x86_64: clean up return registers for unspecified ccJakub Konka
2022-09-07x86_64: handle ptr_stack_offset for blocksJakub Konka
2022-09-07x86_64: clean up loggingJakub Konka
2022-09-07x86_64: refactor cond_br with canonicaliseBranches helperJakub Konka
2022-09-07x86_64: implement canonicalising branches in switch expressionJakub Konka
2022-09-07x86_64: implement Windows x64 calling conventionJakub Konka
2022-09-07coff: fix runtime trapsJakub Konka
2022-09-07coff: implement lowering unnamed constsJakub Konka
2022-09-07x86_64: add support for Win64/C calling conventionJakub Konka
2022-09-07coff: fix contents of IAT, and ensure codegen loads addr into regJakub Konka
As far as I can see, unlike with MachO, we don't have any stubs helper routines available and need to load a bound pointer into a register to then call it.
2022-09-07coff: re-enable default entrypoint for WindowsJakub Konka
2022-08-30coff: cleanup relocations; remove COFF support from other backendsJakub Konka
Given that COFF will want to support PIC from ground-up, there is no point in leaving outdated code for COFF in other backends such as arm or aarch64. Instead, when we are ready to look into those, we can start figuring out what to add and where.
2022-08-30coff: add basic handling of GOT PC relative indirectionJakub Konka
2022-08-30coff: reorganize the linkerJakub Konka
2022-08-24stage2: explicitly tagged enums no longer have one possible valueAndrew Kelley
Previously, Zig had inconsistent semantics for an enum like this: `enum(u8){zero = 0}` Although in theory this can only hold one possible value, the tag `zero`, Zig no longer will treat the type this way. It will do loads and stores, as if the type has runtime bits. Closes #12619 Tests passed locally: * test-behavior * test-cases
2022-08-15Merge pull request #12416 from Vexu/stage2-safetyVeikka Tuominen
Stage2 error set safety improvements
2022-08-12x86: fix generating debug info for variablesJakub Konka
Add handling for these additional `MCValue`s: * `.immediate` - lower to `DW.OP.consts` or `DW.OP.constu` depending on signedness followed by popping off the DWARF stack with `DW.OP.stack_value` * `.undef` - lower to `DW.OP.implicit_value` * `.none` - lower to `DW.OP.lit0` followed by popping off the DWARF stack with `DW.OP.stack_value` For any remaining unhandled case, we generate `DW.OP.nop` in order not to mess up remaining DWARF info.
2022-08-12stage2: generate a switch for `@errSetCast` safetyVeikka Tuominen
2022-08-05stage2: add runtime safety for invalid enum valuesVeikka Tuominen
2022-08-01Removed param_names from Fn inside Module.zigantlilja
Removed the copy of param_names inside of Fn and changed to implementation of getParamName to fetch to parameter name from the ZIR. The signature of getParamName was also changed to take an additional *Module argument.
2022-07-23stage2: implement `@setFloatMode`Veikka Tuominen
2022-07-22macho: improve logs for dyld infoJakub Konka
2022-07-22macho: rework symbol handling to match zld/ELFJakub Konka
Now, each object file will store a mutable table of symbols that it defines. Upon symbol resolution between object files, the symbol will be updated with a globally allocated section ordinal and address in virtual memory. If the object defines a globally available symbol, its location only (comprising of the symbol index and object index) will be stored in the globals map for easy access when relocating, etc. This approach cleans up the symbol management significantly, and matches the status quo used in zld/ELF. Additionally, this makes scoping symbol stabs easier too as they are now naturally contained within each object file.
2022-06-30stage2: lower float negation explicitlyAndrew Kelley
Rather than lowering float negation as `0.0 - x`. * Add AIR instruction for float negation. * Add compiler-rt functions for f128, f80 negation closes #11853
2022-06-24link:clarification & enable MachO getGlobalSymbolLuuk de Gram
This adds clarification to the getGlobalSymbol doc comments, as well as renames the `addExternFn` function for MachO to `getGlobalSymbol`. This function will now be called from 'src/link.zig' as well. Finally, this also enables compiling zig's libc using LLVM even though the `fno-LLVM` flag is given.
2022-06-11stage2: make `error{}` the same size as `anyerror`Veikka Tuominen
Having `error{}` be a zero bit type causes issues when it interracts with empty inferred error sets which are the same size as `anyerror`.
2022-06-07x64: remove outdated TODO commentJakub Konka
2022-06-07x64: pull common codepath between store and genSetStack into a helperJakub Konka
2022-06-07x64: clean up store helperJakub Konka
2022-06-07x64: optimise element offset calculation if dealing with immediatesJakub Konka
If `index` MCValue is actually an immediate, we can calculate offset directly at "comptime" rather than at runtime.
2022-06-07x64: account for non-pow-two stores via register derefJakub Konka
In this case, we need to proceed rather carefully to avoid writing containing register width rather than the precise amount of bytes.
2022-06-07x64: simplify saving registers to stack in prologueJakub Konka
2022-06-06Merge pull request #11783 from ziglang/stage2-tryAndrew Kelley
introduce a "try" ZIR and AIR instruction
2022-06-06dwarf: fix incorrect type reloc for unionsJakub Konka
Split type relocs into two kinds: local and global. Global relocs use a global type resolver and calculate offset to the existing definition of a type abbreviation. Local relocs use offset in the abbrev section of the containing atom plus addend to generate a local relocation.
2022-06-05x64: lower try and try_ptrJakub Konka
2022-06-05stage2: implement the new "try" ZIR/AIR instructionAndrew Kelley
Implements semantic analysis for the new try/try_inline ZIR instruction. Adds the new try/try_ptr AIR instructions and implements them for the LLVM backend. Fixes not calling rvalue() for tryExpr in AstGen. This is part of an effort to implement #11772.
2022-05-27math: make `cast` return optional instead of an errorAli Chraghi
2022-05-25x64: use new condition codes enum for register with overflow mcvJakub Konka