remove some boiler
This commit is contained in:
parent
fba66371c0
commit
493b02674c
@ -19,14 +19,6 @@ module Register
|
|||||||
def opcode
|
def opcode
|
||||||
@attributes[:opcode]
|
@attributes[:opcode]
|
||||||
end
|
end
|
||||||
#abstract, only should be called from derived
|
|
||||||
def to_s
|
|
||||||
atts = @attributes.dup
|
|
||||||
atts.delete(:opcode)
|
|
||||||
atts.delete(:update_status)
|
|
||||||
atts.delete(:condition_code) if atts[:condition_code] == :al
|
|
||||||
atts.empty? ? "" : ", #{atts}"
|
|
||||||
end
|
|
||||||
# returns an array of registers (RegisterReferences) that this instruction uses.
|
# returns an array of registers (RegisterReferences) that this instruction uses.
|
||||||
# ie for r1 = r2 + r3
|
# ie for r1 = r2 + r3
|
||||||
# which in assembler is add r1 , r2 , r3
|
# which in assembler is add r1 , r2 , r3
|
||||||
@ -122,9 +114,6 @@ module Register
|
|||||||
def assigns
|
def assigns
|
||||||
[@result.register]
|
[@result.register]
|
||||||
end
|
end
|
||||||
def to_s
|
|
||||||
"#{opcode} #{result.to_asm} , #{left.to_asm} , #{right.to_asm} #{super}"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
class CompareInstruction < Instruction
|
class CompareInstruction < Instruction
|
||||||
def initialize left , right , options = {}
|
def initialize left , right , options = {}
|
||||||
@ -158,9 +147,6 @@ module Register
|
|||||||
def assigns
|
def assigns
|
||||||
[@to.register]
|
[@to.register]
|
||||||
end
|
end
|
||||||
def to_s
|
|
||||||
"#{opcode} #{@to.to_asm} , #{@from.to_asm} #{super}"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
class CallInstruction < Instruction
|
class CallInstruction < Instruction
|
||||||
def initialize first , options = {}
|
def initialize first , options = {}
|
||||||
|
@ -40,6 +40,9 @@ module Virtual
|
|||||||
def inspect
|
def inspect
|
||||||
Sof::Writer.write(self)
|
Sof::Writer.write(self)
|
||||||
end
|
end
|
||||||
|
def to_s
|
||||||
|
inspect
|
||||||
|
end
|
||||||
def mem_length
|
def mem_length
|
||||||
raise "abstract #{self}"
|
raise "abstract #{self}"
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user