InstOf Node (high-level instanceof test with exception) reanimated
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Sat, 14 Jan 2006 21:15:05 +0000 (21:15 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Sat, 14 Jan 2006 21:15:05 +0000 (21:15 +0000)
[r7244]

ir/ir/ircons.c
ir/ir/ircons.h
ir/ir/irnode.c
ir/ir/irnode.h
ir/ir/irnode_t.h
ir/ir/irop.c

index 99e888d..7de95dc 100644 (file)
@@ -758,7 +758,7 @@ new_bd_Sel (dbg_info *db, ir_node *block, ir_node *store, ir_node *objptr,
 
 static ir_node *
 new_bd_InstOf (dbg_info *db, ir_node *block, ir_node *store,
-           ir_node *objptr, ir_type *ent)
+           ir_node *objptr, ir_type *type)
 {
   ir_node  **r_in;
   ir_node  *res;
@@ -771,7 +771,7 @@ new_bd_InstOf (dbg_info *db, ir_node *block, ir_node *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->attr.io.type = type;
 
   /* res = optimize(res); */
   IRN_VRFY_IRG(res, irg);
@@ -1576,13 +1576,13 @@ new_rd_Sel (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store, ir_node
 
 ir_node *
 new_rd_InstOf (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
-           ir_node *objptr, ir_type *ent)
+           ir_node *objptr, ir_type *type)
 {
   ir_node  *res;
   ir_graph *rem = current_ir_graph;
 
   current_ir_graph = irg;
-  res = new_bd_InstOf(db, block, store, objptr, ent);
+  res = new_bd_InstOf(db, block, store, objptr, type);
   current_ir_graph = rem;
 
   return res;
@@ -1835,8 +1835,8 @@ ir_node *new_r_Sel    (ir_graph *irg, ir_node *block, ir_node *store,
   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,
-                  ir_type *ent) {
-  return (new_rd_InstOf (NULL, irg, block, store, objptr, ent));
+                  ir_type *type) {
+  return (new_rd_InstOf (NULL, irg, block, store, objptr, type));
 }
 ir_node *new_r_Call   (ir_graph *irg, ir_node *block, ir_node *store,
                   ir_node *callee, int arity, ir_node **in,
@@ -3241,10 +3241,10 @@ new_d_Sel (dbg_info *db, ir_node *store, ir_node *objptr, int n_index, ir_node *
 }
 
 ir_node *
-new_d_InstOf (dbg_info *db, ir_node *store, ir_node *objptr, ir_type *ent)
+new_d_InstOf (dbg_info *db, ir_node *store, ir_node *objptr, ir_type *type)
 {
   return (new_bd_InstOf (db, current_ir_graph->current_block,
-                         store, objptr, ent));
+                         store, objptr, type));
 }
 
 ir_node *
index 65cea0f..735211e 100644 (file)
  *    Describes a high level bounds check. Must be lowered to a Call to a runtime check
  *    function.
  *
+ *    ir_node *new_InstOf(ir_node *store, ir_node *ptr, ir_type *type);
+ *    -----------------------------------------------------------------------------------
+ *
+ *    Describes a high level type check. Must be lowered to a Call to a runtime check
+ *    function.
+ *
  *    ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj)
  *    ----------------------------------------------------------
  *
@@ -1311,17 +1317,18 @@ ir_node *new_rd_Sel    (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *st
 
 /** Constructor for a InstOf node.
  *
- * For translating Java.  Not supported as standard firm node.
+ * A High-Level Type check.
  *
- * @param   *db     A pointer for debug information.
- * @param   *irg    The ir graph the node  belongs to.
- * @param   *block  The ir block the node belongs to.
- * @param   *store
- * @param   *objptr
- * @param   *ent
+ * @param   *db        A pointer for debug information.
+ * @param   *irg       The ir graph the node  belongs to.
+ * @param   *block     The ir block the node belongs to.
+ * @param   *store     The memory in which the object the entity should be selected
+ *                     from is allocated.
+ * @param   *objptr    A pointer to a object of a class type.
+ * @param   *type      The type of which objptr must be.
  */
 ir_node *new_rd_InstOf (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
-                       ir_node *objptr, ir_type *ent);
+                       ir_node *objptr, ir_type *type);
 
 /** Constructor for a Call node.
  *
@@ -2044,15 +2051,17 @@ ir_node *new_r_Sel    (ir_graph *irg, ir_node *block, ir_node *store,
 
 /** Constructor for a InstOf node.
  *
- * For translating Java.  Not supported as standard firm node.
+ * A High-Level Type check.
  *
- * @param   *irg   The ir graph the node  belongs to.
- * @param   *block The ir block the node belongs to.
- * @param   *x
- * @param   *y
- * @param   *z
+ * @param   *irg       The ir graph the node  belongs to.
+ * @param   *block     The ir block the node belongs to.
+ * @param   *store     The memory in which the object the entity should be selected
+ *                     from is allocated.
+ * @param   *objptr    A pointer to a object of a class type.
+ * @param   *type      The type of which objptr must be.
  */
-ir_node *new_r_InstOf (ir_graph *irg, ir_node *block, ir_node *x, ir_node *y, ir_type *z);
+ir_node *new_r_InstOf (ir_graph *irg, ir_node *block, ir_node *store,
+                       ir_node *objptr, ir_type *type);
 
 /** Constructor for a Call node.
  *
@@ -2779,16 +2788,15 @@ ir_node *new_d_Sel    (dbg_info *db, ir_node *store, ir_node *objptr, int arity,
 
 /** Constructor for a InstOf node.
  *
- * Adds the node to the block in current_ir_block.
+ * A High-Level Type check.
  *
- * For translating Java.  Not supported as standard firm node.
- *
- * @param   *db    A pointer for debug information.
- * @param   *store
- * @param   *objptr
- * @param   *ent
+ * @param   *db        A pointer for debug information.
+ * @param   *store     The memory in which the object the entity should be selected
+ *                     from is allocated.
+ * @param   *objptr    A pointer to a object of a class type.
+ * @param   *type      The type of which objptr must be.
  */
-ir_node *new_d_InstOf (dbg_info *db, ir_node *store, ir_node *objptr, ir_type *ent);
+ir_node *new_d_InstOf (dbg_info *db, ir_node *store, ir_node *objptr, ir_type *type);
 
 /** Constructor for a Call node.
  *
@@ -3481,16 +3489,16 @@ 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);
 
-/** Constructor for an InstOf node.
+/** Constructor for a InstOf node.
  *
- * Adds the node to the block in current_ir_block.
- * For translating Java.  Not supported as standard firm node.
+ * A High-Level Type check.
  *
- * @param   *store  The actual store.
- * @param   *obj
- * @param   *ent
+ * @param   *store     The memory in which the object the entity should be selected
+ *                     from is allocated.
+ * @param   *objptr    A pointer to a object of a class type.
+ * @param   *type      The type of which objptr must be.
  */
-ir_node *new_InstOf (ir_node *store, ir_node *obj, ir_type *ent);
+ir_node *new_InstOf (ir_node *store, ir_node *objptr, ir_type *type);
 
 /** Constructor for a Call node.
  *
index fca414d..1805970 100644 (file)
@@ -1125,15 +1125,15 @@ set_Sel_entity (ir_node *node, entity *ent) {
 }
 
 ir_type *
-get_InstOf_ent (ir_node *node) {
+get_InstOf_type (ir_node *node) {
   assert (node->op = op_InstOf);
-  return (node->attr.io.ent);
+  return (node->attr.io.type);
 }
 
 void
-set_InstOf_ent (ir_node *node, ir_type *ent) {
+set_InstOf_type (ir_node *node, ir_type *type) {
   assert (node->op = op_InstOf);
-  node->attr.io.ent = ent;
+  node->attr.io.type = type;
 }
 
 ir_node *
index 469910a..b5c1bf6 100644 (file)
@@ -498,9 +498,22 @@ void     set_Sel_index (ir_node *node, int pos, ir_node *index);
 entity  *get_Sel_entity (ir_node *node); /* entity to select */
 void     set_Sel_entity (ir_node *node, entity *ent);
 
+/**
+ * Projection numbers for result of InstOf node: use for Proj nodes!
+ */
+typedef enum {
+  pn_InstOf_M_regular = 0,   /**< The memory result. */
+  pn_InstOf_X_except = 1,    /**< The control flow result branching to the exception handler */
+  pn_InstOf_res = 2,         /**< The checked object pointer. */
+  pn_InstOf_M_except = 3,    /**< The memory result in case the runtime function terminated with
+                                 an exception */
+  pn_InstOf_max = 4          /**< number of projections from an InstOf */
+} pn_InstOf;
+#define pn_InstOf_M pn_InstOf_M_regular
+
 /** InstOf access */
-ir_type *get_InstOf_ent (ir_node *node);
-void    set_InstOf_ent (ir_node *node, ir_type *ent);
+ir_type *get_InstOf_type (ir_node *node);
+void    set_InstOf_type (ir_node *node, ir_type *type);
 ir_node *get_InstOf_store (ir_node *node);
 void    set_InstOf_store (ir_node *node, ir_node *obj);
 ir_node *get_InstOf_obj (ir_node *node);
index 699d0b0..fa1cf22 100644 (file)
@@ -133,8 +133,8 @@ typedef struct {
 
 /** InstOf attributes */
 typedef struct {
-  ir_type *ent;
-  int dfn;
+  except_attr    exc;           /**< the exception attribute. MUST be the first one. */
+  ir_type *type;                /**< the type of which the object pointer must be */
 } io_attr;
 
 /** Filter attributes */
@@ -152,19 +152,19 @@ typedef struct {
 
 /** CallBegin attributes */
 typedef struct {
-  ir_node * call;               /**< associated Call-operation */
+  ir_node * call;               /**< Associated Call-operation. */
 } callbegin_attr;
 
 /** Cast attributes */
 typedef struct {
-  ir_type *totype;              /**< type of the casted node */
+  ir_type *totype;              /**< Type of the casted node. */
 } cast_attr;
 
 /** Load attributes */
 typedef struct {
-  except_attr    exc;           /**< the exception attribute. MUST be the first one. */
-  ir_mode        *load_mode;    /**< the mode of this Load operation */
-  ent_volatility volatility;     /**< the volatility of a Load/Store operation */
+  except_attr    exc;           /**< The exception attribute. MUST be the first one. */
+  ir_mode        *load_mode;    /**< The mode of this Load operation. */
+  ent_volatility volatility;     /**< The volatility of a Load/Store operation. */
 } load_attr;
 
 /** Store attributes */
@@ -177,21 +177,21 @@ typedef pn_Cmp confirm_attr;    /**< Attribute to hold compare operation */
 
 /** CopyB attribute */
 typedef struct {
-  except_attr    exc;           /**< the exception attribute. MUST be the first one. */
-  ir_type        *data_type;    /**< type of the copied entity */
+  except_attr    exc;           /**< The exception attribute. MUST be the first one. */
+  ir_type        *data_type;    /**< Type of the copied entity. */
 } copyb_attr;
 
 /** Bound attribute */
 typedef struct {
-  except_attr    exc;           /**< the exception attribute. MUST be the first one. */
+  except_attr    exc;           /**< The exception attribute. MUST be the first one. */
 } bound_attr;
 
 /**
  * Edge info to put into an irn.
  */
 typedef struct _irn_edge_info_t {
-  struct list_head outs_head;  /**< The list of all outs */
-  int out_count;               /**< number of outs in the list */
+  struct list_head outs_head;  /**< The list of all outs. */
+  int out_count;               /**< Number of outs in the list. */
 } irn_edge_info_t;
 
 
index 14654a4..eacd49a 100644 (file)
@@ -218,7 +218,7 @@ init_op(void)
   op_SymConst  = new_ir_op(iro_SymConst,  "SymConst",  op_pin_state_floats, c,       oparity_zero,     -1, sizeof(symconst_attr), NULL);
 
   op_Sel       = new_ir_op(iro_Sel,       "Sel",       op_pin_state_floats, L,       oparity_any,      -1, sizeof(sel_attr), NULL);
-  op_InstOf    = new_ir_op(iro_InstOf,    "InstOf",    op_pin_state_floats, L,       oparity_any,      -1, sizeof(sel_attr), NULL);
+  op_InstOf    = new_ir_op(iro_InstOf,    "InstOf",    op_pin_state_floats, L|F|H,   oparity_unary,    -1, sizeof(io_attr), NULL);
 
   op_Call      = new_ir_op(iro_Call,      "Call",      op_pin_state_mem_pinned, L|F, oparity_variable, -1, sizeof(call_attr), NULL);
   op_Add       = new_ir_op(iro_Add,       "Add",       op_pin_state_floats, C,       oparity_binary,    0, 0, NULL);