libFirm 1.20
|
Change control flow. More...
Typedefs | |
typedef struct ir_switch_table | ir_switch_table |
A switch table mapping integer numbers to proj-numbers of a Switch-node. | |
Enumerations | |
enum | n_Switch { n_Switch_selector, n_Switch_max = n_Switch_selector } |
Input numbers for Switch node. More... | |
enum | pn_Switch { pn_Switch_default, pn_Switch_max = pn_Switch_default } |
Projection numbers for result of Switch node (use for Proj nodes) More... | |
Functions | |
ir_switch_table * | ir_new_switch_table (ir_graph *irg, size_t n_entries) |
Creates a new switch_table datastructure with n_entries entries. | |
size_t | ir_switch_table_get_n_entries (const ir_switch_table *table) |
Returns number of entries available in switch table table . | |
void | ir_switch_table_set (ir_switch_table *table, size_t entry, ir_tarval *min, ir_tarval *max, long pn) |
Sets entry number entry in the switch table table . | |
ir_tarval * | ir_switch_table_get_max (const ir_switch_table *table, size_t entry) |
Returns maximum tarval value of switch table entry entry . | |
ir_tarval * | ir_switch_table_get_min (const ir_switch_table *table, size_t entry) |
Returns minimum tarval value of switch table entry entry . | |
long | ir_switch_table_get_pn (const ir_switch_table *table, size_t entry) |
Returns proj number taken if switch table entry entry matches. | |
ir_switch_table * | ir_switch_table_duplicate (ir_graph *irg, const ir_switch_table *table) |
Duplicates switch table table on obstack of irg . | |
ir_node * | new_rd_Switch (dbg_info *dbgi, ir_node *block, ir_node *irn_selector, unsigned n_outs, ir_switch_table *table) |
Construct a Switch node. | |
ir_node * | new_r_Switch (ir_node *block, ir_node *irn_selector, unsigned n_outs, ir_switch_table *table) |
Construct a Switch node. | |
ir_node * | new_d_Switch (dbg_info *dbgi, ir_node *irn_selector, unsigned n_outs, ir_switch_table *table) |
Construct a Switch node. | |
ir_node * | new_Switch (ir_node *irn_selector, unsigned n_outs, ir_switch_table *table) |
Construct a Switch node. | |
int | is_Switch (const ir_node *node) |
Test if node is a Switch. | |
ir_node * | get_Switch_selector (const ir_node *node) |
Returns selector input of a Switch node. | |
void | set_Switch_selector (ir_node *node, ir_node *selector) |
Sets selector input of a Switch node. | |
unsigned | get_Switch_n_outs (const ir_node *node) |
Returns n_outs attribute of a Switch node. | |
void | set_Switch_n_outs (ir_node *node, unsigned n_outs) |
Sets n_outs attribute of a Switch node. | |
ir_switch_table * | get_Switch_table (const ir_node *node) |
Returns table attribute of a Switch node. | |
void | set_Switch_table (ir_node *node, ir_switch_table *table) |
Sets table attribute of a Switch node. | |
ir_op * | get_op_Switch (void) |
Returns opcode for Switch nodes. | |
Variables | |
ir_op * | op_Switch |
Switch opcode. |
Change control flow.
The destination is choosen based on an integer input value which is looked up in a table.
Backends can implement this efficiently using a jump table.
typedef struct ir_switch_table ir_switch_table |
A switch table mapping integer numbers to proj-numbers of a Switch-node.
Entries map a continuous range of integer numbers to a proj-number. There must never be two different entries matching the same integer number.
Definition at line 133 of file firm_types.h.
enum pn_Switch |
ir_op* get_op_Switch | ( | void | ) |
Returns opcode for Switch nodes.
unsigned get_Switch_n_outs | ( | const ir_node * | node | ) |
Returns n_outs attribute of a Switch node.
ir_switch_table* get_Switch_table | ( | const ir_node * | node | ) |
Returns table attribute of a Switch node.
ir_switch_table* ir_new_switch_table | ( | ir_graph * | irg, |
size_t | n_entries | ||
) |
Creates a new switch_table datastructure with n_entries
entries.
The datastructure is allocated on the obstack of irg
.
ir_switch_table* ir_switch_table_duplicate | ( | ir_graph * | irg, |
const ir_switch_table * | table | ||
) |
Duplicates switch table table
on obstack of irg
.
ir_tarval* ir_switch_table_get_max | ( | const ir_switch_table * | table, |
size_t | entry | ||
) |
Returns maximum tarval value of switch table entry entry
.
ir_tarval* ir_switch_table_get_min | ( | const ir_switch_table * | table, |
size_t | entry | ||
) |
Returns minimum tarval value of switch table entry entry
.
size_t ir_switch_table_get_n_entries | ( | const ir_switch_table * | table | ) |
Returns number of entries available in switch table table
.
long ir_switch_table_get_pn | ( | const ir_switch_table * | table, |
size_t | entry | ||
) |
Returns proj number taken if switch table entry entry
matches.
void ir_switch_table_set | ( | ir_switch_table * | table, |
size_t | entry, | ||
ir_tarval * | min, | ||
ir_tarval * | max, | ||
long | pn | ||
) |
Sets entry number entry
in the switch table table
.
table | the switch table |
entry | entry number to set |
min | The minimum tarval that matches this entry |
max | The maximum tarval that matches this entry |
pn | Proj number taken on match |
int is_Switch | ( | const ir_node * | node | ) |
Test if node is a Switch.
ir_node* new_d_Switch | ( | dbg_info * | dbgi, |
ir_node * | irn_selector, | ||
unsigned | n_outs, | ||
ir_switch_table * | table | ||
) |
Construct a Switch node.
dbgi | A pointer to debug information. |
irn_selector | input selector |
n_outs | number of outputs (including pn_Switch_default) |
table | table describing mapping from input values to Proj numbers |
ir_node* new_r_Switch | ( | ir_node * | block, |
ir_node * | irn_selector, | ||
unsigned | n_outs, | ||
ir_switch_table * | table | ||
) |
Construct a Switch node.
block | The IR block the node belongs to. |
irn_selector | input selector |
n_outs | number of outputs (including pn_Switch_default) |
table | table describing mapping from input values to Proj numbers |
ir_node* new_rd_Switch | ( | dbg_info * | dbgi, |
ir_node * | block, | ||
ir_node * | irn_selector, | ||
unsigned | n_outs, | ||
ir_switch_table * | table | ||
) |
Construct a Switch node.
dbgi | A pointer to debug information. |
block | The IR block the node belongs to. |
irn_selector | input selector |
n_outs | number of outputs (including pn_Switch_default) |
table | table describing mapping from input values to Proj numbers |
ir_node* new_Switch | ( | ir_node * | irn_selector, |
unsigned | n_outs, | ||
ir_switch_table * | table | ||
) |
Construct a Switch node.
irn_selector | input selector |
n_outs | number of outputs (including pn_Switch_default) |
table | table describing mapping from input values to Proj numbers |
void set_Switch_n_outs | ( | ir_node * | node, |
unsigned | n_outs | ||
) |
Sets n_outs attribute of a Switch node.
Sets selector input of a Switch node.
void set_Switch_table | ( | ir_node * | node, |
ir_switch_table * | table | ||
) |
Sets table attribute of a Switch node.