about summary refs log tree commit diff stats
path: root/subx/034compute_segment_address.cc
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-09-21 10:06:17 -0700
committerKartik Agaram <vc@akkartik.com>2018-09-21 10:06:17 -0700
commit8998908e63c1231ac8b83232623ab8c6d77fe9d1 (patch)
tree5e29cc09207b1b6369738244c7c413add13d7c08 /subx/034compute_segment_address.cc
parent0b58cf9b158874f320bb7d5707dc7758ad88dea8 (diff)
downloadmu-8998908e63c1231ac8b83232623ab8c6d77fe9d1.tar.gz
4565
Diffstat (limited to 'subx/034compute_segment_address.cc')
-rw-r--r--subx/034compute_segment_address.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/subx/034compute_segment_address.cc b/subx/034compute_segment_address.cc
index 0c569c65..f5f383b6 100644
--- a/subx/034compute_segment_address.cc
+++ b/subx/034compute_segment_address.cc
@@ -54,3 +54,18 @@ uint32_t num_bytes(const line& inst) {
   }
   return sum;
 }
+
+//: Dependencies:
+//: - We'd like to compute segment addresses before setting up global variables,
+//:   because computing addresses for global variables requires knowing where
+//:   the data segment starts.
+//: - We'd like to finish expanding labels before computing segment addresses,
+//:   because it would make computing the sizes of segments more self-contained
+//:   (num_bytes).
+//:
+//: Decision: compute segment addresses before expanding labels, by being
+//: aware in this layer of certain operand types that will eventually occupy
+//: multiple bytes.
+//:
+//: The layer to expand labels later hooks into num_bytes() to teach this
+//: layer that labels occupy zero space in the binary.