2017-04-10 10:47:18 +02:00
|
|
|
module Mom
|
|
|
|
|
|
|
|
# Base class for MOM instructions
|
2018-03-19 16:49:46 +01:00
|
|
|
# At the base class level instructions are a linked list.
|
|
|
|
#
|
|
|
|
# Mom::Instructions are created by the Vool level as an intermediate step
|
|
|
|
# towards the next level down, the Risc level.
|
|
|
|
# Mom and Risc are both abstract machines (ie have instructions), so both
|
|
|
|
# share the linked list functionality (In Common::List)
|
|
|
|
#
|
|
|
|
# To convert a Mom instruction to it's Risc equivalent to_risc is called
|
|
|
|
#
|
2017-04-10 10:47:18 +02:00
|
|
|
class Instruction
|
2017-09-08 12:10:22 +02:00
|
|
|
include Common::List
|
2017-09-04 20:00:08 +02:00
|
|
|
|
2018-03-19 16:49:46 +01:00
|
|
|
# to_risc, like the name says, converts the instruction to it's Risc equivalent.
|
|
|
|
# The Risc machine is basically a simple register machine (kind of arm).
|
|
|
|
# In other words Mom is the higher abstraction and so mom instructions convert
|
|
|
|
# to many (1-10) risc instructions
|
|
|
|
#
|
|
|
|
# The argument that is passed is a MethodCompiler, which has the method and some
|
|
|
|
# state about registers used. (also provides helpers to generate risc instructions)
|
2018-03-13 11:46:06 +01:00
|
|
|
def to_risc(compiler)
|
2018-03-20 17:35:09 +01:00
|
|
|
raise self.class.name + "_todo"
|
2018-03-13 11:46:06 +01:00
|
|
|
end
|
2017-08-30 16:21:13 +02:00
|
|
|
end
|
2018-03-19 16:49:46 +01:00
|
|
|
|
2017-04-10 10:47:18 +02:00
|
|
|
end
|
2017-04-12 10:53:02 +02:00
|
|
|
|
2018-03-19 16:49:46 +01:00
|
|
|
require_relative "label"
|
|
|
|
require_relative "check"
|
2018-03-13 08:00:51 +01:00
|
|
|
require_relative "basic_values"
|
2017-04-15 19:58:39 +02:00
|
|
|
require_relative "simple_call"
|
2017-09-14 15:07:02 +02:00
|
|
|
require_relative "dynamic_call"
|
2017-08-30 16:21:13 +02:00
|
|
|
require_relative "truth_check"
|
2017-09-14 15:07:02 +02:00
|
|
|
require_relative "not_same_check"
|
2017-08-30 16:21:13 +02:00
|
|
|
require_relative "jump"
|
2017-04-12 10:53:02 +02:00
|
|
|
require_relative "slot_load"
|
2017-04-14 20:01:50 +02:00
|
|
|
require_relative "return_sequence"
|
2017-09-11 13:22:33 +02:00
|
|
|
require_relative "message_setup"
|
|
|
|
require_relative "argument_transfer"
|