17#include <gyoji-misc/pointers.hpp>
18#include <gyoji-mir/types.hpp>
19#include <gyoji-mir/operations.hpp>
27 class SimpleStatement;
29 class OperationVisitor;
91 void dump(FILE *out)
const;
218 void dump(FILE *out)
const;
242 bool is_reachable()
const;
358 const Type *_return_type,
443 void dump(FILE *out)
const;
486 const Operation * tmpvar_get_operation(
size_t tmpvar)
const;
537 const Type *return_type;
551 class OperationVisitor {
565 size_t operation_index,
References a location in the source-file.
Definition source-reference.hpp:30
Basic block of a function.
Definition functions.hpp:118
const std::vector< Gyoji::owned< Operation > > & get_operations() const
Access to list of Operation of basic block.
Definition functions.cpp:296
bool contains_terminator() const
Definition functions.cpp:300
void add_operation(Gyoji::owned< Operation > operation)
Add an Operation to the block.
Definition functions.cpp:281
BasicBlock()
Create a new basic block.
Definition functions.cpp:274
void add_reachable_from(size_t other_block)
Definition functions.cpp:328
size_t size() const
Return the number of operations in this block.
Definition functions.cpp:332
~BasicBlock()
Move along, nothing to see here.
Definition functions.cpp:277
void dump(FILE *out) const
Dump block to file handle.
Definition functions.cpp:287
void insert_operation(size_t position, Gyoji::owned< Operation > operation)
Insert operations at a specific point.
Definition functions.cpp:336
std::vector< size_t > get_connections() const
Definition functions.cpp:309
const std::vector< size_t > & get_reachable_from() const
Definition functions.cpp:324
A single named argument to a function.
Definition functions.hpp:264
const std::string & get_name() const
Name of the argument.
Definition functions.cpp:368
~FunctionArgument()
Move along, nothing to see here.
Definition functions.cpp:364
const Type * get_type() const
Type of the argument.
Definition functions.cpp:372
Function inside a translation unit.
Definition functions.hpp:342
size_t add_block()
Creates a new basic block and returns the ID.
Definition functions.cpp:122
void dump(FILE *out) const
Dump a function to the given file handle for debugging.
Definition functions.cpp:247
bool is_unsafe() const
Definition functions.cpp:88
const Type * get_return_type() const
Return type of the function.
Definition functions.cpp:76
const Type * tmpvar_get(size_t tmpvar_id) const
Temporary values used by opcodes.
Definition functions.cpp:135
void calculate_block_reachability()
Definition functions.cpp:161
const Gyoji::context::SourceReference & get_source_ref() const
Reference to the source location where the function is defined.
Definition functions.cpp:84
size_t tmpvar_duplicate(size_t tmpvar_id)
Duplicate a temporary variable/reigster.
Definition functions.cpp:155
const BasicBlock & get_basic_block(size_t blockid) const
Get an immutable basic block from the function by ID.
Definition functions.cpp:92
size_t tmpvar_define(const Type *tmpvar_type)
Define a new temporary variable with the given type.
Definition functions.cpp:149
const std::string & get_name() const
Name of the function.
Definition functions.cpp:72
const std::map< size_t, Gyoji::owned< BasicBlock > > & get_blocks() const
Get the blocks of the function.
Definition functions.cpp:131
void iterate_operations(OperationVisitor &visitor) const
Definition functions.cpp:229
const std::vector< FunctionArgument > & get_arguments() const
Arguments to the function.
Definition functions.cpp:80
Container for functions.
Definition functions.hpp:39
Functions()
Construct an empty function table.
Definition functions.cpp:24
void dump(FILE *out) const
Dump the function table to a file handle.
Definition functions.cpp:42
const std::vector< Gyoji::owned< Function > > & get_functions() const
Returns the list of functions defined.
Definition functions.cpp:38
void add_function(Gyoji::owned< Function > _function)
Add a function to the MIR.
Definition functions.cpp:32
~Functions()
Move along, nothing to see here.
Definition functions.cpp:28
Operations inside basic blocks, the virtual instruction-set of the MIR.
Definition operations.hpp:67
This represents a type as declared in a translation unit.
Definition types.hpp:313
Middle intermediate representation (MIR) of a translation unit.
Definition gyoji-mir.hpp:51