Commit 136719e8 authored by Michael Beck's avatar Michael Beck
Browse files

add is_Global() and get_Global_ent()

[r19064]
parent e5489501
...@@ -1413,6 +1413,12 @@ cond_jmp_predicate get_Cond_jmp_pred(const ir_node *cond); ...@@ -1413,6 +1413,12 @@ cond_jmp_predicate get_Cond_jmp_pred(const ir_node *cond);
/** Sets a new conditional jump prediction. */ /** Sets a new conditional jump prediction. */
void set_Cond_jmp_pred(ir_node *cond, cond_jmp_predicate pred); void set_Cond_jmp_pred(ir_node *cond, cond_jmp_predicate pred);
/** Checks whether a node represents a global address. */
int is_Global(const ir_node *node);
/* Returns the entity of a global address. */
ir_entity *get_Global_ent(const ir_node *node);
/** /**
* Access custom node data. * Access custom node data.
* The data must have been registered with * The data must have been registered with
......
...@@ -3084,7 +3084,26 @@ dbg_info *(get_irn_dbg_info)(const ir_node *n) { ...@@ -3084,7 +3084,26 @@ dbg_info *(get_irn_dbg_info)(const ir_node *n) {
return _get_irn_dbg_info(n); return _get_irn_dbg_info(n);
} }
/* checks whether a node represents a global address */
int is_Global(const ir_node *node) {
ir_node *ptr;
if (is_SymConst_addr_ent(node))
return 1;
if (! is_Sel(node))
return 0;
ptr = get_Sel_ptr(node);
return is_globals_pointer(ptr) != NULL;
}
/* returns the entity of a global address */
ir_entity *get_Global_ent(const ir_node *node) {
if (is_SymConst(node))
return get_SymConst_entity(node);
else
return get_Sel_entity(node);
}
#ifdef DEBUG_libfirm #ifdef DEBUG_libfirm
void dump_irn(const ir_node *n) { void dump_irn(const ir_node *n) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment