summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCamil Staps2016-12-01 17:22:47 +0100
committerCamil Staps2016-12-01 17:22:47 +0100
commit37f49468c80731584735fdb46ab4039c3e680b87 (patch)
treee62c8d92d66693a6fedafc7c04d2ff02c73192a9
parentlog (diff)
log
-rw-r--r--log.md32
1 files changed, 32 insertions, 0 deletions
diff --git a/log.md b/log.md
index a91fe61..a1d957e 100644
--- a/log.md
+++ b/log.md
@@ -548,3 +548,35 @@ Made some changes to the garbage collector:
```clean
Start = (length xs, hd xs) where xs = fromto 1 100
```
+
+### 2016-12-01
+
+About the negative offsets: this was finally fixed in cg `2245229` (the commits
+before that attempted to fix it as well). It is done by checking the minimum
+(largest negative) offset to the A-stack pointer, and subtracting this at the
+start of a basic block if it is lower than -255.
+
+Then there was an issue with indirect addressing with `[rn],#x` and `[rn,#x]!`,
+where `x` can only be 8 bits in ARM. These offsets are generated at the end of
+a basic block, when the A-stack pointer will be updated, to combine the last
+load with the add/subtract of that update. We can now only make this
+optimisation if the offset is reasonably large.
+
+Concretely, the following offsets can be used (this only applies to not-SP
+registers):
+
+| `[rn,#x]` | `[rn],#x` | `[rn,#x]!` |
+|:----------------------------------------------------------:|:--------------------:|:--------------------:|
+| -255 ≤ x ≤ 4095 (32-bit); 0 ≤ x ≤ 124 (16-bit) | -255 ≤ x ≤ 255 | -255 ≤ x ≤ 255 |
+
+Then there is a new **problem**, relating to constants: instructions like
+`cmp r4,#2147483647` (generated for `frontend/analtypes`) are not allowed
+because `2147483647=0x7fffffff` cannot be captured in one of the (relatively
+many) different immediate constant encodings for Thumb-2 (A5.3.2 of ARMv7-M).
+This is **fixed** quite easily in cg `a355a7a`, by checking if the constant can
+be immediate or not.
+
+And then there was a **problem** in `backend/backend`, where the instruction
+`add sp,r8,#4` is generated. This is not allowed due to special treatment of
+`sp` (A5.1.3 of ARMv7-M). The **solution** is to store the result temporarily
+in the scratch register (cg `7c22910`).