Lib.FunctionData module

This file defines the base class FunctionData, containing metadata on a RiscV function, as well as utility functions common to the different intermediate representations.

class Lib.FunctionData.FunctionData(name: str)[source]

Bases: object

Stores some metadata on a RiscV function: name of the function, label names, temporary variables (using Lib.Operands.TemporaryPool), and div_by_zero label.

This class is usually used indirectly through the different intermediate representations we work with, such as Lib.LinearCode.LinearCode.fdata.

get_name() str[source]

Return the name of the function.

fresh_tmp() Temporary[source]

Return a new fresh Temporary, which is added to the pool.

fresh_offset() Offset[source]

Return a new offset in the memory stack. Offsets are decreasing relative to FP.

get_offset() int[source]

Return the current offset in the memory stack.

fresh_label(name) Label[source]

Return a new label, with a unique name based on the given string.

get_label_div_by_zero() Label[source]