about summary refs log tree commit diff stats
path: root/mu_instructions
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-08-25 22:17:19 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-08-25 22:19:24 -0700
commitc45371b319bb72b331f889f7340834c709e1f8a4 (patch)
tree6e226b9c757a2d22176930e26fc61fc50c17100b /mu_instructions
parent9b62454975ef7cd0ef21ed8edd113f8209f32c11 (diff)
downloadmu-c45371b319bb72b331f889f7340834c709e1f8a4.tar.gz
compute-offset: literal index
Diffstat (limited to 'mu_instructions')
-rw-r--r--mu_instructions2
1 files changed, 2 insertions, 0 deletions
diff --git a/mu_instructions b/mu_instructions
index 2dca40c4..4898f9a1 100644
--- a/mu_instructions
+++ b/mu_instructions
@@ -367,6 +367,8 @@ var/reg: (offset T) <- compute-offset arr: (addr array T), idx/regi: int  # arr
   => "69/multiply %" regi " " size-of(T) "/imm32 " reg "/r32"
 var/reg: (offset T) <- compute-offset arr: (addr array T), idx: int       # arr can be in reg or mem
   => "69/multiply *(ebp+" idx.stack-offset ") " size-of(T) "/imm32 " reg "/r32"
+var/reg: (offset T) <- compute-offset arr: (addr array T), n              # arr can be in reg or mem
+  => "c7 0/subop/copy %" reg " " n*size-of(T) "/imm32"
 var/reg: (addr T) <- index arr/rega: (addr array T), o/rego: (offset T)
   => "81 7/subop/compare %" rega " 0/imm32"
      "0f 84/jump-if-= __mu-abort-null-index-base-address/disp32"