FIRM_API void set_Block_extbb(ir_node *block, ir_extblk *extblk);
/** Returns the ir_graph this Block belongs to. */
FIRM_API ir_graph *get_Block_irg(const ir_node *block);
-/** Returns non-zero if the block has an entity assigned */
-FIRM_API int has_Block_entity(const ir_node *block);
-/** Returns the entity for a Block */
-FIRM_API ir_entity *get_Block_entity(const ir_node *block);
/** Returns the entity for a Block (creating it if necessary) */
FIRM_API ir_entity *create_Block_entity(ir_node *block);
-/** Set a new entity for a block */
-FIRM_API void set_Block_entity(ir_node *block, ir_entity *entity);
/** Gets the head of the Phi list for this block. */
FIRM_API ir_node *get_Block_phis(const ir_node *block);
/** Sets the head of the Phi list for this block. */
void be_gas_emit_block_name(const ir_node *block)
{
- if (has_Block_entity(block)) {
+ if (get_Block_entity(block) != NULL) {
ir_entity *entity = get_Block_entity(block);
be_gas_emit_entity(entity);
} else {
assert(succ_block == NULL);
succ_block = get_edge_src_irn(edge);
- if (has_Block_entity(succ_block) && has_Block_entity(block)) {
+ if (get_Block_entity(succ_block) != NULL
+ && get_Block_entity(block) != NULL) {
/*
* Currently we can add only one label for a block.
* Therefore we cannot combine them if both block already have one.
set_irn_n(succ_block, pos, pred);
}
- if (has_Block_entity(block)) {
+ if (get_Block_entity(block) != NULL) {
/* move the label to the successor block */
ir_entity *entity = get_Block_entity(block);
set_Block_entity(succ_block, entity);
int need_label = 1;
int n_cfgpreds = get_Block_n_cfgpreds(block);
- if (has_Block_entity(block))
+ if (get_Block_entity(block) != NULL)
return 1;
if (n_cfgpreds == 0) {
{
int n_cfgpreds;
- if (has_Block_entity(block))
+ if (get_Block_entity(block) != NULL)
return true;
n_cfgpreds = get_Block_n_cfgpreds(block);
/* Source types */
switch (get_irn_opcode(n)) {
case iro_Block: {
- if (has_Block_entity(n))
+ if (get_Block_entity(n) != NULL)
fprintf(F, " Label: %lu\n", get_entity_label(get_Block_entity(n)));
fprintf(F, " block visited: %lu\n", get_Block_block_visited(n));
fprintf(F, " block marked: %u\n", get_Block_mark(n));
return entity;
}
-ir_entity *get_Block_entity(const ir_node *block)
-{
- assert(is_Block(block));
- return block->attr.block.entity;
-}
-
-void set_Block_entity(ir_node *block, ir_entity *entity)
-{
- assert(is_Block(block));
- assert(get_entity_type(entity) == get_code_type());
- block->attr.block.entity = entity;
-}
-
-int has_Block_entity(const ir_node *block)
-{
- return block->attr.block.entity != NULL;
-}
-
ir_node *(get_Block_phis)(const ir_node *block)
{
return get_Block_phis_(block);
switch (code) {
case iro_SymConst: ops->get_entity_attr = get_SymConst_attr_entity; break;
case iro_Sel: ops->get_entity_attr = get_Sel_entity; break;
+ case iro_Block: ops->get_entity_attr = get_Block_entity; break;
default:
/* not allowed to be NULL */
if (! ops->get_entity_attr)
ir_node *block = get_nodes_block(n);
add_Block_phi(block, n);
} else if (is_Block(n)) {
- if (has_Block_entity(n)) {
+ if (get_Block_entity(n) != NULL) {
/* block with a jump label attached cannot be removed. */
set_Block_removable(n, false);
}
int i;
ir_node *block = node->node;
- if (block == get_irg_start_block(current_ir_graph) || has_Block_entity(block)) {
+ if (block == get_irg_start_block(current_ir_graph) || get_Block_entity(block) != NULL) {
/* start block and labelled blocks are always reachable */
node->type.tv = tarval_reachable;
return;
*/
static int can_exchange(ir_node *pred, ir_node *block)
{
- if (is_Start(pred) || has_Block_entity(block))
+ if (is_Start(pred) || get_Block_entity(block) != NULL)
return 0;
else if (is_Jmp(pred))
return 1;
/* check, that predecessors are Jmps */
n = get_Block_n_cfgpreds(retbl);
/* we cannot move above a labeled block, as this might kill the block */
- if (n <= 1 || has_Block_entity(retbl))
+ if (n <= 1 || get_Block_entity(retbl) != NULL)
return false;
for (i = 0; i < n; ++i) {
ir_node *pred = get_Block_cfgpred(retbl, i);
arity = "variable"
flags = [ "labeled" ]
attr_struct = "block_attr"
+ attrs = [
+ dict(
+ name = "entity",
+ type = "ir_entity*",
+ comment = "entity representing this block",
+ init = "NULL",
+ ),
+ ]
customSerializer = True
init = '''