1fd937927c
IsXXX with xxx as condition, same as after if_xxx AlwaysBranch is back to Branch
32 lines
445 B
Ruby
32 lines
445 B
Ruby
module Register
|
|
|
|
|
|
# a branch must branch to a block.
|
|
class Branch < Instruction
|
|
def initialize source , to
|
|
super(source)
|
|
raise "No block" unless to
|
|
@block = to
|
|
end
|
|
attr_reader :block
|
|
|
|
def to_s
|
|
"#{self.class.name}: #{block.name}"
|
|
end
|
|
alias :inspect :to_s
|
|
end
|
|
|
|
class IsZero < Branch
|
|
end
|
|
|
|
class IsNotzero < Branch
|
|
end
|
|
|
|
class IsMinus < Branch
|
|
end
|
|
|
|
class IsPlus < Branch
|
|
end
|
|
|
|
end
|