make operator_instruction single ass

create result register automatically
usually not used, but register allocation will sort that
This commit is contained in:
2020-03-14 12:22:37 +02:00
parent 1378745907
commit 61fc8a3991
4 changed files with 43 additions and 9 deletions

View File

@ -0,0 +1,23 @@
require_relative "../helper"
module Risc
class TestOperatorInstruction < MiniTest::Test
def setup
Parfait.boot!({})
@left = RegisterValue.new(:left , :Integer)
@right = RegisterValue.new(:right , :Integer)
end
def risc(i)
@left.op :- , @right
end
def test_min
assert_operator 1 , :- , :left , :right , "op_-_"
end
def test_reg
result = risc(1).result
assert_equal RegisterValue , result.class
assert_equal "Integer_Type" , result.type.name
assert result.symbol.to_s.start_with?("op_-_")
end
end
end