Class: YTLJit::OpIndirect

Inherits:
Operand show all
Defined in:
lib/ytljit/instruction.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reg, disp = 0) ⇒ OpIndirect

Returns a new instance of OpIndirect.



123
124
125
126
127
128
129
# File 'lib/ytljit/instruction.rb', line 123

def initialize(reg, disp = 0)
  @reg = reg
  if disp.is_a?(Fixnum) then
    disp = OpImmidiate.new(disp)
  end
  @disp = disp
end

Instance Attribute Details

#dispObject (readonly)

Returns the value of attribute disp.



132
133
134
# File 'lib/ytljit/instruction.rb', line 132

def disp
  @disp
end

#regObject (readonly)

Returns the value of attribute reg.



131
132
133
# File 'lib/ytljit/instruction.rb', line 131

def reg
  @reg
end

Instance Method Details

#reg_noObject



147
148
149
# File 'lib/ytljit/instruction.rb', line 147

def reg_no
  @reg.reg_no
end

#to_asObject



135
136
137
138
139
140
141
# File 'lib/ytljit/instruction.rb', line 135

def to_as
  if @disp.is_a?(OpImmidiate) then
    "#{@disp.value}(#{@reg.to_as})"
  else
    "#{@disp.value}(#{@reg.to_as})"
  end
end

#using(reg) ⇒ Object



143
144
145
# File 'lib/ytljit/instruction.rb', line 143

def using(reg)
   @reg == reg
end