remove some boiler

This commit is contained in:
Torsten Ruger 2014-09-30 12:08:12 +03:00
parent fba66371c0
commit 493b02674c
2 changed files with 3 additions and 14 deletions

View File

@ -19,14 +19,6 @@ module Register
def opcode
@attributes[:opcode]
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.
# ie for r1 = r2 + r3
# which in assembler is add r1 , r2 , r3
@ -122,9 +114,6 @@ module Register
def assigns
[@result.register]
end
def to_s
"#{opcode} #{result.to_asm} , #{left.to_asm} , #{right.to_asm} #{super}"
end
end
class CompareInstruction < Instruction
def initialize left , right , options = {}
@ -158,9 +147,6 @@ module Register
def assigns
[@to.register]
end
def to_s
"#{opcode} #{@to.to_asm} , #{@from.to_asm} #{super}"
end
end
class CallInstruction < Instruction
def initialize first , options = {}

View File

@ -40,6 +40,9 @@ module Virtual
def inspect
Sof::Writer.write(self)
end
def to_s
inspect
end
def mem_length
raise "abstract #{self}"
end