module List = ListLabels
module Temp = Tiger_temp
+module T = Tiger_tree
type access =
| InFrame of {offset_from_frame_pointer : int}
; instructions : unit (* TODO: instructions for view shift *)
}
+let pointer = Temp.Temp.gen ()
+
let word_size_bits = 32
let word_size_bytes = word_size_bits / 8
let word_size = word_size_bytes
; locals_count
; instructions = () (* TODO: instructions for view shift *)
}
+
+(*failwith ("NOT IMPLEMENTED: " ^ __MODULE__ ^ ".exp")*)
+
+let exp ~access ~pointer =
+ match access with
+ | InReg {register} ->
+ T.TEMP register
+ | InFrame {offset_from_frame_pointer} ->
+ T.MEM (T.BINOP (T.PLUS, pointer, T.CONST offset_from_frame_pointer))