Class: AArch64::Instructions::ADR

Inherits:
Instruction show all
Defined in:
lib/aarch64/instructions/adr.rb

Overview

ADR – A64 Form PC-relative address ADR <Xd>, <label>

Instance Method Summary collapse

Constructor Details

#initialize(xd, label) ⇒ ADR

Returns a new instance of ADR.



7
8
9
10
# File 'lib/aarch64/instructions/adr.rb', line 7

def initialize xd, label
  @xd    = check_mask(xd, 0x1f)
  @label = label
end

Instance Method Details

#encode(position) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/aarch64/instructions/adr.rb', line 12

def encode position
  label = if @label.immediate?
            @label.unwrap_label
          else
            unwrap_label(@label, position) * 4
          end
  ADR(label & 0x3, check_mask(label >> 2, 0x7ffff), @xd)
end