assert(irg);
assert(op);
assert(mode);
- p = obstack_alloc(irg->obst, node_size);
+ p = (char*)obstack_alloc(irg->obst, node_size);
memset(p, 0, node_size);
res = (ir_node *)(p + add_node_size);
_set_irn_mode(node, mode);
}
-/** Gets the string representation of the mode .*/
-const char *get_irn_modename(const ir_node *node)
-{
- assert(node);
- return get_mode_name(node->mode);
-}
-
-ident *get_irn_modeident(const ir_node *node)
-{
- assert(node);
- return get_mode_ident(node->mode);
-}
-
ir_op *(get_irn_op)(const ir_node *node)
{
return _get_irn_op(node);
set_irn_n(node, -1, block);
}
-/* this works for all except Block */
-ir_node *get_nodes_MacroBlock(const ir_node *node)
-{
- assert(node->op != op_Block);
- return get_Block_MacroBlock(get_irn_n(node, -1));
-}
-
/* Test whether arbitrary node is frame pointer, i.e. Proj(pn_Start_P_frame_base)
* from Start. If so returns frame type, else Null. */
ir_type *is_frame_pointer(const ir_node *n)
block->attr.block.extblk = extblk;
}
-/* Returns the macro block header of a block.*/
-ir_node *get_Block_MacroBlock(const ir_node *block)
-{
- ir_node *mbh;
- assert(is_Block(block));
- mbh = get_irn_n(block, -1);
- /* once macro block header is respected by all optimizations,
- this assert can be removed */
- assert(mbh != NULL);
- return mbh;
-}
-
-/* Sets the macro block header of a block. */
-void set_Block_MacroBlock(ir_node *block, ir_node *mbh)
-{
- assert(is_Block(block));
- mbh = skip_Id(mbh);
- assert(is_Block(mbh));
- set_irn_n(block, -1, 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)
{
}
-/* The source language type. Must be an atomic type. Mode of type must
- be mode of node. For tarvals from entities type must be pointer to
- entity type. */
-ir_type *get_Const_type(const ir_node *node)
-{
- assert(is_Const(node));
- return node->attr.con.tp;
-}
-
-void set_Const_type(ir_node *node, ir_type *tp)
-{
- assert(is_Const(node));
- if (tp != firm_unknown_type) {
- assert(is_atomic_type(tp));
- assert(get_type_mode(tp) == get_irn_mode(node));
- }
- node->attr.con.tp = tp;
-}
-
symconst_kind get_SymConst_kind(const ir_node *node)
{
node->attr.symc.sym = sym;
}
-ir_type *get_SymConst_value_type(const ir_node *node)
-{
- assert(is_SymConst(node));
- return node->attr.symc.tp;
-}
-
-void set_SymConst_value_type(ir_node *node, ir_type *tp)
-{
- assert(is_SymConst(node));
- node->attr.symc.tp = tp;
-}
-
int get_Sel_n_indexs(const ir_node *node)
{
assert(is_Sel(node));
int is_memop(const ir_node *node)
{
- ir_opcode code = get_irn_opcode(node);
+ unsigned code = get_irn_opcode(node);
return (code == iro_Load || code == iro_Store);
}
ir_volatility get_Load_volatility(const ir_node *node)
{
assert(is_Load(node));
- return node->attr.load.volatility;
+ return (ir_volatility)node->attr.load.volatility;
}
void set_Load_volatility(ir_node *node, ir_volatility volatility)
ir_align get_Load_align(const ir_node *node)
{
assert(is_Load(node));
- return node->attr.load.aligned;
+ return (ir_align)node->attr.load.aligned;
}
void set_Load_align(ir_node *node, ir_align align)
ir_volatility get_Store_volatility(const ir_node *node)
{
assert(is_Store(node));
- return node->attr.store.volatility;
+ return (ir_volatility)node->attr.store.volatility;
}
void set_Store_volatility(ir_node *node, ir_volatility volatility)
ir_align get_Store_align(const ir_node *node)
{
assert(is_Store(node));
- return node->attr.store.aligned;
+ return (ir_align)node->attr.store.aligned;
}
void set_Store_align(ir_node *node, ir_align align)
add_irn_n(node, pred);
}
-/* Returns the source language type of a Proj node. */
-ir_type *get_Proj_type(const ir_node *n)
-{
- ir_type *tp = firm_unknown_type;
- ir_node *pred = get_Proj_pred(n);
-
- switch (get_irn_opcode(pred)) {
- case iro_Proj: {
- ir_node *pred_pred;
- /* Deal with Start / Call here: we need to know the Proj Nr. */
- assert(get_irn_mode(pred) == mode_T);
- pred_pred = get_Proj_pred(pred);
-
- if (is_Start(pred_pred)) {
- ir_type *mtp = get_entity_type(get_irg_entity(get_irn_irg(pred_pred)));
- tp = get_method_param_type(mtp, get_Proj_proj(n));
- } else if (is_Call(pred_pred)) {
- ir_type *mtp = get_Call_type(pred_pred);
- tp = get_method_res_type(mtp, get_Proj_proj(n));
- }
- } break;
- case iro_Start: break;
- case iro_Call: break;
- case iro_Load: {
- ir_node *a = get_Load_ptr(pred);
- if (is_Sel(a))
- tp = get_entity_type(get_Sel_entity(a));
- } break;
- default:
- break;
- }
- return tp;
-}
-
-long get_Proj_proj(const ir_node *node)
-{
- assert(is_Proj(node));
- return node->attr.proj;
-}
-
-void set_Proj_proj(ir_node *node, long proj)
+int (is_arg_Proj)(const ir_node *node)
{
- assert(is_Proj(node));
- node->attr.proj = proj;
+ return _is_arg_Proj(node);
}
-int (is_arg_Proj)(const ir_node *node)
+pn_Cmp (get_Proj_pn_cmp)(const ir_node *node)
{
- return _is_arg_Proj(node);
+ return _get_Proj_pn_cmp(node);
}
ir_node **get_Tuple_preds_arr(ir_node *node)
*
* Note: This function takes 10% of mostly ANY the compiler run, so it's
* a little bit "hand optimized".
- *
- * Moreover, it CANNOT be switched off using get_opt_normalize() ...
*/
ir_node *skip_Id(ir_node *node)
{
_copy_node_attr(irg, old_node, new_node);
}
-/* Return the type associated with the value produced by n
- * if the node remarks this type as it is the case for
- * Cast, Const, SymConst and some Proj nodes. */
-ir_type *(get_irn_type)(ir_node *node)
-{
- return _get_irn_type(node);
-}
-
/* Return the type attribute of a node n (SymConst, Call, Alloc, Free,
Cast) or NULL.*/
ir_type *(get_irn_type_attr)(ir_node *node)
#undef X
}
-/** the get_type operation must be always implemented and return a firm type */
-static ir_type *get_Default_type(const ir_node *n)
-{
- (void) n;
- return get_unknown_type();
-}
-
-/* Sets the get_type operation for an ir_op_ops. */
-ir_op_ops *firm_set_default_get_type(ir_opcode code, ir_op_ops *ops)
-{
- switch (code) {
- case iro_Const: ops->get_type = get_Const_type; break;
- case iro_SymConst: ops->get_type = get_SymConst_value_type; break;
- case iro_Cast: ops->get_type = get_Cast_type; break;
- case iro_Proj: ops->get_type = get_Proj_type; break;
- default:
- /* not allowed to be NULL */
- if (! ops->get_type)
- ops->get_type = get_Default_type;
- break;
- }
- return ops;
-}
-
/** Return the attribute type of a SymConst node if exists */
static ir_type *get_SymConst_attr_type(const ir_node *self)
{