/*
- * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved.
+ * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
*
* This file is part of libFirm.
*
#include "irprog_t.h"
#include "iredgekinds.h"
#include "iredges_t.h"
+#include "ircons.h"
#include "irhooks.h"
#include "irtools.h"
return mbh;
}
+/* returns the macro block header of a node. */
+ir_node *get_irn_MacroBlock(const ir_node *n) {
+ if (! is_Block(n)) {
+ n = get_nodes_block(n);
+ /* if the Block is Bad, do NOT try to get it's MB, it will fail. */
+ if (is_Bad(n))
+ return (ir_node *)n;
+ }
+ return get_Block_MacroBlock(n);
+}
+
/* returns the graph of a Block. */
ir_graph *get_Block_irg(const ir_node *block) {
assert(is_Block(block));
return node->attr.sel.ent;
}
+ir_entity *_get_Sel_entity(ir_node *node) {
+ return get_Sel_entity(node);
+}
+
void
set_Sel_entity(ir_node *node, ir_entity *ent) {
assert(node->op == op_Sel);
}
/* skip all high-level ops */
-ir_node *skip_HighLevel(ir_node *node) {
- if (is_op_highlevel(get_irn_op(node)))
- return get_irn_n(node, 0);
+ir_node *skip_HighLevel_ops(ir_node *node) {
+ while (is_op_highlevel(get_irn_op(node))) {
+ node = get_irn_n(node, 0);
+ }
return node;
}
ir_op_ops *firm_set_default_get_entity_attr(ir_opcode code, ir_op_ops *ops) {
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_Sel: ops->get_entity_attr = _get_Sel_entity; break;
default:
/* not allowed to be NULL */
if (! ops->get_entity_attr)