Module DSL.Validated_mem_offset
A validated memory offset that is guaranteed to be encodable in ARM64 load/store immediate addressing modes. The validation ensures:
- The offset is in the 9-bit signed unscaled range: -256 to 255, OR
- The offset is non-negative, aligned to the scale, and in the 12-bit unsigned scaled range (max offset = 4095 * scale)
val create : scale:int -> offset:int -> t optionValidate an offset for use with load/store of the given scale (access size in bytes: 1, 2, 4, 8, or 16). Returns Some t if the offset can be encoded, None otherwise.
val to_operand :
base:[ `GP of [< `X | `SP ] ] Reg.t ->
t ->
[ `Mem of [> `Offset_twelve_unsigned_scaled | `Offset_nine_signed_unscaled ] ]
Operand.tConvert to a memory operand. Never fails since the offset was validated at construction time.
val offset : t -> intThe byte offset.
val scale : t -> intThe scale used for validation.
Check if an offset can be encoded for the given scale.
val probe_semaphore_offset : tPre-validated offset for probe semaphore access (2-byte at offset 2).