Lib.LinearCode module¶
CAP, CodeGeneration, LinearCode API Classes for a RiscV linear code.
- class Lib.LinearCode.LinearCode(name: str)[source]¶
Bases:
objectRepresentation of a RiscV program as a list of instructions.
add_statement()is repeatedly called in the codegen visitor to build a complete list of RiscV instructions for the source program.The
fdatamember variable contains some meta-information on the program, for instance to allocate a new temporary. SeeLib.FunctionData.FunctionData.For debugging purposes,
print_code()allows to print the RiscV program to a file.- fdata: FunctionData¶
- add_statement(i: Comment | Label | Instru3A | AbsoluteJump | ConditionalJump) None[source]¶
Utility function to add an instruction in the program.
See also
Lib.RiscVto generate relevant instructions.
- iter_statements(f) None[source]¶
Iterate over instructions. For each real instruction i (not label or comment), replace it with the list of instructions given by f(i).
- get_instructions() List[Comment | Label | Instru3A | AbsoluteJump | ConditionalJump][source]¶
Return the list of instructions of the program.
- add_instruction_PRINTLN_INT(reg: DataLocation) None[source]¶
Print integer value, with newline. (see Expand)