| Age | Commit message (Collapse) | Author |
|
|
|
stage2 x86_64: encoding helpers, fix bugs
|
|
allocated registers
|
|
|
|
Co-authored-by: joachimschmidt557 <joachim.schmidt557@outlook.com>
|
|
Co-authored-by: joachimschmidt557 <joachim.schmidt557@outlook.com>
|
|
Co-authored-by: joachimschmidt557 <joachim.schmidt557@outlook.com>
|
|
|
|
|
|
|
|
This was also an experiment to see if it were easier to implement a new
feature when using the instruction encoder.
Verdict: It's not that much easier, but I think it's certainly much more
readable, because the description of the Instruction annotates what each
field means. Right now, precise knowledge of x86_64 instructions is
still required because things like when to set the 64-bit flag, how to
read x86_64 instruction references, etc. are still not automatically
done for you.
In the future, this interface might make it sligtly easier to write an
assembler for x86_64, by abstracting the bit-fiddling aspects of
instruction encoding.
|
|
From my very cursory reading, it seems that the register manager doesn't
distinguish between registers that are physically the same but have
different sizes.
In that case, this means that during codegen, we can't rely on
`reg.size()` when determining the width of the operations we have to
perform. Instead, we must use some form of `ty.abiSize(self.target.*)`
to determine the size of the type we're operating with. If this size is
64 bits, then we should enable 64-bit operation.
This fixed a bug in the codegen for spilling instructions, which was
overwriting the previous stack entry with zeroes. See the modified test
case in this commit.
|
|
There are parts of it that I didn't modify because the byte
representation was important (e.g. we need to know what the exact
byte position where we store the address into the offset table is)
|
|
|
|
|
|
stage2: blaze the trail for std lib integration
|
|
Also fix "previous definition here" error notes to be correct.
|
|
stage2 wasm: Add division and bitwise/boolean ops &, |, ^, and, or
|
|
|
|
|
|
|
|
|
|
|
|
|
|
New ZIR instructions:
* struct_decl_packed
* struct_decl_extern
New TZIR instruction: struct_field_ptr
Introduce `Module.Struct`. It uses `Value` to store default values and
abi alignments.
Implemented Sema.analyzeStructFieldPtr and zirStructDecl.
Some stuff I changed from `@panic("TODO")` to `log.warn("TODO")`.
It's becoming more clear that we need the lazy value mechanism soon;
Type is becoming unruly, and some of these functions have too much logic
given that they don't have any context for memory management or error
reporting.
|
|
rework ZIR memory layout; overhaul source locations
|
|
|
|
preserved register
|
|
|
|
|
|
|
|
(with a lot of things commented out)
|
|
There are some `@panic("TODO")` in there but I'm trying to get the
branch to the point where collaborators can jump in.
Next is to repair the seam between LazySrcLoc and codegen's expected
absolute file offsets.
|
|
I need the enum arrays that were just merged into master.
|
|
Next up is reworking the seam between the LazySrcLoc emitted by Sema
and the byte offsets currently expected by codegen.
And then the big one: updating astgen.zig to use the new memory layout.
|
|
|
|
|
|
Stage2 cbe: optionals and errors
|
|
|
|
|
|
|
|
* add error_union value tag.
* add analyzeIsErr
* add Value.isError
* add TZIR wrap_errunion_payload and wrap_errunion_err for
wrapping from T -> E!T and E -> E!T
* add anlyzeInstUnwrapErrCode and analyzeInstUnwrapErr
* add analyzeInstEnsureErrPayloadVoid:
* add wrapErrorUnion
* add comptime error comparison for tests
* tests!
|
|
Add a new allocated_registers bitmap to keep track of all callee-saved
registers allocated during generation of this function.
Function(.arm).gen uses this data to generate instructions in the
function prologue and epilogue to push and pop these registers
respectively.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Previously, this would reuse an operand even if reuseOperand returned
false for both operands.
genArmBinOpCode was also changed to be more Three-address code oriented
in the process.
|