basic liveliness for allocator
This commit is contained in:
@ -26,6 +26,13 @@ module Risc
|
||||
def test_platform
|
||||
assert_equal Arm::ArmPlatform , @allocator.platform.class
|
||||
end
|
||||
def test_allocate_runs
|
||||
assert @allocator.allocate_regs
|
||||
end
|
||||
def test_live
|
||||
live = @allocator.determine_liveness
|
||||
assert_equal 0 , live.length
|
||||
end
|
||||
def test_add_ok
|
||||
assert_equal RegisterValue, @allocator.use_reg(tmp_reg).class
|
||||
end
|
||||
|
22
test/risc/test_standard_allocator1.rb
Normal file
22
test/risc/test_standard_allocator1.rb
Normal file
@ -0,0 +1,22 @@
|
||||
require_relative "../helper"
|
||||
|
||||
module Risc
|
||||
class TestStandardAllocator1 < MiniTest::Test
|
||||
include SlotMachineCompile
|
||||
def setup
|
||||
coll = compile_slot( "class Space ; def main(); main{return 'Ho'};return 'Hi'; end; end;")
|
||||
@compiler = coll.to_risc.method_compilers
|
||||
@allocator = Platform.for(:arm).allocator(@compiler)
|
||||
end
|
||||
def test_main
|
||||
assert_equal :main , @compiler.callable.name
|
||||
end
|
||||
def test_allocate_runs
|
||||
assert @allocator.allocate_regs
|
||||
end
|
||||
def test_live_length
|
||||
live = @allocator.determine_liveness
|
||||
assert_equal 10 , live.length
|
||||
end
|
||||
end
|
||||
end
|
@ -4,7 +4,7 @@ module ScopeHelper
|
||||
|
||||
def compiler_with_main(options = {})
|
||||
compiler = RubyX::RubyXCompiler.new(RubyX.default_test_options.merge(options))
|
||||
compiler.ruby_to_sol( in_Space( as_main("return")) )
|
||||
compiler.ruby_to_sol( as_main("return 5") )
|
||||
compiler
|
||||
end
|
||||
def in_Test(statements)
|
||||
|
Reference in New Issue
Block a user