2014-10-05 00:05:18 +02:00
|
|
|
module Arm
|
|
|
|
|
|
|
|
class ConstantImplementation
|
|
|
|
def run block
|
|
|
|
block.codes.dup.each do |code|
|
|
|
|
next unless code.is_a? Register::LoadConstant
|
2015-06-25 15:31:09 +02:00
|
|
|
load = ArmMachine.ldr( code.register , code.constant )
|
2014-10-05 00:05:18 +02:00
|
|
|
block.replace(code , load )
|
2015-05-30 10:56:47 +02:00
|
|
|
#puts "replaced #{load.inspect.to_s[0..1000]}"
|
2014-10-05 00:05:18 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2015-06-01 07:40:17 +02:00
|
|
|
Virtual.machine.add_pass "Arm::ConstantImplementation"
|
2014-10-05 00:05:18 +02:00
|
|
|
end
|