aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authorLuuk de Gram <luuk@degram.dev>2021-11-18 21:33:10 +0100
committerLuuk de Gram <luuk@degram.dev>2021-11-21 21:07:55 +0100
commitb2221e564490421265f9e3b2e398a89bbdfb0516 (patch)
treeddf654e63898ff97c88afa4c3c5201b6b2101f8f /src/Compilation.zig
parent261f13414b6bafbe075ce5066964b36a3a5b5e16 (diff)
downloadzig-b2221e564490421265f9e3b2e398a89bbdfb0516.tar.gz
zig-b2221e564490421265f9e3b2e398a89bbdfb0516.zip
wasm: Implement structs stored on the stack
By calculating the abi size of the struct, we move the stack pointer and store each field depending on its size (i.e. a 1-byte field will use i32.store8). This commit adds all required opcodes to perform those stores and loads. This also gets rid of `mir_offset` as we now save results of binary operations into locals and emit its result onto the stack within condbr instead. This makes everything a lot simpler but also more robust. In the future, we could look into an algorithm to re-use such locals. For struct fields we use the new `local_with_offset` tag. This stores the struct's stack pointer as well as the field's offset from that stack pointer. `allocLocal` will now always allocate a single local, using a given type.
Diffstat (limited to 'src/Compilation.zig')
0 files changed, 0 insertions, 0 deletions