removed exc attr.
[r2027]
set_Block_matured(res, 1);
set_Block_block_visited(res, 0);
- res->attr.block.exc = exc_normal;
- res->attr.block.handler_entry = 0;
+ //res->attr.block.exc = exc_normal;
+ //res->attr.block.handler_entry = 0;
+ res->attr.block.irg = irg;
res->attr.block.backedge = new_backedge_arr(irg->obst, arity);
res->attr.block.in_cg = NULL;
res->attr.block.cg_backedge = NULL;
ir_node *res;
res = new_ir_node (db, irg, block, op_Start, mode_T, 0, NULL);
- res->attr.start.irg = irg;
+ //res->attr.start.irg = irg;
irn_vrfy_irg (res, irg);
return res;
ir_node *res;
in[0] = get_Call_ptr(call);
res = new_ir_node (db, irg, block, op_CallBegin, mode_T, 1, in);
- res->attr.callbegin.irg = irg;
+ //res->attr.callbegin.irg = irg;
res->attr.callbegin.call = call;
res = optimize_node (res);
irn_vrfy_irg (res, irg);
ir_node *res;
res = new_ir_node (db, irg, block, op_EndReg, mode_T, -1, NULL);
- res->attr.end.irg = irg;
+ //res->attr.end.irg = irg;
irn_vrfy_irg (res, irg);
return res;
ir_node *res;
res = new_ir_node (db, irg, block, op_EndExcept, mode_T, -1, NULL);
- res->attr.end.irg = irg;
+ //res->attr.end.irg = irg;
irn_vrfy_irg (res, irg);
return res;
return new_rd_SymConst(NULL, irg, block, value, symkind);
}
INLINE ir_node *new_r_Sel (ir_graph *irg, ir_node *block, ir_node *store,
- ir_node *objptr, int n_index, ir_node **index,
- entity *ent) {
+ ir_node *objptr, int n_index, ir_node **index,
+ entity *ent) {
return new_rd_Sel(NULL, irg, block, store, objptr, n_index, index, ent);
}
INLINE ir_node *new_r_InstOf (ir_graph *irg, ir_node *block, ir_node *store, ir_node *objptr,
- type *ent) {
+ type *ent) {
return (new_rd_InstOf (NULL, irg, block, store, objptr, ent));
}
INLINE ir_node *new_r_Call (ir_graph *irg, ir_node *block, ir_node *store,
- ir_node *callee, int arity, ir_node **in,
- type *tp) {
+ ir_node *callee, int arity, ir_node **in,
+ type *tp) {
return new_rd_Call(NULL, irg, block, store, callee, arity, in, tp);
}
INLINE ir_node *new_r_Add (ir_graph *irg, ir_node *block,
- ir_node *op1, ir_node *op2, ir_mode *mode) {
+ ir_node *op1, ir_node *op2, ir_mode *mode) {
return new_rd_Add(NULL, irg, block, op1, op2, mode);
}
INLINE ir_node *new_r_Sub (ir_graph *irg, ir_node *block,
- ir_node *op1, ir_node *op2, ir_mode *mode) {
+ ir_node *op1, ir_node *op2, ir_mode *mode) {
return new_rd_Sub(NULL, irg, block, op1, op2, mode);
}
INLINE ir_node *new_r_Minus (ir_graph *irg, ir_node *block,
- ir_node *op, ir_mode *mode) {
+ ir_node *op, ir_mode *mode) {
return new_rd_Minus(NULL, irg, block, op, mode);
}
INLINE ir_node *new_r_Mul (ir_graph *irg, ir_node *block,
- ir_node *op1, ir_node *op2, ir_mode *mode) {
+ ir_node *op1, ir_node *op2, ir_mode *mode) {
return new_rd_Mul(NULL, irg, block, op1, op2, mode);
}
INLINE ir_node *new_r_Quot (ir_graph *irg, ir_node *block,
- ir_node *memop, ir_node *op1, ir_node *op2) {
+ ir_node *memop, ir_node *op1, ir_node *op2) {
return new_rd_Quot(NULL, irg, block, memop, op1, op2);
}
INLINE ir_node *new_r_DivMod (ir_graph *irg, ir_node *block,
- ir_node *memop, ir_node *op1, ir_node *op2) {
+ ir_node *memop, ir_node *op1, ir_node *op2) {
return new_rd_DivMod(NULL, irg, block, memop, op1, op2);
}
INLINE ir_node *new_r_Div (ir_graph *irg, ir_node *block,
- ir_node *memop, ir_node *op1, ir_node *op2) {
+ ir_node *memop, ir_node *op1, ir_node *op2) {
return new_rd_Div(NULL, irg, block, memop, op1, op2);
}
INLINE ir_node *new_r_Mod (ir_graph *irg, ir_node *block,
- ir_node *memop, ir_node *op1, ir_node *op2) {
+ ir_node *memop, ir_node *op1, ir_node *op2) {
return new_rd_Mod(NULL, irg, block, memop, op1, op2);
}
INLINE ir_node *new_r_Abs (ir_graph *irg, ir_node *block,
- ir_node *op, ir_mode *mode) {
+ ir_node *op, ir_mode *mode) {
return new_rd_Abs(NULL, irg, block, op, mode);
}
INLINE ir_node *new_r_And (ir_graph *irg, ir_node *block,
- ir_node *op1, ir_node *op2, ir_mode *mode) {
+ ir_node *op1, ir_node *op2, ir_mode *mode) {
return new_rd_And(NULL, irg, block, op1, op2, mode);
}
INLINE ir_node *new_r_Or (ir_graph *irg, ir_node *block,
- ir_node *op1, ir_node *op2, ir_mode *mode) {
+ ir_node *op1, ir_node *op2, ir_mode *mode) {
return new_rd_Or(NULL, irg, block, op1, op2, mode);
}
INLINE ir_node *new_r_Eor (ir_graph *irg, ir_node *block,
- ir_node *op1, ir_node *op2, ir_mode *mode) {
+ ir_node *op1, ir_node *op2, ir_mode *mode) {
return new_rd_Eor(NULL, irg, block, op1, op2, mode);
}
INLINE ir_node *new_r_Not (ir_graph *irg, ir_node *block,
res = new_ir_node (db, current_ir_graph, current_ir_graph->current_block,
op_Start, mode_T, 0, NULL);
- res->attr.start.irg = current_ir_graph;
+ //res->attr.start.irg = current_ir_graph;
res = optimize_node (res);
irn_vrfy_irg (res, current_ir_graph);
res = new_ir_node (db, current_ir_graph, NULL, op_Block, mode_BB, -1, NULL);
current_ir_graph->current_block = res;
res->attr.block.matured = 0;
- res->attr.block.exc = exc_normal;
- res->attr.block.handler_entry = 0;
+ //res->attr.block.exc = exc_normal;
+ //res->attr.block.handler_entry = 0;
+ res->attr.block.irg = current_ir_graph;
res->attr.block.backedge = NULL;
res->attr.block.in_cg = NULL;
res->attr.block.cg_backedge = NULL;
return new_d_Sel(NULL, store, objptr, arity, in, ent);
}
ir_node *new_InstOf (ir_node *store, ir_node *objptr, type *ent) {
- return (new_d_InstOf (NULL, store, objptr, ent));
+ return new_d_InstOf (NULL, store, objptr, ent);
}
ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node **in,
type *tp) {
/* Funcionality for inlining */
/**********************************************************************/
-/* Copy node for inlineing. Copies the node by calling copy_node and
- then updates the entity if it's a local one. env must be a pointer
- to the frame type of the procedure. The new entities must be in
- the link field of the entities. */
+/* Copy node for inlineing. Updates attributes that change when
+ * inlineing but not for dead node elimination.
+ *
+ * Copies the node by calling copy_node and then updates the entity if
+ * it's a local one. env must be a pointer of the frame type of the
+ * inlined procedure. The new entities must be in the link field of
+ * the entities. */
static INLINE void
copy_node_inline (ir_node *n, void *env) {
ir_node *new;
if (get_entity_owner(get_Sel_entity(n)) == frame_tp) {
set_Sel_entity(new, get_entity_link(get_Sel_entity(n)));
}
+ } else if (get_irn_op(n) == op_Block) {
+ new = get_new_node (n);
+ new->attr.block.irg = current_ir_graph;
}
}
-#include "irdump.h"
void inline_method(ir_node *call, ir_graph *called_graph) {
ir_node *pre_call;
/* will be executed only if needed. */
/********************************************************************/
-#include "irdump.h"
-
static pdeq *worklist; /* worklist of ir_node*s */
/* Find the earliest correct block for N. --- Place N into the
node->attr.block.graph_arr[pos+1] = value;
}
-/* handler handling for Blocks */
+/* handler handling for Blocks * /
void
set_Block_handler (ir_node *block, ir_node *handler) {
assert ((block->op == op_Block));
return (block->attr.block.handler_entry);
}
-/* handler handling for Nodes */
+/ * handler handling for Nodes * /
void
set_Node_handler (ir_node *node, ir_node *handler) {
set_Block_handler (get_nodes_Block (node), handler);
return (get_Block_handler (get_nodes_Block (node)));
}
-/* exc_t handling for Blocks */
+/ * exc_t handling for Blocks * /
void set_Block_exc (ir_node *block, exc_t exc) {
assert ((block->op == op_Block));
block->attr.block.exc = exc;
exc_t get_Block_exc (ir_node *block) {
assert ((block->op == op_Block));
-
return (block->attr.block.exc);
}
-/* exc_t handling for Nodes */
+/ * exc_t handling for Nodes * /
void set_Node_exc (ir_node *node, exc_t exc) {
set_Block_exc (get_nodes_Block (node), exc);
}
exc_t get_Node_exc (ir_node *node) {
return (get_Block_exc (get_nodes_Block (node)));
}
+*/
void set_Block_cg_cfgpred_arr(ir_node * node, int arity, ir_node ** in) {
assert(node->op == op_Block);
/* Start references the irg it is in. */
INLINE ir_graph *
get_Start_irg(ir_node *node) {
- assert(node->op == op_Start);
- return node->attr.start.irg;
+ return get_irn_irg(node);
}
INLINE void
set_Start_irg(ir_node *node, ir_graph *irg) {
assert(node->op == op_Start);
assert(is_ir_graph(irg));
- node->attr.start.irg = irg;
+ assert(0 && " Why set irg? ");
+ //node->attr.start.irg = irg;
}
INLINE int
in array afterwards ... */
}
-ir_graph *get_EndReg_irg (const ir_node *end) {
- assert (end->op == op_EndReg);
- return end->attr.end.irg;
+ir_graph *get_EndReg_irg (ir_node *end) {
+ return get_irn_irg(end);
}
-ir_graph *get_EndExcept_irg (const ir_node *end) {
- assert (end->op == op_EndReg);
- return end->attr.end.irg;
+ir_graph *get_EndExcept_irg (ir_node *end) {
+ return get_irn_irg(end);
}
/*
set_irn_n(node, 0, ptr);
}
ir_graph * get_CallBegin_irg (ir_node *node) {
- assert(node->op == op_CallBegin);
- return node->attr.callbegin.irg;
+ return get_irn_irg(node);
}
ir_node * get_CallBegin_call (ir_node *node) {
assert(node->op == op_CallBegin);
INLINE ir_graph *
get_irn_irg(ir_node *node) {
- if (get_irn_op(node) == op_CallBegin) {
- return node->attr.callbegin.irg;
- } else if (get_irn_op(node) == op_EndReg ||
- get_irn_op(node) == op_EndExcept) {
- return node->attr.end.irg;
- } else if (get_irn_op(node) == op_Start) {
- return node->attr.start.irg;
- } else {
- assert(0 && "no irg attr");
- return NULL;
- }
+ if (get_irn_op(node) != op_Block)
+ node = get_nodes_block(node);
+ assert(get_irn_op(node) == op_Block);
+ return node->attr.block.irg;
}
}
ir_graph *get_ip_cfop_irg(ir_node *n) {
- switch (get_irn_opcode(n)) {
- case iro_EndReg:
- return get_EndReg_irg(n);
- case iro_EndExcept:
- return get_EndExcept_irg(n);
- case iro_CallBegin:
- return get_CallBegin_irg(n);
- default:
- assert(is_ip_cfop(n));
- }
- return NULL; /* should never be reached */
+ return get_irn_irg(n);
}
/* Returns true if the operation can change the control flow because
INLINE int irn_not_visited (const ir_node *node);
/** Returns 1 if visited >= get_irg_visited(current_ir_graph). */
INLINE int irn_visited (const ir_node *node);
-INLINE void set_irn_link (ir_node *node, void *link);
-INLINE void *get_irn_link (const ir_node *node);
+INLINE void set_irn_link (ir_node *node, void *link);
+INLINE void *get_irn_link (const ir_node *node);
+
+/** Returns the ir_graph this node belongs to. Only valid if irg
+ * is in state pinned (irg is only stored in the block. */
+INLINE ir_graph *get_irn_irg (ir_node *node);
/** Outputs a unique number for this node if libfirm is compiled for
debugging, (configure with --enable-debug) else returns address
of node cast to long. */
-INLINE long get_irn_node_nr(const ir_node *node);
+INLINE long get_irn_node_nr (const ir_node *node);
-/** Returns the ir_graph this node belongs to. Only valid for
- * CallBegin, EndReg, EndExcept and Start */
-INLINE ir_graph *get_irn_irg(ir_node *node);
/**
* irnode constructor.
/* frees the memory. */
void remove_Block_cg_cfgpred_arr(ir_node * node);
-/* Start references the irg it is in. */
+/* Start references the irg it is in.
+ @@@ old -- use get_irn_irg instead! */
ir_graph *get_Start_irg(ir_node *node);
-void set_Start_irg(ir_node *node, ir_graph *irg);
INLINE int get_End_n_keepalives(ir_node *end);
INLINE ir_node *get_End_keepalive(ir_node *end, int pos);
free_End frees these data structures. */
INLINE void free_End (ir_node *end);
-ir_graph *get_EndReg_irg (const ir_node *end);
-ir_graph *get_EndExcept_irg (const ir_node *end);
+/* @@@ old -- use get_irn_irg instead! */
+ir_graph *get_EndReg_irg (ir_node *end);
+ir_graph *get_EndExcept_irg (ir_node *end);
/* We distinguish three kinds of Cond nodes. These can be distinguished
by the mode of the selector operand and an internal flag of type cond_kind.
ir_node *get_CallBegin_ptr (ir_node *node);
void set_CallBegin_ptr (ir_node *node, ir_node *ptr);
+/* @@@ old -- use get_irn_irg instead! */
ir_graph *get_CallBegin_irg (ir_node *node);
ir_node *get_CallBegin_call (ir_node *node);
void set_CallBegin_call (ir_node *node, ir_node *call);
Start, End, Jmp, Cond, Return, Raise, Bad, CallBegin, EndReg, EndExcept */
int is_cfop(ir_node *node);
+/* @@@ old -- use get_irn_irg instead! */
+ir_graph *get_ip_cfop_irg(ir_node *n);
+
/** Returns true if the operation manipulates interprocedural control flow:
- CallBegin, EndReg, EndExcept */
+ CallBegin, EndReg, EndExcept */
int is_ip_cfop(ir_node *node);
/** Returns true if the operation can change the control flow because
- of an exception: Call, Quot, DivMod, Div, Mod, Load, Store, Alloc,
- Bad. */
-ir_graph *get_ip_cfop_irg(ir_node *n);
-
+ of an exception: Call, Quot, DivMod, Div, Mod, Load, Store, Alloc,
+ Bad. */
int is_fragile_op(ir_node *node);
/** Returns the memory operand of fragile operations. */
ir_node *get_fragile_op_mem(ir_node *node);
/** Block attributes */
typedef struct {
+ /* General attributes */
+ ir_graph *irg;
unsigned long block_visited; /**< for the walker that walks over all blocks. */
/* Attributes private to construction: */
bool matured; /**< if set, all in-nodes of the block are fixed */
struct ir_node **graph_arr; /**< array to store all parameters */
+ /* Attributes holding analyses information */
struct dom_info dom; /**< Datastructure that holds information about dominators.
- @todo
- Eventually overlay with graph_arr as only valid
- in different phases. Eventually inline the whole
- datastructure. */
- exc_t exc; /**< role of this block for exception handling */
- ir_node *handler_entry; /**< handler entry block iff this block is part of a region */
+ @@@ @todo
+ Eventually overlay with graph_arr as only valid
+ in different phases. Eventually inline the whole
+ datastructure. */
+ // exc_t exc; /**< role of this block for exception handling */
+ // ir_node *handler_entry; /**< handler entry block iff this block is part of a region */
ir_node ** in_cg; /**< array with predecessors in
* interprocedural_view, if they differ
* from intraprocedural predecessors */
int *backedge; /**< Field n set to true if pred n is backedge.
- @todo Ev. replace by bitfield! */
+ @@@ @todo Ev. replace by bitfield! */
int *cg_backedge; /**< Field n set to true if pred n is interprocedural backedge.
- @todo Ev. replace by bitfield! */
+ @@@ @todo Ev. replace by bitfield! */
} block_attr;
/** Start attributes */
typedef struct {
- ir_graph *irg;
+ char dummy;
+ // ir_graph *irg; @@@ now in block
} start_attr;
/** Cond attributes */
/** EndReg/EndExcept attributes */
typedef struct {
- ir_graph * irg; /**< ir_graph this node belongs to (for
- * navigating in interprocedural graphs) */
+ char dummy;
+ // ir_graph * irg; /**< ir_graph this node belongs to (for
+ // * navigating in interprocedural graphs)
+ // @@@ now in block */
} end_attr;
/** CallBegin attributes */
typedef struct {
- ir_graph * irg; /**< ir_graph this node belongs to (for
- * navigating in interprocedural graphs) */
+ // ir_graph * irg; / **< ir_graph this node belongs to (for
+ // * navigating in interprocedural graphs) */
+ // @@@ now in block
ir_node * call; /**< associated Call-operation */
} callbegin_attr;