rubyx/lib/register/instructions/branch.rb

32 lines
445 B
Ruby
Raw Normal View History

module Register
# a branch must branch to a block.
class Branch < Instruction
2015-07-18 10:21:49 +02:00
def initialize source , to
super(source)
raise "No block" unless to
@block = to
end
2015-07-24 12:23:56 +02:00
attr_reader :block
2015-07-18 10:21:49 +02:00
def to_s
"#{self.class.name}: #{block.name}"
2015-07-18 10:21:49 +02:00
end
alias :inspect :to_s
end
class IsZero < Branch
end
class IsNotzero < Branch
end
class IsMinus < Branch
end
2015-07-18 10:21:49 +02:00
class IsPlus < Branch
end
2015-07-18 10:21:49 +02:00
end