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
# - an array where the data comes from
# - and (array) index
# - Risc that the data is moved to
# - an (array) index
# - Register that the data is moved to
# Getter and Setter api follow the pattern from -> to
@ -17,7 +17,7 @@ module Risc
# the instruction would do register = array[index]
# 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)
def initialize source , array , index , register
def initialize( source , array , index , register )
super(source)
@array = array
@index = index

View File

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

View File

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