starting on risc allocation
inserting allocator stage in method translation
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
require_relative "helper"
|
||||
require_relative "../helper"
|
||||
|
||||
module Risc
|
||||
class TestLinkerObjects < MiniTest::Test
|
||||
|
@ -1,4 +1,4 @@
|
||||
require_relative "helper"
|
||||
require_relative "../helper"
|
||||
|
||||
module Risc
|
||||
class TestMachinePos < MiniTest::Test
|
||||
|
@ -5,7 +5,7 @@ module Risc
|
||||
|
||||
def setup
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@allocator = Allocator.new
|
||||
@allocator = Allocator.new(Risc.test_compiler , Platform.for(:arm))
|
||||
end
|
||||
def tmp_reg
|
||||
Risc.tmp_reg(:Type)
|
||||
@ -16,6 +16,13 @@ module Risc
|
||||
def test_empty
|
||||
assert @allocator.regs_empty?
|
||||
end
|
||||
def test_compiler
|
||||
assert_equal CallableCompiler , @allocator.compiler.class
|
||||
assert_equal :fake_name , @allocator.compiler.callable.name
|
||||
end
|
||||
def test_platform
|
||||
assert_equal Arm::ArmPlatform , @allocator.platform.class
|
||||
end
|
||||
def test_add_ok
|
||||
assert_equal Array, @allocator.add_reg(tmp_reg).class
|
||||
end
|
||||
|
21
test/risc/test_callable_compiler1.rb
Normal file
21
test/risc/test_callable_compiler1.rb
Normal file
@ -0,0 +1,21 @@
|
||||
require_relative "../helper"
|
||||
|
||||
module Risc
|
||||
class TestCallableCompiler1 < MiniTest::Test
|
||||
include SolCompile
|
||||
|
||||
def setup
|
||||
@compiler = compile_main("return 5").to_risc
|
||||
@platform = Platform.for(:arm)
|
||||
end
|
||||
def test_init
|
||||
@compiler.risc_instructions.each do |ins|
|
||||
puts ins.to_s
|
||||
end
|
||||
end
|
||||
|
||||
def test_1
|
||||
@compiler.translate_method( @platform , [])
|
||||
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( "class Space;def main(arg);return;end;end" )
|
||||
compiler.ruby_to_sol( in_Space( as_main("return")) )
|
||||
compiler
|
||||
end
|
||||
def in_Test(statements)
|
||||
|
Reference in New Issue
Block a user