rubyx/lib/register/instructions/load_constant.rb

20 lines
476 B
Ruby
Raw Normal View History

module Register
# load a constant into a register
#
# first is the actual constant, either immediate register or object reference (from the space)
# second argument is the register the constant is loaded into
class LoadConstant < Instruction
def initialize constant , register
@register = register
@constant = constant
end
attr_accessor :register , :constant
2015-07-24 12:23:56 +02:00
def to_s
2015-07-25 08:30:58 +02:00
"LoadConstant: #{register} <- #{constant}"
2015-07-24 12:23:56 +02:00
end
end
end