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;
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);
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;
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,
}
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 *
* 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)
* ----------------------------------------------------------
*
/** 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.
*
/** 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.
*
/** 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.
*
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.
*
}
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 *
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);
/** 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 */
/** 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 */
/** 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;
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);