libmya 0.1.0
Library to parse Mya language.
|
#include "types/mir.h"
Go to the source code of this file.
Functions | |
void | mir_init (mir_t *mir) |
Initializes a MIR struct. | |
void | mir_close (mir_t *mir) |
Closes the given MIR instruction. | |
mir_bitfield_t * | mir_add_bitfield (mir_t *mir, const char *name, uint32_t size) |
Add a new bitfield declaration. | |
mir_bitfield_t * | mir_get_bitfield (mir_t *mir, const char *name) |
Get the bitfield declaration with the given name. | |
mir_bitfield_field_t * | mir_bitfield_add_field (mir_bitfield_t *bitfield, const char *name, uint32_t size) |
Add a new field to a bitfield declaration. | |
mir_bitfield_field_t * | mir_bitfield_get_field (mir_bitfield_t *bitfield, const char *name) |
Get the field with the given name from the bitfield declaration. | |
void | mir_bitfield_close (mir_bitfield_t *bitfield) |
Closes the given bitfield. | |
mir_register_t * | mir_add_register (mir_t *mir, const char *name, uint32_t size) |
Add a new register declaration for the specified MIR. | |
mir_register_t * | mir_get_register (mir_t *mir, const char *name) |
Get a register declaration from the specified MIR. | |
void | mir_register_close (mir_register_t *reg) |
Closes the given register. | |
mir_inst_t * | mir_add_instruction (mir_t *mir, const char *name, uint32_t size) |
Add a new instruction declaration to MIR. | |
mir_inst_t * | mir_get_instruction (mir_t *mir, const char *name) |
Get an instruction declaration. | |
mir_inst_param_t * | mir_instruction_add_param (mir_inst_t *inst, const char *name, mir_type_t type, uint32_t size) |
Add a new parameter specification to an instruction. | |
mir_inst_param_t * | mir_instruction_get_param (mir_inst_t *inst, const char *name) |
Get a parameter from an instruction declaration. | |
mir_bitfield_spec_t * | mir_instruction_add_field (mir_inst_t *inst, const char *name, mir_bitfield_spec_type_t type) |
Add a new body field to the given instruction. | |
mir_bitfield_spec_t * | mir_instruction_get_field (mir_inst_t *inst, const char *name) |
Get the body field from the instruction. | |
void | mir_instruction_close (mir_inst_t *inst) |
Closes the given instruction. | |
mir_bitfield_spec_t * | mir_bitfield_spec_add_field (mir_bitfield_spec_t *spec, const char *name, mir_bitfield_spec_type_t type) |
Add a new bitfield spec's field to the given bitfield spec. | |
mir_bitfield_spec_t * | mir_bitfield_spec_set_spec (mir_bitfield_spec_t *spec, const char *name, mir_bitfield_spec_type_t type) |
Set the bitfield spec's sub bitfield spec. | |
mir_bitfield_spec_t * | mir_bitfield_spec_get_field (mir_bitfield_spec_t *spec, const char *name) |
Get a bitfield spec's field from the given bitfield spec. | |
void | mir_bitfield_spec_close (mir_bitfield_spec_t *spec) |
Closes the given bitfield spec. | |
mir_bitfield_t * mir_add_bitfield | ( | mir_t * | mir, |
const char * | name, | ||
uint32_t | size ) |
Add a new bitfield declaration.
mir | The MIR where the bitfield will be added. |
name | The name of the bitfield. |
size | The size in bits of the bitfield. |
Definition at line 58 of file mir.c.
mir_inst_t * mir_add_instruction | ( | mir_t * | mir, |
const char * | name, | ||
uint32_t | size ) |
Add a new instruction declaration to MIR.
mir | The MIR where to add the instruction. |
name | Name of the instruction. |
size | The size in bits of the instruction. |
Definition at line 181 of file mir.c.
mir_register_t * mir_add_register | ( | mir_t * | mir, |
const char * | name, | ||
uint32_t | size ) |
Add a new register declaration for the specified MIR.
mir | The MIR where do add the register declaration. |
name | The name of the register. |
size | The size in bits of the register. |
Definition at line 136 of file mir.c.
mir_bitfield_field_t * mir_bitfield_add_field | ( | mir_bitfield_t * | bitfield, |
const char * | name, | ||
uint32_t | size ) |
Add a new field to a bitfield declaration.
bitfield | The bitfield declaration. |
name | Name of the field. |
size | Size in bits of the field. |
Definition at line 94 of file mir.c.
void mir_bitfield_close | ( | mir_bitfield_t * | bitfield | ) |
mir_bitfield_field_t * mir_bitfield_get_field | ( | mir_bitfield_t * | bitfield, |
const char * | name ) |
Get the field with the given name from the bitfield declaration.
bitfield | The bitfield declaration. |
name | Name of the field. |
Definition at line 112 of file mir.c.
mir_bitfield_spec_t * mir_bitfield_spec_add_field | ( | mir_bitfield_spec_t * | spec, |
const char * | name, | ||
mir_bitfield_spec_type_t | type ) |
Add a new bitfield spec's field to the given bitfield spec.
It's used on bitfield specs with fields. Example: Opcode { a = 1, b = 2, }
Where Opcode { ... }
itself is a bitfield spec, and a = 1
and b = 2
are bitfield specs too.
spec | The bitfield spec where to add the field spec. |
name | Name of the field. |
type | Type of the field. |
Definition at line 304 of file mir.c.
void mir_bitfield_spec_close | ( | mir_bitfield_spec_t * | spec | ) |
mir_bitfield_spec_t * mir_bitfield_spec_get_field | ( | mir_bitfield_spec_t * | spec, |
const char * | name ) |
mir_bitfield_spec_t * mir_bitfield_spec_set_spec | ( | mir_bitfield_spec_t * | spec, |
const char * | name, | ||
mir_bitfield_spec_type_t | type ) |
Set the bitfield spec's sub bitfield spec.
This function is used to set types FT_SPEC, when the bitfield spec value is another bitfield spec. Example: a = Reg{2}
When a = Reg{2}
itself is a bitfield spec, and Reg{2}
is it's value (another bitfield spec).
spec | The bitfield spec where to set the sub bitfield spec. |
name | Name of the sub bitfield spec. |
type | Type of the sub bitfield spec. |
void mir_close | ( | mir_t * | mir | ) |
Closes the given MIR instruction.
mir | The struct to be closed. |
Definition at line 30 of file mir.c.
mir_bitfield_t * mir_get_bitfield | ( | mir_t * | mir, |
const char * | name ) |
Get the bitfield declaration with the given name.
mir | The MIR where to get the bitfield. |
name | Name of the bitifield. |
Definition at line 82 of file mir.c.
mir_inst_t * mir_get_instruction | ( | mir_t * | mir, |
const char * | name ) |
mir_register_t * mir_get_register | ( | mir_t * | mir, |
const char * | name ) |
Get a register declaration from the specified MIR.
mir | The MIR where to get the register declaration. |
name | The name of the register. |
Definition at line 162 of file mir.c.
void mir_init | ( | mir_t * | mir | ) |
Initializes a MIR struct.
mir | The struct to be initialized. |
Definition at line 9 of file mir.c.
mir_bitfield_spec_t * mir_instruction_add_field | ( | mir_inst_t * | inst, |
const char * | name, | ||
mir_bitfield_spec_type_t | type ) |
Add a new body field to the given instruction.
inst | The instruction where to add the field. |
name | Name of the field. |
type | Type of the field. |
Definition at line 251 of file mir.c.
mir_inst_param_t * mir_instruction_add_param | ( | mir_inst_t * | inst, |
const char * | name, | ||
mir_type_t | type, | ||
uint32_t | size ) |
Add a new parameter specification to an instruction.
inst | The instruction where to add the parameter. |
name | Name of the paramameter. |
type | Type of the parameter. |
size | Size in bits of the parameter. |
Definition at line 220 of file mir.c.
void mir_instruction_close | ( | mir_inst_t * | inst | ) |
Closes the given instruction.
inst | Instruction to be closed. |
Definition at line 285 of file mir.c.
mir_bitfield_spec_t * mir_instruction_get_field | ( | mir_inst_t * | inst, |
const char * | name ) |
mir_inst_param_t * mir_instruction_get_param | ( | mir_inst_t * | inst, |
const char * | name ) |
void mir_register_close | ( | mir_register_t * | reg | ) |
Closes the given register.
reg | The register to be closed. |