Skip to content
  • Kevin Newton's avatar
    848037ca
    Better offsets (#6315) · 848037ca
    Kevin Newton authored
    * Introduce InstructionOffset for AArch64
    
    There are a lot of instructions on AArch64 where we take an offset
    from PC in terms of the number of instructions. This is for loading
    a value relative to the PC or for jumping.
    
    We were usually accepting an A64Opnd or an i32. It can get
    confusing and inconsistent though because sometimes you would
    divide by 4 to get the number of instructions or multiply by 4 to
    get the number of bytes.
    
    This commit adds a struct that wraps an i32 in order to keep all of
    that logic in one place. It makes it much easier to read and reason
    about how these offsets are getting used.
    
    * Use b instruction when the offset fits on AArch64
    848037ca
    Better offsets (#6315)
    Kevin Newton authored
    * Introduce InstructionOffset for AArch64
    
    There are a lot of instructions on AArch64 where we take an offset
    from PC in terms of the number of instructions. This is for loading
    a value relative to the PC or for jumping.
    
    We were usually accepting an A64Opnd or an i32. It can get
    confusing and inconsistent though because sometimes you would
    divide by 4 to get the number of instructions or multiply by 4 to
    get the number of bytes.
    
    This commit adds a struct that wraps an i32 in order to keep all of
    that logic in one place. It makes it much easier to read and reason
    about how these offsets are getting used.
    
    * Use b instruction when the offset fits on AArch64
Loading