about summary refs log tree commit diff stats
path: root/mu_instructions
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-02-27 16:58:16 -0800
committerKartik Agaram <vc@akkartik.com>2020-02-27 17:03:00 -0800
commit8b85a07f977f374d8d76831c1cb9c93796772094 (patch)
tree221766aaf51814d12572015d3619a957e8badb53 /mu_instructions
parenta9151143f3d7c276e3c87b79b00378d509942d33 (diff)
downloadmu-8b85a07f977f374d8d76831c1cb9c93796772094.tar.gz
6059
Diffstat (limited to 'mu_instructions')
-rw-r--r--mu_instructions8
1 files changed, 8 insertions, 0 deletions
diff --git a/mu_instructions b/mu_instructions
index 017527b9..941401dc 100644
--- a/mu_instructions
+++ b/mu_instructions
@@ -215,4 +215,12 @@ var/reg <- index arr/rega: (addr array T), n
 compare var, n              {.name="compare",         .inouts=[var, n],                 .subx-name="81 7/subop/compare",    .rm32="*(ebp+" inouts[0].stack-offset ")",                      .imm32=inouts[1]}
                             {.name="index",           .inouts=[rega, n], .outputs=[reg], .subx-name="8d/copy-address",      .rm32="*(" inouts[0] "+" inouts[1] "<<2)",  .r32=outputs[0]}
 
+User-defined types
+
+If a record (product) type T was defined to have elements a, b, c, ... of
+types T_a, T_b, T_c, ..., then accessing one of those elements f of type T_f:
+
+var/reg: (addr T_f) <- get var2/reg2: (addr F), f: field name => 8d/copy-addr *(reg2+offset(f))
+                            {.name="get",             .inouts=[reg2, f],                .subx-name="8d/copy-addr",          .rm32="*(" inouts[0] "+" offset(f) ")",     .r32=outputs[0]}
+
 vim:ft=c:nowrap