libFirm
|
This module specifies the opcodes for ir nodes. More...
Typedefs | |
typedef struct ir_op | ir_op |
Node Opcode. More... | |
typedef void(* | op_func) (void) |
A generic function pointer type. More... | |
typedef unsigned(* | hash_func) (const ir_node *self) |
The hash operation. More... | |
typedef ir_tarval *(* | computed_value_func) (const ir_node *self) |
The compute value operation. More... | |
typedef ir_node *(* | equivalent_node_func) (ir_node *self) |
The equivalent node operation. More... | |
typedef ir_node *(* | transform_node_func) (ir_node *self) |
The transform node operation. More... | |
typedef int(* | node_attrs_equal_func) (const ir_node *a, const ir_node *b) |
The node attribute compare operation. More... | |
typedef int(* | reassociate_func) (ir_node **n) |
The reassociation operation. More... | |
typedef void(* | copy_attr_func) (ir_graph *irg, const ir_node *old_node, ir_node *new_node) |
The copy attribute operation. More... | |
typedef ir_type *(* | get_type_attr_func) (const ir_node *self) |
The get_type_attr operation. More... | |
typedef ir_entity *(* | get_entity_attr_func) (const ir_node *self) |
The get_entity_attr operation. More... | |
typedef int(* | verify_node_func) (const ir_node *node) |
The verify_node operation. More... | |
typedef int(* | verify_proj_node_func) (const ir_node *proj) |
The verify_node operation for Proj(X). More... | |
typedef void(* | dump_node_func) (FILE *out, const ir_node *self, dump_reason_t reason) |
The dump_node operation. More... | |
Functions | |
const char * | get_op_name (const ir_op *op) |
Returns the string for the opcode. More... | |
unsigned | get_op_code (const ir_op *op) |
Returns the enum for the opcode. More... | |
const char * | get_op_pin_state_name (op_pin_state s) |
Returns a human readable name of an op_pin_state. More... | |
op_pin_state | get_op_pinned (const ir_op *op) |
Returns pinned state of an opcode. More... | |
unsigned | get_next_ir_opcode (void) |
Returns the next free IR opcode number, allows to register user ops. More... | |
unsigned | get_next_ir_opcodes (unsigned num) |
Returns the next free n IR opcode number, allows to register a bunch of user ops. More... | |
op_func | get_generic_function_ptr (const ir_op *op) |
Returns the generic function pointer from an IR operation. More... | |
void | set_generic_function_ptr (ir_op *op, op_func func) |
Stores a generic function pointer into an IR operation. More... | |
irop_flags | get_op_flags (const ir_op *op) |
Returns the irop flags of an IR opcode. More... | |
void | set_op_hash (ir_op *op, hash_func func) |
Sets hash callback func for operation op . More... | |
void | set_op_computed_value (ir_op *op, computed_value_func func) |
Sets computed_value callback func for operation op . More... | |
void | set_op_computed_value_proj (ir_op *op, computed_value_func func) |
Sets compute_value for Proj callback func for operation op . More... | |
void | set_op_equivalent_node (ir_op *op, equivalent_node_func func) |
Sets equivalent node callback func for operation op . More... | |
void | set_op_equivalent_node_proj (ir_op *op, equivalent_node_func func) |
Sets equivalent Proj node callback func for operation op . More... | |
void | set_op_transform_node (ir_op *op, transform_node_func func) |
Sets transform node callback func for operation op . More... | |
void | set_op_transform_node_proj (ir_op *op, transform_node_func func) |
Sets transform Proj node callback func for operation op . More... | |
void | set_op_attrs_equal (ir_op *op, node_attrs_equal_func func) |
Sets attrs_equal callback func for operation op . More... | |
void | set_op_reassociate (ir_op *op, reassociate_func func) |
Sets reassociation callback func for operation op . More... | |
void | set_op_copy_attr (ir_op *op, copy_attr_func func) |
Sets attribute copy callback func for operation op . More... | |
void | set_op_get_type_attr (ir_op *op, get_type_attr_func func) |
Sets get type callback func for operation op . More... | |
void | set_op_get_entity_attr (ir_op *op, get_entity_attr_func func) |
Sets get entity callback func for operation op . More... | |
void | set_op_verify (ir_op *op, verify_node_func func) |
Sets verify callback func for operation op . More... | |
void | set_op_verify_proj (ir_op *op, verify_proj_node_func func) |
Sets proj verify callback func for operation op . More... | |
void | set_op_dump (ir_op *op, dump_node_func func) |
Sets dump callback func for operation op . More... | |
ir_op * | new_ir_op (unsigned code, const char *name, op_pin_state p, irop_flags flags, op_arity opar, int op_index, size_t attr_size) |
Creates a new IR operation. More... | |
void | free_ir_op (ir_op *code) |
Frees an ir operation. More... | |
unsigned | ir_get_n_opcodes (void) |
Returns one more than the highest opcode code in use. More... | |
ir_op * | ir_get_opcode (unsigned code) |
Returns the opcode with code code . More... | |
void | ir_clear_opcodes_generic_func (void) |
Sets the generic function pointer of all opcodes to NULL. More... | |
void | ir_op_set_memory_index (ir_op *op, int memory_index) |
Sets memory input of operation using memory. More... | |
void | ir_op_set_fragile_indices (ir_op *op, unsigned pn_x_regular, unsigned pn_x_except) |
Sets proj-number for X_regular and X_except projs of fragile nodes. More... | |
This module specifies the opcodes for ir nodes.
Each node has an associated opcode. An opcode specifies basic attributes and properties of a node.
The compute value operation.
If a node is known to always produce a specific value, this value is returned, if it is known to always throw an exception or produce undefined behaviour (like division by zero) tarval_bad is returned, otherwise tarval_unknown is returned.
typedef void(* dump_node_func) (FILE *out, const ir_node *self, dump_reason_t reason) |
The equivalent node operation.
This operation returns an equivalent node for the input node. It does not create new nodes. It is therefore safe to free self if the node returned is not self. If a node returns a Tuple we can not just skip it. If the size of the in array fits, we transform n into a tuple (e.g., possible for Div).
typedef unsigned(* hash_func) (const ir_node *self) |
Node Opcode.
Definition at line 56 of file firm_types.h.
typedef void(* op_func) (void) |
typedef int(* reassociate_func) (ir_node **n) |
The transform node operation.
This operation tries several [inplace] [optimizing] transformations and returns an equivalent node. The difference to equivalent_node() is that these transformations do generate new nodes, and thus the old node must not be freed even if the equivalent node isn't the old one.
typedef int(* verify_node_func) (const ir_node *node) |
typedef int(* verify_proj_node_func) (const ir_node *proj) |
enum dump_reason_t |
enum ir_opcode |
The opcodes of the libFirm predefined operations.
enum irop_flags |
The irop flags.
enum op_arity |
The allowed arities.
void free_ir_op | ( | ir_op * | code | ) |
Frees an ir operation.
Obviously nodes with this op mustn't exist at this point.
Referenced by set_typeconst_type().
Returns the generic function pointer from an IR operation.
unsigned get_next_ir_opcode | ( | void | ) |
Returns the next free IR opcode number, allows to register user ops.
unsigned get_next_ir_opcodes | ( | unsigned | num | ) |
Returns the next free n IR opcode number, allows to register a bunch of user ops.
unsigned get_op_code | ( | const ir_op * | op | ) |
Returns the enum for the opcode.
irop_flags get_op_flags | ( | const ir_op * | op | ) |
Returns the irop flags of an IR opcode.
const char* get_op_name | ( | const ir_op * | op | ) |
Returns the string for the opcode.
const char* get_op_pin_state_name | ( | op_pin_state | s | ) |
Returns a human readable name of an op_pin_state.
op_pin_state get_op_pinned | ( | const ir_op * | op | ) |
Returns pinned state of an opcode.
void ir_clear_opcodes_generic_func | ( | void | ) |
Sets the generic function pointer of all opcodes to NULL.
unsigned ir_get_n_opcodes | ( | void | ) |
Returns one more than the highest opcode code in use.
ir_op* ir_get_opcode | ( | unsigned | code | ) |
Returns the opcode with code code
.
code
has to be smaller than get_irp_n_opcode(), returns NULL if no opcode with the code exists.
void ir_op_set_fragile_indices | ( | ir_op * | op, |
unsigned | pn_x_regular, | ||
unsigned | pn_x_except | ||
) |
Sets proj-number for X_regular and X_except projs of fragile nodes.
Note: should only be used immediately after new_ir_op
Referenced by set_typeconst_type().
void ir_op_set_memory_index | ( | ir_op * | op, |
int | memory_index | ||
) |
Sets memory input of operation using memory.
Referenced by set_typeconst_type().
ir_op* new_ir_op | ( | unsigned | code, |
const char * | name, | ||
op_pin_state | p, | ||
irop_flags | flags, | ||
op_arity | opar, | ||
int | op_index, | ||
size_t | attr_size | ||
) |
Creates a new IR operation.
code | the opcode, one of type opcode |
name | the printable name of this opcode |
p | whether operations of this opcode are op_pin_state_pinned or floating |
flags | a bitmask of irop_flags describing the behavior of the IR operation |
opar | the parity of this IR operation |
op_index | if the parity is oparity_unary, oparity_binary or oparity_trinary the index of the left operand |
attr_size | attribute size for this IR operation |
This function can create all standard Firm opcode as well as new ones. The behavior of new opcode depends on the operations ops
and the flags
.
Referenced by set_typeconst_type().
Stores a generic function pointer into an IR operation.
void set_op_attrs_equal | ( | ir_op * | op, |
node_attrs_equal_func | func | ||
) |
Sets attrs_equal callback func
for operation op
.
void set_op_computed_value | ( | ir_op * | op, |
computed_value_func | func | ||
) |
Sets computed_value callback func
for operation op
.
void set_op_computed_value_proj | ( | ir_op * | op, |
computed_value_func | func | ||
) |
Sets compute_value for Proj callback func
for operation op
.
void set_op_copy_attr | ( | ir_op * | op, |
copy_attr_func | func | ||
) |
Sets attribute copy callback func
for operation op
.
void set_op_dump | ( | ir_op * | op, |
dump_node_func | func | ||
) |
Sets dump callback func
for operation op
.
void set_op_equivalent_node | ( | ir_op * | op, |
equivalent_node_func | func | ||
) |
Sets equivalent node callback func
for operation op
.
void set_op_equivalent_node_proj | ( | ir_op * | op, |
equivalent_node_func | func | ||
) |
Sets equivalent Proj node callback func
for operation op
.
void set_op_get_entity_attr | ( | ir_op * | op, |
get_entity_attr_func | func | ||
) |
Sets get entity callback func
for operation op
.
void set_op_get_type_attr | ( | ir_op * | op, |
get_type_attr_func | func | ||
) |
Sets get type callback func
for operation op
.
void set_op_reassociate | ( | ir_op * | op, |
reassociate_func | func | ||
) |
Sets reassociation callback func
for operation op
.
void set_op_transform_node | ( | ir_op * | op, |
transform_node_func | func | ||
) |
Sets transform node callback func
for operation op
.
void set_op_transform_node_proj | ( | ir_op * | op, |
transform_node_func | func | ||
) |
Sets transform Proj node callback func
for operation op
.
void set_op_verify | ( | ir_op * | op, |
verify_node_func | func | ||
) |
Sets verify callback func
for operation op
.
void set_op_verify_proj | ( | ir_op * | op, |
verify_proj_node_func | func | ||
) |
Sets proj verify callback func
for operation op
.