This commit is contained in:
Torsten Ruger 2018-03-14 17:39:49 +05:30
parent 6fe13fc2b7
commit 79b4b07ac4
3 changed files with 8 additions and 7 deletions

View File

@ -6,8 +6,8 @@ module Risc
# #
# Getter has a # Getter has a
# - an array where the data comes from # - an array where the data comes from
# - and (array) index # - an (array) index
# - Risc that the data is moved to # - Register that the data is moved to
# Getter and Setter api follow the pattern from -> to # Getter and Setter api follow the pattern from -> to
@ -17,7 +17,7 @@ module Risc
# the instruction would do register = array[index] # the instruction would do register = array[index]
# The arguments are in the order that makes sense for the Instruction name # The arguments are in the order that makes sense for the Instruction name
# So SlotToReg means the slot (array and index) moves to the register (last argument) # So SlotToReg means the slot (array and index) moves to the register (last argument)
def initialize source , array , index , register def initialize( source , array , index , register )
super(source) super(source)
@array = array @array = array
@index = index @index = index

View File

@ -16,8 +16,8 @@ module Risc
# Produce a RegToSlot instruction. # Produce a RegToSlot instruction.
# From and to are registers or symbols that can be transformed to a register by resolve_to_register # From and to are registers or symbols that can be transformed to a register by resolve_to_register
# index resolves with resolve_to_index. # index resolves with resolve_to_index.
def self.reg_to_slot source , from , to , index def self.reg_to_slot( source , from_reg , to , index )
from = resolve_to_register from from = resolve_to_register from_reg
index = resolve_to_index( to , index) index = resolve_to_index( to , index)
to = resolve_to_register to to = resolve_to_register to
RegToSlot.new( source, from , to , index) RegToSlot.new( source, from , to , index)

View File

@ -14,8 +14,9 @@ module Risc
# If you had a c array and index offset # If you had a c array and index offset
# the instruction would do array[index] = register # the instruction would do array[index] = register
# So Setter means the register (first argument) moves to the slot (array and index) # The arguments are in the order that makes sense for the Instruction name
def initialize source , register , array , index # So RegToSlot means the register (first argument) moves to the slot (array and index)
def initialize( source , register , array , index )
super(source) super(source)
@register = register @register = register
@array = array @array = array