class Stacklang::Function::Memory

Overview

Represent a memory location as an offset to an address stored in a register or a variable. It can also be specified that this memory is mapped to a (temporary or restricted) variable. This allows use of cached values. That memory can be used as a source or a destination.

Defined in:

stacklang/compiler/function/function.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(reference_register : Stacklang::Function::Registers | Stacklang::Function::Variable, value : Int32, within_var : Nil | Stacklang::Function::Variable) #

[View source]

Class Method Detail

def self.absolute(register : Registers | Variable) #

Create an absolute memory location relative to any register.


[View source]
def self.offset(value : Int32, var : Variable | Nil = nil) #

Create a memory that is an offset to the stack. Used to create memory for variable.


[View source]

Instance Method Detail

def reference_register : Registers | Variable #

the register containing the address. Or a variable If the address is stored in a variable. For exemple, if it is r0 then this is an absolute address, if it r7 it likely a variable.


[View source]
def reference_register! #

Helper method to use when you KNOW that the register is not held in a temporary value.


[View source]
def reference_register=(reference_register : Registers | Variable) #

the register containing the address. Or a variable If the address is stored in a variable. For exemple, if it is r0 then this is an absolute address, if it r7 it likely a variable.


[View source]
def used_registers : Array(Registers) #

Return a list of registers that this memory is using


[View source]
def value : Int32 #

An offset to the reference register


[View source]
def value=(value : Int32) #

An offset to the reference register


[View source]
def within_var : Variable | Nil #

[View source]