Commit 966d9403 authored by Florian Liekweg's avatar Florian Liekweg
Browse files

Added iro_InstOf operator --flo

[r415]
parent d14b0267
......@@ -56,6 +56,7 @@ new_rd_Block (dbg_info* db, ir_graph *irg, int arity, ir_node **in)
set_Block_block_visited(res, 0);
res->attr.block.exc = exc_normal;
res->attr.block.handler_entry = 0;
res->attr.block.in_cg = NULL;
irn_vrfy (res);
......@@ -562,6 +563,27 @@ new_rd_Sel (dbg_info* db, ir_graph *irg, ir_node *block, ir_node *store, ir_node
return res;
}
ir_node *
new_rd_InstOf (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store, ir_node *objptr, type *ent)
{
ir_node **r_in;
ir_node *res;
int r_arity;
r_arity = 2;
NEW_ARR_A (ir_node *, r_in, r_arity);
r_in [0] = store;
r_in [1] = objptr;
res = new_ir_node (db, irg, block, op_Sel, mode_T, r_arity, r_in);
res->attr.io.ent = ent;
// res = optimize (res);
// irn_vrfy (res);
return (res);
}
inline ir_node *
new_rd_SymConst (dbg_info* db, ir_graph *irg, ir_node *block, type_or_id_p value,
symconst_kind symkind)
......@@ -718,6 +740,10 @@ ir_node *new_r_Sel (ir_graph *irg, ir_node *block, ir_node *store,
entity *ent) {
return new_rd_Sel(NULL, irg, block, store, objptr, n_index, index, ent);
}
ir_node *new_r_InstOf (ir_graph *irg, ir_node *block, ir_node *store, ir_node *objptr,
type *ent) {
return (new_rd_InstOf (NULL, irg, block, store, objptr, ent));
}
ir_node *new_r_Call (ir_graph *irg, ir_node *block, ir_node *store,
ir_node *callee, int arity, ir_node **in,
type *type) {
......@@ -736,7 +762,7 @@ ir_node *new_r_Minus (ir_graph *irg, ir_node *block,
return new_rd_Minus(NULL, irg, block, op, mode);
}
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);
}
ir_node *new_r_Quot (ir_graph *irg, ir_node *block,
......@@ -1976,6 +2002,13 @@ new_d_Sel (dbg_info* db, ir_node *store, ir_node *objptr, int n_index, ir_node *
store, objptr, n_index, index, sel);
}
ir_node *
new_d_InstOf (dbg_info *db, ir_node *store, ir_node *objptr, type *ent)
{
return (new_rd_InstOf (db, current_ir_graph, current_ir_graph->current_block,
store, objptr, ent));
}
ir_node *
new_d_SymConst (dbg_info* db, type_or_id_p value, symconst_kind kind)
{
......@@ -2056,6 +2089,7 @@ ir_node *new_d_immBlock (dbg_info* db) {
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.in_cg = NULL;
set_Block_block_visited(res, 0);
......@@ -2210,6 +2244,9 @@ ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity, ir_node **in,
entity *ent) {
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));
}
ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node **in,
type *type) {
return new_d_Call(NULL, store, callee, arity, in, type);
......
......@@ -326,6 +326,7 @@
* ir_node *new_simpleSel (ir_node *store, ir_node *objptr, entity *ent);
* ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity,
* ir_node **in, entity *ent);
* ir_node *new_InstOf (ir_node *store, ir_node *objptr, type *ent);
* ir_node *new_Call (ir_node *store, ir_node *callee, int arity,
* ir_node **in, type_method *type);
* ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode);
......@@ -1354,6 +1355,7 @@ ir_node *new_SymConst (type_or_id_p value, symconst_kind kind);
ir_node *new_simpleSel(ir_node *store, ir_node *objptr, entity *ent);
ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity, ir_node **in,
entity *ent);
ir_node *new_InstOf (ir_node *store, ir_node *objptr, type *ent);
ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node **in,
type *type);
ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode);
......
......@@ -548,16 +548,59 @@ set_Block_graph_arr (ir_node *node, int pos, ir_node *value) {
node->attr.block.graph_arr[pos+1] = value;
}
/* handler handling for Blocks */
void set_Block_handler (ir_node *block, ir_node *handler)
{
assert ((block->op == op_Block));
assert ((handler->op == op_Block));
block->attr.block.handler_entry = handler;
}
ir_node *get_Block_handler (ir_node *block)
{
assert ((block->op == op_Block));
return (block->attr.block.handler_entry);
}
/* handler handling for Nodes */
void set_Node_handler (ir_node *node, ir_node *handler)
{
set_Block_handler (get_nodes_Block (node), handler);
}
ir_node *get_Node_handler (ir_node *node)
{
return (get_Block_handler (get_nodes_Block (node)));
}
/* 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 */
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);
if (node->attr.block.in_cg == NULL || arity != ARR_LEN(node->attr.block.in_cg) - 1) {
......@@ -892,6 +935,42 @@ set_Sel_linkage_type (ir_node *node, linkage_type lt) {
node->attr.s.ltyp = lt;
}
type *
get_InstOf_ent (ir_node *node) {
assert (node->op = op_InstOf);
return (node->attr.io.ent);
}
void
set_InstOf_ent (ir_node *node, type *ent) {
assert (node->op = op_InstOf);
node->attr.io.ent = ent;
}
ir_node *
get_InstOf_store (ir_node *node) {
assert (node->op = op_InstOf);
return (get_irn_n (node, 0));
}
void
set_InstOf_store (ir_node *node, ir_node *obj) {
assert (node->op = op_InstOf);
set_irn_n (node, 0, obj);
}
ir_node *
get_InstOf_obj (ir_node *node) {
assert (node->op = op_InstOf);
return (get_irn_n (node, 1));
}
void
set_InstOf_obj (ir_node *node, ir_node *obj) {
assert (node->op = op_InstOf);
set_irn_n (node, 1, obj);
}
inline ir_node *
get_Call_mem (ir_node *node) {
assert (node->op == op_Call);
......
......@@ -157,9 +157,19 @@ inline int Block_not_block_visited(ir_node *node);
inline ir_node *get_Block_graph_arr (ir_node *node, int pos);
inline void set_Block_graph_arr (ir_node *node, int pos, ir_node *value);
void set_Block_exc (ir_node*, exc_t);
exc_t get_Block_exc (ir_node*);
/* exc handling */
void set_Block_exc (ir_node*, exc_t);
exc_t get_Block_exc (ir_node*);
void set_Node_exc (ir_node*, exc_t);
exc_t get_Node_exc (ir_node*);
/* handler handling */
void set_Block_handler (ir_node*, ir_node*);
ir_node* get_Block_handler (ir_node*);
void set_Node_handler (ir_node*, ir_node*);
ir_node* get_Node_handler (ir_node*);
/* Set and remove interprocedural predecessors. If the interprocedural
* predecessors are removed, the node has the same predecessors in
* both views. */
......@@ -169,7 +179,6 @@ ir_node ** get_Block_cg_cfgpred_arr(ir_node * node);
int get_Block_cg_n_cfgpreds(ir_node * node);
void remove_Block_cg_cfgpred_arr(ir_node * node);
inline int get_End_n_keepalives(ir_node *end);
inline ir_node *get_End_keepalive(ir_node *end, int pos);
inline void add_End_keepalive (ir_node *end, ir_node *ka);
......@@ -272,6 +281,13 @@ typedef enum {
inline linkage_type get_Sel_linkage_type (ir_node *node);
inline void set_Sel_linkage_type (ir_node *node, linkage_type lt);
type *get_InstOf_ent (ir_node*);
void set_InstOf_ent (ir_node*, type*);
ir_node *get_InstOf_obj (ir_node*);
void set_InstOf_obj (ir_node*, ir_node*);
ir_node *get_InstOf_store (ir_node*);
void set_InstOf_store (ir_node*, ir_node*);
inline ir_node *get_Call_mem (ir_node *node);
inline void set_Call_mem (ir_node *node, ir_node *mem);
inline ir_node *get_Call_ptr (ir_node *node);
......
......@@ -33,6 +33,7 @@ typedef struct {
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 */
......@@ -80,6 +81,13 @@ typedef struct {
#endif
} alloc_attr;
/* InstOf attributes */
typedef struct
{
type *ent;
int dfn;
} io_attr;
/* Filter attributes */
typedef struct {
long proj; /* contains the result position to project (Proj) */
......@@ -109,6 +117,7 @@ typedef union {
sel_attr s; /* For Sel. */
call_attr call; /* For Call: pointer to the type of the method to call */
alloc_attr a; /* For Alloc. */
io_attr io; /* For InstOf */
type *f; /* For Free. */
int phi0_pos; /* For Phi. Used to remember the value defined by
this Phi node. Needed when the Phi is completed
......
......@@ -25,6 +25,7 @@ ir_op *op_Return;
ir_op *op_Raise;
ir_op *op_Sel;
ir_op *op_InstOf;
ir_op *op_Const;
ir_op *op_SymConst;
......@@ -106,6 +107,7 @@ init_op(void)
floats, 0, sizeof (symconst_attr));
op_Sel = new_ir_op (iro_Sel, "Sel", floats, 1, sizeof (sel_attr));
op_InstOf= new_ir_op (iro_InstOf,"InstOf", floats, 1, sizeof (sel_attr));
op_Call = new_ir_op (iro_Call, "Call", pinned, 1, sizeof (call_attr));
op_Add = new_ir_op (iro_Add, "Add", floats, 0, 0);
......
......@@ -24,10 +24,10 @@ typedef enum {
iro_Block,
iro_Start, iro_End, iro_Jmp, iro_Cond, iro_Return, iro_Raise,
iro_Const, iro_SymConst,
iro_Sel,
iro_Sel, iro_InstOf,
iro_Call, iro_Add, iro_Sub, iro_Minus, iro_Mul, iro_Quot, iro_DivMod,
iro_Div, iro_Mod, iro_Abs, iro_And, iro_Or, iro_Eor, iro_Not,
iro_Cmp, iro_Shl, iro_Shr, iro_Shrs, iro_Rot, iro_Conv,
iro_Div, iro_Mod, iro_Abs, iro_And, iro_Or, iro_Eor, iro_Not,
iro_Cmp, iro_Shl, iro_Shr, iro_Shrs, iro_Rot, iro_Conv,
iro_Phi,
iro_Load, iro_Store, iro_Alloc, iro_Free, iro_Sync,
iro_Proj, iro_Tuple, iro_Id, iro_Bad,
......@@ -45,6 +45,7 @@ extern ir_op *op_Cond;
extern ir_op *op_Return;
extern ir_op *op_Raise;
extern ir_op *op_Sel;
extern ir_op *op_InstOf;
extern ir_op *op_Const;
extern ir_op *op_SymConst;
......
......@@ -120,6 +120,10 @@ irn_vrfy (ir_node *n)
for (i=3; i < get_irn_arity(n); i++) {
assert (get_irn_mode(in[i]) == mode_I && "Sel node"); }
break;
case iro_InstOf:
assert (mode_T == mymode);
assert (mode_is_data (op1mode));
break;
case iro_Call:
op1mode = get_irn_mode(in[1]);
op2mode = get_irn_mode(in[2]);
......@@ -385,6 +389,10 @@ vrfy_Proj_proj(ir_node *p) {
(proj == 1 && mode == mode_M) &&
"wrong Proj from Raise" );
break;
case iro_InstOf:
assert (((proj >= 0 && mode == mode_X) &&
"wrong Proj from InstOf"));
break;
case iro_Call:
assert ((proj == 0 && mode == mode_M) ||
(proj == 1 && mode == mode_X) ||
......
......@@ -34,7 +34,7 @@ typedef enum {
// must push a new exc contrext at entry of block:
exc_region, /* region entry */
// must pop current exc contrext at exit of block
// must pop current exc contrext at EXIT of block
exc_exit, /* region exit */
// must pop current exc contrext at entry of block
......
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