fix unconditional jump
and affected tests
This commit is contained in:
@ -21,7 +21,7 @@ module Mom
|
||||
# The argument that is passed is a MethodCompiler, which has the method and some
|
||||
# state about registers used. (also provides helpers to generate risc instructions)
|
||||
def to_risc(compiler)
|
||||
raise Risc::Label.new(self.class.name, self.class.name + "_todo")
|
||||
raise self.class.name + "_todo"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
module Mom
|
||||
|
||||
# unconditional jump to the instruction given as target
|
||||
# Unconditional jump to the Label given as target
|
||||
# Eg used at the end of while or end of if_true branch
|
||||
#
|
||||
# Risc equivalent is the same really, called Unconditional there.
|
||||
#
|
||||
class Jump < Instruction
|
||||
attr_reader :target
|
||||
@ -8,8 +11,8 @@ module Mom
|
||||
def initialize(target)
|
||||
@target = target
|
||||
end
|
||||
def to_risc(context)
|
||||
Risc::Label.new(self,"Jump")
|
||||
def to_risc(compiler)
|
||||
Risc::Unconditional.new(self , @target.to_risc(compiler))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -60,6 +60,11 @@ module Risc
|
||||
super(source , label)
|
||||
end
|
||||
end
|
||||
|
||||
class Unconditional < Branch
|
||||
|
||||
end
|
||||
|
||||
class IsZero < Branch
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user