/*
- * Project: libFIRM
- * File name: ir/ir/irnode.c
- * Purpose: Representation of an intermediate operation.
- * Author: Martin Trapp, Christian Schaefer
- * Modified by: Goetz Lindenmaier, Michael Beck
- * Created:
- * CVS-ID: $Id$
- * Copyright: (c) 1998-2006 Universität Karlsruhe
- * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
+ * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved.
+ *
+ * This file is part of libFirm.
+ *
+ * This file may be distributed and/or modified under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation and appearing in the file LICENSE.GPL included in the
+ * packaging of this file.
+ *
+ * Licensees holding valid libFirm Professional Edition licenses may use
+ * this file in accordance with the libFirm Commercial License.
+ * Agreement provided with the Software.
+ *
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
*/
+/**
+ * @file
+ * @brief Representation of an intermediate operation.
+ * @author Martin Trapp, Christian Schaefer, Goetz Lindenmaier, Michael Beck
+ * @version $Id$
+ */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "irnode_t.h"
#include "irgraph_t.h"
#include "irmode_t.h"
-#include "typegmod.h"
#include "irbackedge_t.h"
#include "irdump.h"
#include "irop_t.h"
* returns the pnc name from an pnc constant
*/
const char *get_pnc_string(int pnc) {
+ assert(pnc >= 0 && pnc <
+ (int) (sizeof(pnc_name_arr)/sizeof(pnc_name_arr[0])));
return pnc_name_arr[pnc];
}
/* register new space for every node */
-unsigned register_additional_node_data(unsigned size) {
+unsigned firm_register_additional_node_data(unsigned size) {
assert(!forbid_new_data && "Too late to register additional node data");
if (forbid_new_data)
* If arity is negative, a node with a dynamic array is created.
*/
ir_node *
-new_ir_node (dbg_info *db, ir_graph *irg, ir_node *block, ir_op *op, ir_mode *mode,
- int arity, ir_node **in)
+new_ir_node(dbg_info *db, ir_graph *irg, ir_node *block, ir_op *op, ir_mode *mode,
+ int arity, ir_node **in)
{
ir_node *res;
size_t node_size = offsetof(ir_node, attr) + op->attr_size + firm_add_node_size;
char *p;
- int i, is_bl;
+ int i;
assert(irg && op && mode);
- p = obstack_alloc (irg->obst, node_size);
+ p = obstack_alloc(irg->obst, node_size);
memset(p, 0, node_size);
- res = (ir_node *) (p + firm_add_node_size);
+ res = (ir_node *)(p + firm_add_node_size);
res->kind = k_ir_node;
res->op = op;
res->deps = NULL;
if (arity < 0) {
- res->in = NEW_ARR_F (ir_node *, 1); /* 1: space for block */
+ res->in = NEW_ARR_F(ir_node *, 1); /* 1: space for block */
} else {
- res->in = NEW_ARR_D (ir_node *, irg->obst, (arity+1));
- memcpy (&res->in[1], in, sizeof (ir_node *) * arity);
+ res->in = NEW_ARR_D(ir_node *, irg->obst, (arity+1));
+ memcpy(&res->in[1], in, sizeof(ir_node *) * arity);
}
res->in[0] = block;
res->node_nr = get_irp_new_node_nr();
#endif
- for(i = 0; i < EDGE_KIND_LAST; ++i)
+ for (i = 0; i < EDGE_KIND_LAST; ++i)
INIT_LIST_HEAD(&res->edge_info[i].outs_head);
- is_bl = is_Block(res);
- for (i = is_bl; i <= arity; ++i)
+ /* don't put this into the for loop, arity is -1 for some nodes! */
+ edges_notify_edge(res, -1, res->in[0], NULL, irg);
+ for (i = 1; i <= arity; ++i)
edges_notify_edge(res, i - 1, res->in[i], NULL, irg);
hook_new_node(irg, res);
node->in[n + 1] = in;
}
+int add_irn_n(ir_node *node, ir_node *in)
+{
+ int pos;
+ ir_graph *irg = get_irn_irg(node);
+
+ assert(node->op->opar == oparity_dynamic);
+ pos = ARR_LEN(node->in) - 1;
+ ARR_APP1(ir_node *, node->in, in);
+ edges_notify_edge(node, pos, node->in[pos + 1], NULL, irg);
+
+ /* Call the hook */
+ hook_set_irn_n(node, pos, node->in[pos + 1], NULL);
+
+ return pos;
+}
+
int
(get_irn_deps)(const ir_node *node)
{
return res;
}
-void add_irn_deps(ir_node *tgt, ir_node *src)
-{
+void add_irn_deps(ir_node *tgt, ir_node *src) {
int i, n;
- for(i = 0, n = get_irn_deps(src); i < n; ++i)
+ for (i = 0, n = get_irn_deps(src); i < n; ++i)
add_irn_dep(tgt, get_irn_dep(src, i));
}
_set_irn_op(node, op);
}
-ir_opcode
+unsigned
(get_irn_opcode)(const ir_node *node) {
return _get_irn_opcode(node);
}
const char *
get_irn_opname(const ir_node *node) {
assert(node);
- if ((get_irn_op((ir_node *)node) == op_Phi) &&
- (get_irg_phase_state(get_irn_irg((ir_node *)node)) == phase_building) &&
- (get_irn_arity((ir_node *)node) == 0)) return "Phi0";
+ if (is_Phi0(node)) return "Phi0";
return get_id_str(node->op->name);
}
}
#else
/* Dummies needed for firmjni. */
-struct abstval *get_irn_abst_value(ir_node *n) { return NULL; }
-void set_irn_abst_value(ir_node *n, struct abstval *os) {}
-struct section *firm_get_irn_section(ir_node *n) { return NULL; }
-void firm_set_irn_section(ir_node *n, struct section *s) {}
+struct abstval *get_irn_abst_value(ir_node *n) {
+ (void) n;
+ return NULL;
+}
+void set_irn_abst_value(ir_node *n, struct abstval *os) {
+ (void) n;
+ (void) os;
+}
+struct section *firm_get_irn_section(ir_node *n) {
+ (void) n;
+ return NULL;
+}
+void firm_set_irn_section(ir_node *n, struct section *s) {
+ (void) n;
+ (void) s;
+}
#endif /* DO_HEAPANALYSIS */
#endif
}
-const_attr
+const_attr *
get_irn_const_attr(ir_node *node) {
assert(node->op == op_Const);
- return node->attr.con;
+ return &node->attr.con;
}
long
return node->attr.proj;
}
-alloc_attr
+alloc_attr *
get_irn_alloc_attr(ir_node *node) {
assert(node->op == op_Alloc);
- return node->attr.alloc;
+ return &node->attr.alloc;
}
-free_attr
+free_attr *
get_irn_free_attr(ir_node *node) {
assert(node->op == op_Free);
- return node->attr.free;
+ return &node->attr.free;
}
-symconst_attr
+symconst_attr *
get_irn_symconst_attr(ir_node *node) {
assert(node->op == op_SymConst);
- return node->attr.symc;
+ return &node->attr.symc;
}
ir_type *
return node->attr.call.cld_tp = skip_tid(node->attr.call.cld_tp);
}
-sel_attr
+sel_attr *
get_irn_sel_attr(ir_node *node) {
assert(node->op == op_Sel);
- return node->attr.sel;
+ return &node->attr.sel;
}
int
-get_irn_phi_attr(ir_node *node) {
- assert(node->op == op_Phi);
- return node->attr.phi0_pos;
+get_irn_phi0_attr(ir_node *node) {
+ assert(is_Phi0(node));
+ return node->attr.phi0.pos;
}
-block_attr
+block_attr *
get_irn_block_attr(ir_node *node) {
assert(node->op == op_Block);
- return node->attr.block;
+ return &node->attr.block;
}
-load_attr
-get_irn_load_attr(ir_node *node)
-{
- assert(node->op == op_Load);
- return node->attr.load;
+load_attr *
+get_irn_load_attr(ir_node *node) {
+ assert(node->op == op_Load);
+ return &node->attr.load;
}
-store_attr
-get_irn_store_attr(ir_node *node)
-{
- assert(node->op == op_Store);
- return node->attr.store;
+store_attr *
+get_irn_store_attr(ir_node *node) {
+ assert(node->op == op_Store);
+ return &node->attr.store;
}
-except_attr
+except_attr *
get_irn_except_attr(ir_node *node) {
assert(node->op == op_Div || node->op == op_Quot ||
node->op == op_DivMod || node->op == op_Mod || node->op == op_Call || node->op == op_Alloc);
- return node->attr.except;
+ return &node->attr.except;
}
-void *
-get_irn_generic_attr(ir_node *node) {
- return &node->attr;
+void *(get_irn_generic_attr)(ir_node *node) {
+ assert(is_ir_node(node));
+ return _get_irn_generic_attr(node);
+}
+
+const void *(get_irn_generic_attr_const)(const ir_node *node) {
+ assert(is_ir_node(node));
+ return _get_irn_generic_attr_const(node);
}
unsigned (get_irn_idx)(const ir_node *node) {
ir_node *
get_nodes_block(const ir_node *node) {
assert(node->op != op_Block);
- assert(is_irn_pinned_in_irg(node) && "block info may be incorrect");
return get_irn_n(node, -1);
}
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(ir_node *n) {
int
get_Block_matured(ir_node *node) {
assert(node->op == op_Block);
- return (int)node->attr.block.matured;
+ return (int)node->attr.block.is_matured;
}
void
set_Block_matured(ir_node *node, int matured) {
assert(node->op == op_Block);
- node->attr.block.matured = matured;
+ node->attr.block.is_matured = matured;
}
unsigned long
-(get_Block_block_visited)(ir_node *node) {
+(get_Block_block_visited)(const ir_node *node) {
return _get_Block_block_visited(node);
}
}
int
-(Block_not_block_visited)(ir_node *node) {
+(Block_not_block_visited)(const ir_node *node) {
return _Block_not_block_visited(node);
}
+int
+(Block_block_visited)(const ir_node *node) {
+ return _Block_block_visited(node);
+}
+
ir_node *
get_Block_graph_arr (ir_node *node, int pos) {
assert(node->op == op_Block);
node->attr.block.graph_arr[pos+1] = value;
}
-void set_Block_cg_cfgpred_arr(ir_node * node, int arity, ir_node ** in) {
+#ifdef INTERPROCEDURAL_VIEW
+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) {
node->attr.block.in_cg = NEW_ARR_D(ir_node *, current_ir_graph->obst, arity + 1);
memcpy(node->attr.block.in_cg + 1, in, sizeof(ir_node *) * arity);
}
-void set_Block_cg_cfgpred(ir_node * node, int pos, ir_node * pred) {
+void set_Block_cg_cfgpred(ir_node *node, int pos, ir_node *pred) {
assert(node->op == op_Block &&
node->attr.block.in_cg &&
0 <= pos && pos < ARR_LEN(node->attr.block.in_cg) - 1);
node->attr.block.in_cg[pos + 1] = pred;
}
-ir_node **get_Block_cg_cfgpred_arr(ir_node * node) {
+ir_node **get_Block_cg_cfgpred_arr(ir_node *node) {
assert(node->op == op_Block);
return node->attr.block.in_cg == NULL ? NULL : node->attr.block.in_cg + 1;
}
-int get_Block_cg_n_cfgpreds(ir_node * node) {
+int get_Block_cg_n_cfgpreds(ir_node *node) {
assert(node->op == op_Block);
return node->attr.block.in_cg == NULL ? 0 : ARR_LEN(node->attr.block.in_cg) - 1;
}
-ir_node *get_Block_cg_cfgpred(ir_node * node, int pos) {
+ir_node *get_Block_cg_cfgpred(ir_node *node, int pos) {
assert(node->op == op_Block && node->attr.block.in_cg);
return node->attr.block.in_cg[pos + 1];
}
-void remove_Block_cg_cfgpred_arr(ir_node * node) {
+void remove_Block_cg_cfgpred_arr(ir_node *node) {
assert(node->op == op_Block);
node->attr.block.in_cg = NULL;
}
+#endif
ir_node *(set_Block_dead)(ir_node *block) {
return _set_Block_dead(block);
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;
+}
+
+/* returns the graph of a Block. */
+ir_graph *get_Block_irg(const ir_node *block) {
+ assert(is_Block(block));
+ return block->attr.block.irg;
+}
+
+int has_Block_label(const ir_node *block) {
+ assert(is_Block(block));
+ return block->attr.block.has_label;
+}
+
+ir_label_t get_Block_label(const ir_node *block) {
+ assert(is_Block(block));
+ return block->attr.block.label;
+}
+
+void set_Block_label(ir_node *block, ir_label_t label) {
+ assert(is_Block(block));
+ block->attr.block.has_label = 1;
+ block->attr.block.label = label;
+}
+
int
get_End_n_keepalives(ir_node *end) {
assert(end->op == op_End);
}
void
-add_End_keepalive (ir_node *end, ir_node *ka) {
- int l;
- ir_graph *irg = get_irn_irg(end);
-
+add_End_keepalive(ir_node *end, ir_node *ka) {
assert(end->op == op_End);
- l = ARR_LEN(end->in);
- ARR_APP1(ir_node *, end->in, ka);
-#ifndef NO_KEEPALIVE_OUT_EDGES
- edges_notify_edge(end, l, end->in[l], NULL, irg);
-#endif /* NO_KEEPALIVE_OUT_EDGES */
+ assert((is_Phi(ka) || is_Proj(ka) || is_Block(ka) || is_irn_keep(ka)) && "Only Phi, Block or Keep nodes can be kept alive!");
+ add_irn_n(end, ka);
}
void
set_End_keepalive(ir_node *end, int pos, ir_node *ka) {
assert(end->op == op_End);
- end->in[pos + 1 + END_KEEPALIVE_OFFSET] = ka;
-#ifndef NO_KEEPALIVE_OUT_EDGES
set_irn_n(end, pos + END_KEEPALIVE_OFFSET, ka);
-#endif /* NO_KEEPALIVE_OUT_EDGES */
}
/* Set new keep-alives */
int i;
ir_graph *irg = get_irn_irg(end);
-#ifndef NO_KEEPALIVE_OUT_EDGES
/* notify that edges are deleted */
- for (i = 1 + END_KEEPALIVE_OFFSET; i < ARR_LEN(end->in); ++i) {
- edges_notify_edge(end, i, NULL, end->in[i], irg);
+ for (i = END_KEEPALIVE_OFFSET; i < ARR_LEN(end->in) - 1; ++i) {
+ edges_notify_edge(end, i, NULL, end->in[i + 1], irg);
}
-#endif /* NO_KEEPALIVE_OUT_EDGES */
ARR_RESIZE(ir_node *, end->in, n + 1 + END_KEEPALIVE_OFFSET);
for (i = 0; i < n; ++i) {
end->in[1 + END_KEEPALIVE_OFFSET + i] = in[i];
-#ifndef NO_KEEPALIVE_OUT_EDGES
- edges_notify_edge(end, 1 + END_KEEPALIVE_OFFSET + i, end->in[1 + END_KEEPALIVE_OFFSET + i], NULL, irg);
-#endif /* NO_KEEPALIVE_OUT_EDGES */
+ edges_notify_edge(end, END_KEEPALIVE_OFFSET + i, end->in[1 + END_KEEPALIVE_OFFSET + i], NULL, irg);
}
}
set_irn_n(node, pos + RETURN_RESULT_OFFSET, res);
}
-tarval *(get_Const_tarval)(ir_node *node) {
+tarval *(get_Const_tarval)(const ir_node *node) {
return _get_Const_tarval(node);
}
node->attr.con.tv = con;
}
-cnst_classify_t (classify_Const)(ir_node *node) {
- return _classify_Const(node);
+int (is_Const_null)(const ir_node *node) {
+ return _is_Const_null(node);
+}
+
+int (is_Const_one)(const ir_node *node) {
+ return _is_Const_one(node);
+}
+
+int (is_Const_all_one)(const ir_node *node) {
+ return _is_Const_all_one(node);
}
}
ident *
-get_SymConst_name(ir_node *node) {
+get_SymConst_name(const ir_node *node) {
assert(node->op == op_SymConst && SYMCONST_HAS_ID(get_SymConst_kind(node)));
return node->attr.symc.sym.ident_p;
}
/* Only to access SymConst of kind symconst_addr_ent. Else assertion: */
-ir_entity *get_SymConst_entity(ir_node *node) {
+ir_entity *get_SymConst_entity(const ir_node *node) {
assert(node->op == op_SymConst && SYMCONST_HAS_ENT(get_SymConst_kind(node)));
return node->attr.symc.sym.entity_p;
}
node->attr.symc.sym.entity_p = ent;
}
-ir_enum_const *get_SymConst_enum(ir_node *node) {
+ir_enum_const *get_SymConst_enum(const ir_node *node) {
assert(node->op == op_SymConst && SYMCONST_HAS_ENUM(get_SymConst_kind(node)));
return node->attr.symc.sym.enum_p;
}
}
union symconst_symbol
-get_SymConst_symbol(ir_node *node) {
+get_SymConst_symbol(const ir_node *node) {
assert(node->op == op_SymConst);
return node->attr.symc.sym;
}
node->attr.symc.sym = sym;
}
+ir_label_t get_SymConst_label(const ir_node *node) {
+ assert(node->op == op_SymConst && SYMCONST_HAS_LABEL(get_SymConst_kind(node)));
+ return node->attr.symc.sym.label;
+}
+
+void set_SymConst_label(ir_node *node, ir_label_t label) {
+ assert(node->op == op_SymConst && SYMCONST_HAS_LABEL(get_SymConst_kind(node)));
+ node->attr.symc.sym.label = label;
+}
+
ir_type *
get_SymConst_value_type(ir_node *node) {
assert(node->op == op_SymConst);
#define BINOP(OP) \
-ir_node * get_##OP##_left(ir_node *node) { \
+ir_node * get_##OP##_left(const ir_node *node) { \
assert(node->op == op_##OP); \
return get_irn_n(node, node->op->op_index); \
} \
assert(node->op == op_##OP); \
set_irn_n(node, node->op->op_index, left); \
} \
-ir_node *get_##OP##_right(ir_node *node) { \
+ir_node *get_##OP##_right(const ir_node *node) { \
assert(node->op == op_##OP); \
return get_irn_n(node, node->op->op_index + 1); \
} \
}
#define UNOP(OP) \
-ir_node *get_##OP##_op(ir_node *node) { \
+ir_node *get_##OP##_op(const ir_node *node) { \
assert(node->op == op_##OP); \
return get_irn_n(node, node->op->op_index); \
} \
set_irn_n(node, 0, mem); \
}
+#define DIVOP(OP) \
+BINOP_MEM(OP) \
+ \
+ir_mode *get_##OP##_resmode(const ir_node *node) { \
+ assert(node->op == op_##OP); \
+ return node->attr.divmod.res_mode; \
+} \
+ \
+void set_##OP##_resmode(ir_node *node, ir_mode *mode) { \
+ assert(node->op == op_##OP); \
+ node->attr.divmod.res_mode = mode; \
+}
+
+
BINOP(Add)
BINOP(Sub)
UNOP(Minus)
BINOP(Mul)
-BINOP_MEM(Quot)
-BINOP_MEM(DivMod)
-BINOP_MEM(Div)
-BINOP_MEM(Mod)
+BINOP(Mulh)
+DIVOP(Quot)
+DIVOP(DivMod)
+DIVOP(Div)
+DIVOP(Mod)
UNOP(Abs)
BINOP(And)
BINOP(Or)
}
ir_node *
-get_unop_op(ir_node *node) {
+get_unop_op(const ir_node *node) {
if (node->op->opar == oparity_unary)
return get_irn_n(node, node->op->op_index);
}
ir_node *
-get_binop_left(ir_node *node) {
+get_binop_left(const ir_node *node) {
assert(node->op->opar == oparity_binary);
return get_irn_n(node, node->op->op_index);
}
}
ir_node *
-get_binop_right(ir_node *node) {
+get_binop_right(const ir_node *node) {
assert(node->op->opar == oparity_binary);
return get_irn_n(node, node->op->op_index + 1);
}
}
int
-get_Phi_n_preds(ir_node *node) {
+get_Phi_n_preds(const ir_node *node) {
assert(is_Phi(node) || is_Phi0(node));
return (get_irn_arity(node));
}
*/
ir_node *
-get_Phi_pred(ir_node *node, int pos) {
+get_Phi_pred(const ir_node *node, int pos) {
assert(is_Phi(node) || is_Phi0(node));
return get_irn_n(node, pos);
}
node->attr.load.volatility = volatility;
}
+ir_align
+get_Load_align(ir_node *node) {
+ assert(node->op == op_Load);
+ return node->attr.load.aligned;
+}
+
+void
+set_Load_align(ir_node *node, ir_align align) {
+ assert(node->op == op_Load);
+ node->attr.load.aligned = align;
+}
+
ir_node *
get_Store_mem(ir_node *node) {
node->attr.store.volatility = volatility;
}
+ir_align
+get_Store_align(ir_node *node) {
+ assert(node->op == op_Store);
+ return node->attr.store.aligned;
+}
+
+void
+set_Store_align(ir_node *node, ir_align align) {
+ assert(node->op == op_Store);
+ node->attr.store.aligned = align;
+}
+
ir_node *
get_Alloc_mem(ir_node *node) {
/* Add a new Sync predecessor */
void add_Sync_pred(ir_node *node, ir_node *pred) {
- int l;
- ir_graph *irg = get_irn_irg(node);
-
assert(node->op == op_Sync);
- l = ARR_LEN(node->in);
- ARR_APP1(ir_node *, node->in, pred);
- edges_notify_edge(node, l, node->in[l], NULL, irg);
+ add_irn_n(node, pred);
}
/* Returns the source language type of a Proj node. */
set_irn_n(node, 0, bound);
}
-pn_Cmp get_Confirm_cmp(ir_node *node) {
+pn_Cmp get_Confirm_cmp(const ir_node *node) {
assert(node->op == op_Confirm);
- return node->attr.confirm_cmp;
+ return node->attr.confirm.cmp;
}
void set_Confirm_cmp(ir_node *node, pn_Cmp cmp) {
assert(node->op == op_Confirm);
- node->attr.confirm_cmp = cmp;
+ node->attr.confirm.cmp = cmp;
}
-
ir_node *
get_Filter_pred(ir_node *node) {
assert(node->op == op_Filter);
}
/* Return the operand of a Pin node. */
-ir_node *get_Pin_op(ir_node *pin) {
+ir_node *get_Pin_op(const ir_node *pin) {
assert(pin->op == op_Pin);
return get_irn_n(pin, 0);
}
set_irn_n(pin, 0, node);
}
+/* Return the assembler text of an ASM pseudo node. */
+ident *get_ASM_text(const ir_node *node) {
+ assert(node->op == op_ASM);
+ return node->attr.assem.asm_text;
+}
+
+/* Return the number of input constraints for an ASM node. */
+int get_ASM_n_input_constraints(const ir_node *node) {
+ assert(node->op == op_ASM);
+ return ARR_LEN(node->attr.assem.inputs);
+}
+
+/* Return the input constraints for an ASM node. This is a flexible array. */
+const ir_asm_constraint *get_ASM_input_constraints(const ir_node *node) {
+ assert(node->op == op_ASM);
+ return node->attr.assem.inputs;
+}
+
+/* Return the number of output constraints for an ASM node. */
+int get_ASM_n_output_constraints(const ir_node *node) {
+ assert(node->op == op_ASM);
+ return ARR_LEN(node->attr.assem.outputs);
+}
+
+/* Return the output constraints for an ASM node. */
+const ir_asm_constraint *get_ASM_output_constraints(const ir_node *node) {
+ assert(node->op == op_ASM);
+ return node->attr.assem.outputs;
+}
+
+/* Return the number of clobbered registers for an ASM node. */
+int get_ASM_n_clobbers(const ir_node *node) {
+ assert(node->op == op_ASM);
+ return ARR_LEN(node->attr.assem.clobber);
+}
+
+/* Return the list of clobbered registers for an ASM node. */
+ident **get_ASM_clobbers(const ir_node *node) {
+ assert(node->op == op_ASM);
+ return node->attr.assem.clobber;
+}
/* returns the graph of a node */
ir_graph *
return _is_NoMem(node);
}
+int
+(is_Minus)(const ir_node *node) {
+ return _is_Minus(node);
+}
+
int
(is_Mod)(const ir_node *node) {
return _is_Mod(node);
return _is_Quot(node);
}
+int
+(is_Add)(const ir_node *node) {
+ return _is_Add(node);
+}
+
+int
+(is_And)(const ir_node *node) {
+ return _is_And(node);
+}
+
+int
+(is_Or)(const ir_node *node) {
+ return _is_Or(node);
+}
+
+int
+(is_Eor)(const ir_node *node) {
+ return _is_Eor(node);
+}
+
+int
+(is_Sub)(const ir_node *node) {
+ return _is_Sub(node);
+}
+
+int
+(is_Shl)(const ir_node *node) {
+ return _is_Shl(node);
+}
+
+int
+(is_Shr)(const ir_node *node) {
+ return _is_Shr(node);
+}
+
+int
+(is_Shrs)(const ir_node *node) {
+ return _is_Shrs(node);
+}
+
+int
+(is_Rot)(const ir_node *node) {
+ return _is_Rot(node);
+}
+
+int
+(is_Not)(const ir_node *node) {
+ return _is_Not(node);
+}
+
+int
+(is_Psi)(const ir_node *node) {
+ return _is_Psi(node);
+}
+
+int
+(is_Tuple)(const ir_node *node) {
+ return _is_Tuple(node);
+}
+
int
(is_Start)(const ir_node *node) {
return _is_Start(node);
return _is_Const(node);
}
+int
+(is_Conv)(const ir_node *node) {
+ return _is_Conv(node);
+}
+
+int
+(is_Cast)(const ir_node *node) {
+ return _is_Cast(node);
+}
+
int
(is_no_Block)(const ir_node *node) {
return _is_no_Block(node);
return _is_Raise(node);
}
+/* returns true if a node is an ASM node. */
+int
+(is_ASM)(const ir_node *node) {
+ return _is_ASM(node);
+}
+
int
is_Proj(const ir_node *node) {
assert(node);
ir_node *get_fragile_op_mem(ir_node *node) {
assert(node && is_fragile_op(node));
- switch (get_irn_opcode (node)) {
+ switch (get_irn_opcode(node)) {
case iro_Call :
case iro_Quot :
case iro_DivMod:
}
}
+/* Returns the result mode of a Div operation. */
+ir_mode *get_divop_resmod(const ir_node *node) {
+ switch (get_irn_opcode(node)) {
+ case iro_Quot : return get_Quot_resmode(node);
+ case iro_DivMod: return get_DivMod_resmode(node);
+ case iro_Div : return get_Div_resmode(node);
+ case iro_Mod : return get_Mod_resmode(node);
+ default: ;
+ assert(0 && "should not be reached");
+ return NULL;
+ }
+}
+
/* Returns true if the operation is a forking control flow operation. */
int (is_irn_forking)(const ir_node *node) {
return _is_irn_forking(node);
}
/* Returns the conditional jump prediction of a Cond node. */
-cond_jmp_predicate (get_Cond_jmp_pred)(ir_node *cond) {
+cond_jmp_predicate (get_Cond_jmp_pred)(const ir_node *cond) {
return _get_Cond_jmp_pred(cond);
}
/** the get_type operation must be always implemented and return a firm type */
static ir_type *get_Default_type(ir_node *n) {
+ (void) n;
return get_unknown_type();
}
/** the get_type_attr operation must be always implemented */
static ir_type *get_Null_type(ir_node *n) {
+ (void) n;
return firm_unknown_type;
}
/** the get_entity_attr operation must be always implemented */
static ir_entity *get_Null_ent(ir_node *n) {
+ (void) n;
return NULL;
}
return ops;
}
+/* Sets the debug information of a node. */
+void (set_irn_dbg_info)(ir_node *n, dbg_info *db) {
+ _set_irn_dbg_info(n, db);
+}
+
+/**
+ * Returns the debug information of an node.
+ *
+ * @param n The node.
+ */
+dbg_info *(get_irn_dbg_info)(const ir_node *n) {
+ return _get_irn_dbg_info(n);
+}
+
+
+
#ifdef DEBUG_libfirm
void dump_irn(ir_node *n) {
int i, arity = get_irn_arity(n);