Gyoji Compiler
|
The middle-tier intermediate representation (MIR) of a translation unit. More...
#include <gyoji-mir.hpp>
Public Member Functions | |
const Types & | get_types () const |
Immutable type container. | |
Types & | get_types () |
Mutable type container. | |
const Symbols & | get_symbols () const |
Immutable symbol table. | |
Symbols & | get_symbols () |
const Functions & | get_functions () const |
Immutable function table. | |
Functions & | get_functions () |
Mutable function table. | |
void | dump (FILE *out) const |
Dump MIR for debugging. | |
The middle-tier intermediate representation (MIR) of a translation unit.
The MIR class represents the semantic information about everything expressed in a single translation-unit. The main actors are Types, Symbols, anf Functions. The Types represent data stored in a variable, or identifier. The Symbols represent global variables and functions that will ultimately wind up in the symbol table of the generated binary file. The Functions represent the callable entities and contain the blocks and operations it will perform including primitive operations, flow-control instructions, variable declarations, and things that happen inside functions.
void MIR::dump | ( | FILE * | out | ) | const |
Dump MIR for debugging.
This method is a debugging helper to assist in vizualizing the MIR so we can examine it as we work on other layers like the analysis and code-generation phases.
The following gives a minimal example of what is contained in the MIR dump. This gives a sense of the information available to the analysis and code-generation stages.
Functions & MIR::get_functions | ( | ) |
Mutable function table.
This method returns a mutable reference to the functions themselves.
This is intended for use in constructing the MIR and should not be used after the front-end stage has finished parsing.
const Functions & MIR::get_functions | ( | ) | const |
Symbols & MIR::get_symbols | ( | ) |
This method returns a mutable reference to the symbol table.
This is intended for use in constructing the MIR and should not be used after the front-end stage has finished parsing.
const Symbols & MIR::get_symbols | ( | ) | const |
Types & MIR::get_types | ( | ) |
Mutable type container.
This method returns a mutable reference to the container of types. This is intended for use in constructing the MIR and should not be used after the front-end stage has finished parsing.
const Types & MIR::get_types | ( | ) | const |