17#include <gyoji-misc/pointers.hpp>
18#include <gyoji-mir/types.hpp>
19#include <gyoji-context.hpp>
892 void dump(FILE *out,
size_t operation_index)
const;
977 bool get_readsfrom(
size_t tmpvar)
const;
978 bool get_writesto(
size_t tmpvar)
const;
998 bool contains(
size_t tmpvar)
const;
1036 size_t get_a()
const;
1069 const Type *_cast_type
1088 const Type *cast_type;
1127 size_t get_a()
const;
1131 size_t get_b()
const;
1154 size_t _object_to_call,
1163 size_t object_to_call;
1189 size_t _callee_tmpvar,
1262 size_t _array_tmpvar,
1263 size_t _index_tmpvar
1339 const Type * _var_type);
1348 const Type * get_var_type()
const;
1354 const Type * var_type;
1382 char get_literal_char()
const;
1386 const char literal_char;
1445 unsigned char _literal_u8
1457 unsigned short _literal_u16
1469 unsigned int _literal_u32
1481 unsigned long _literal_u64
1539 unsigned char get_literal_u8()
const;
1540 unsigned short get_literal_u16()
const;
1541 unsigned int get_literal_u32()
const;
1542 unsigned long get_literal_u64()
const;
1544 char get_literal_i8()
const;
1545 short get_literal_i16()
const;
1546 int get_literal_i32()
const;
1547 long get_literal_i64()
const;
1555 unsigned char literal_u8;
1556 unsigned short literal_u16;
1557 unsigned int literal_u32;
1558 unsigned long literal_u64;
1581 float _literal_float
1591 double _literal_float
1600 float get_literal_float()
const;
1601 double get_literal_double()
const;
1607 float literal_float_f32;
1608 double literal_float_f64;
1732 const Type * get_type()
const;
1772 size_t get_if_block()
const;
1773 size_t get_else_block()
const;
1810 size_t get_jump_block()
const;
1891 const Type *_variable_type
1913 const Type *variable_type;
1944 void operation_static_init();
References a location in the source-file.
Definition source-reference.hpp:30
This class represents an anonymous structure.
Definition operations.hpp:1694
virtual std::string get_description() const
Produce a description of the operation.
Definition operation.cpp:875
This subclass of OperationBinary represents indexing an array.
Definition operations.hpp:1249
virtual ~OperationArrayIndex()
Move along, nothing to see here.
Definition operation.cpp:378
This subclass of Operation represents a binary operation.
Definition operations.hpp:1101
size_t get_a() const
Access the first operand (a).
Definition operation.cpp:297
virtual ~OperationBinary()
Move along, nothing to see here.
Definition operation.cpp:294
size_t get_b() const
Access the second operand (b).
Definition operation.cpp:301
This subclass of OperationUnary represents a cast operation.
Definition operations.hpp:1054
virtual ~OperationCast()
Move along, nothing to see here.
Definition operation.cpp:261
virtual std::string get_description() const
Produce a description of the operation.
Definition operation.cpp:269
const Type * get_cast_type() const
Get type being cast/converted to.
Definition operation.cpp:265
This subclass of Operation is used to access member variables of classes and other aggregate types by...
Definition operations.hpp:1285
virtual ~OperationDot()
Move along, nothing to see here.
Definition operation.cpp:394
virtual std::string get_description() const
Produce a description of the operation.
Definition operation.cpp:402
const std::string & get_member_name() const
Definition operation.cpp:398
Function call (invoke) operation.
Definition operations.hpp:1175
virtual ~OperationFunctionCall()
Move along, nothing to see here.
Definition operation.cpp:322
Method call (invoke) preparation.
Definition operations.hpp:1149
virtual std::string get_description() const
Produce a description of the operation.
This operation represents a conditional jump.
Definition operations.hpp:1757
virtual std::string get_description() const
Produce a description of the operation.
Definition operation.cpp:911
virtual ~OperationJumpConditional()
Move along, nothing to see here.
Definition operation.cpp:907
Unconditional Jump.
Definition operations.hpp:1797
virtual ~OperationJump()
Move along, nothing to see here.
Definition operation.cpp:940
virtual std::string get_description() const
Produce a description of the operation.
Definition operation.cpp:944
Literal bool.
Definition operations.hpp:1620
bool get_literal_bool() const
Definition operation.cpp:819
virtual ~OperationLiteralBool()
Move along, nothing to see here.
Definition operation.cpp:816
virtual std::string get_description() const
Produce a description of the operation.
Definition operation.cpp:822
Literal character.
Definition operations.hpp:1364
virtual ~OperationLiteralChar()
Move along, nothing to see here.
Definition operation.cpp:462
virtual std::string get_description() const
Produce a description of the operation.
Definition operation.cpp:470
Literal float.
Definition operations.hpp:1571
virtual ~OperationLiteralFloat()
Move along, nothing to see here.
Definition operation.cpp:766
virtual std::string get_description() const
Produce a description of the operation.
Definition operation.cpp:781
Literal integer.
Definition operations.hpp:1433
virtual ~OperationLiteralInt()
Move along, nothing to see here.
Definition operation.cpp:659
virtual std::string get_description() const
Produce a description of the operation.
Definition operation.cpp:691
Literal null.
Definition operations.hpp:1657
virtual std::string get_description() const
Produce a description of the operation.
Definition operation.cpp:843
virtual ~OperationLiteralNull()
Move along, nothing to see here.
Definition operation.cpp:840
Literal string.
Definition operations.hpp:1395
virtual std::string get_description() const
Produce a description of the operation.
Definition operation.cpp:504
virtual ~OperationLiteralString()
Move along, nothing to see here.
Definition operation.cpp:496
Declare a local variable in scope.
Definition operations.hpp:1886
virtual std::string get_description() const
Produce a description of the operation.
Definition operation.cpp:1023
const Type * get_variable_type() const
Definition operation.cpp:1019
const std::string & get_variable() const
Definition operation.cpp:1016
virtual ~OperationLocalDeclare()
Move along, nothing to see here.
Definition operation.cpp:1013
Un-declare a variable (remove it from scope)
Definition operations.hpp:1924
virtual ~OperationLocalUndeclare()
Move along, nothing to see here.
Definition operation.cpp:1045
virtual std::string get_description() const
Produce a description of the operation.
Definition operation.cpp:1049
Load a local variable.
Definition operations.hpp:1328
virtual std::string get_description() const
Produce a description of the operation.
Definition operation.cpp:439
virtual ~OperationLocalVariable()
Move along, nothing to see here.
Definition operation.cpp:427
Return from a function without a value.
Definition operations.hpp:1858
virtual ~OperationReturnVoid()
Move along, nothing to see here.
Definition operation.cpp:990
virtual std::string get_description() const
Produce a description of the operation.
Definition operation.cpp:994
Return from a function with a value.
Definition operations.hpp:1835
virtual ~OperationReturn()
Move along, nothing to see here.
Definition operation.cpp:967
virtual std::string get_description() const
Produce a description of the operation.
Definition operation.cpp:971
The operation for obtaining the storage size of a type.
Definition operations.hpp:1717
virtual ~OperationSizeofType()
Move along, nothing to see here.
Definition operation.cpp:1070
Symbol-table lookup.
Definition operations.hpp:1209
const std::string & get_symbol_name() const
Definition operation.cpp:346
virtual std::string get_description() const
Produce a description of the operation.
Definition operation.cpp:350
virtual ~OperationSymbol()
Move along, nothing to see here.
Definition operation.cpp:342
This subclass of Operation represents a unary operation.
Definition operations.hpp:1012
size_t get_a() const
Returns the operand of the unary operation.
Definition operation.cpp:246
virtual ~OperationUnary()
Move along, nothing to see here.
Definition operation.cpp:243
Operations inside basic blocks, the virtual instruction-set of the MIR.
Definition operations.hpp:67
void dump(FILE *out, size_t operation_index) const
Definition operation.cpp:225
virtual ~Operation()
Move along, nothing to see here.
Definition operation.cpp:154
bool is_terminating() const
Returns true if this is a terminating operation for a block.
Definition operation.cpp:178
OperationType get_type() const
Opcode of this operation.
Definition operation.cpp:209
const Gyoji::context::SourceReference & get_source_ref() const
Get the reference to the source which originated this operation.
Definition operation.cpp:221
virtual std::string get_description() const
Produce a description of the operation.
Definition operation.cpp:164
std::vector< size_t > get_connections() const
Returns the list of basic blocks we might connect to.
Definition operation.cpp:189
size_t get_result() const
Get the result of this operation.
Definition operation.cpp:217
void add_operand(size_t operand)
Add an operand.
Definition operation.cpp:158
OperationType
Operations of the MIR virtual-machine.
Definition operations.hpp:86
@ OP_DEREFERENCE
De-references the given pointer.
Definition operations.hpp:487
@ OP_LITERAL_STRING
Loads a string constant.
Definition operations.hpp:388
@ OP_ASSIGN
Assign value.
Definition operations.hpp:785
@ OP_BITWISE_AND
Bitwise AND.
Definition operations.hpp:646
@ OP_LOCAL_UNDECLARE
Undeclare local variable.
Definition operations.hpp:332
@ OP_NEGATE
Negates a signed integer.
Definition operations.hpp:495
@ OP_ADD
Arithmetic add.
Definition operations.hpp:540
@ OP_WIDEN_FLOAT
Widen a floating-point integer to wider type.
Definition operations.hpp:230
@ OP_LITERAL_CHAR
Loads a literal character constant.
Definition operations.hpp:369
@ OP_DESTRUCTOR
Call the destructor for a composite type.
Definition operations.hpp:121
@ OP_MODULO
Modulo.
Definition operations.hpp:611
@ OP_WIDEN_SIGNED
Widen a signed integer to a larger type.
Definition operations.hpp:182
@ OP_ADDRESSOF
Returns the address of the given variable.
Definition operations.hpp:471
@ OP_COMPARE_GREATER
Compare numbers for greater-than.
Definition operations.hpp:727
@ OP_ANONYMOUS_STRUCTURE
Anonymous structures.
Definition operations.hpp:450
@ OP_LITERAL_FLOAT
Loads an integer constant.
Definition operations.hpp:414
@ OP_WIDEN_UNSIGNED
Widen an unsigned integer to a larger type.
Definition operations.hpp:208
@ OP_ARRAY_INDEX
Access a value inside an array.
Definition operations.hpp:252
@ OP_BITWISE_XOR
Bitwise XOR.
Definition operations.hpp:673
@ OP_LOCAL_VARIABLE
Load value from variable.
Definition operations.hpp:355
@ OP_RETURN
Return from function.
Definition operations.hpp:822
@ OP_SUBTRACT
Arithmetic subtract.
Definition operations.hpp:556
@ OP_LOGICAL_NOT
This opcode performs a boolean NOT of the given operand.
Definition operations.hpp:513
@ OP_BITWISE_NOT
Performs a bitwise not on an unsigned integer.
Definition operations.hpp:505
@ OP_COMPARE_EQUAL
Compare numbers for equality.
Definition operations.hpp:771
@ OP_RETURN_VOID
Return from function without supplying a value.
Definition operations.hpp:831
@ OP_BITWISE_OR
Bitwise OR.
Definition operations.hpp:659
@ OP_SYMBOL
Load a symbol from the symbol-table.
Definition operations.hpp:153
@ OP_SIZEOF_TYPE
Returns the size of a specific type.
Definition operations.hpp:522
@ OP_SHIFT_RIGHT
Bitwise Shift Right.
Definition operations.hpp:703
@ OP_LITERAL_INT
Loads an integer constant.
Definition operations.hpp:401
@ OP_JUMP_CONDITIONAL
Conditional Jump.
Definition operations.hpp:800
@ OP_LITERAL_NULL
Loads a null pointer literal constant.
Definition operations.hpp:438
@ OP_COMPARE_LESS_EQUAL
Compare numbers for less-than or equal to.
Definition operations.hpp:738
@ OP_COMPARE_GREATER_EQUAL
Compare numbers for greater-than or equal to.
Definition operations.hpp:749
@ OP_LOCAL_DECLARE
Declare local variable.
Definition operations.hpp:307
@ OP_LOGICAL_AND
Logical AND.
Definition operations.hpp:622
@ OP_DOT
Access a value inside a class.
Definition operations.hpp:275
@ OP_SHIFT_LEFT
Bitwise Shift left.
Definition operations.hpp:688
@ OP_COMPARE_LESS
Compare numbers for less-than.
Definition operations.hpp:716
@ OP_FUNCTION_CALL
Function call.
Definition operations.hpp:111
@ OP_LITERAL_BOOL
Loads a boolean literal value.
Definition operations.hpp:425
@ OP_DIVIDE
Arithmetic multiply.
Definition operations.hpp:591
@ OP_LOGICAL_OR
Logical OR.
Definition operations.hpp:631
@ OP_MULTIPLY
Arithmetic multiply.
Definition operations.hpp:572
@ OP_COMPARE_NOT_EQUAL
Compare numbers for not equal-to.
Definition operations.hpp:760
@ OP_JUMP
Jump (Unconditional)
Definition operations.hpp:809
const std::vector< size_t > & get_operands() const
Get the operands.
Definition operation.cpp:213
This represents a type as declared in a translation unit.
Definition types.hpp:313
TypeType
Type of type.
Definition types.hpp:335
Middle intermediate representation (MIR) of a translation unit.
Definition gyoji-mir.hpp:51