Removed functions for accessing VProj nodes
[libfirm] / ir / ir / irnode.c
index 4d5a0de..ae684ff 100644 (file)
@@ -35,7 +35,6 @@
 #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"
@@ -65,6 +64,7 @@ static const char *pnc_name_arr [] = {
  * returns the pnc name from an pnc constant
  */
 const char *get_pnc_string(int pnc) {
+       assert(pnc >= 0 && pnc < sizeof(pnc_name_arr)/sizeof(pnc_name_arr[0]));
        return pnc_name_arr[pnc];
 }
 
@@ -732,13 +732,13 @@ ir_node  *
 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
@@ -779,7 +779,7 @@ set_Block_graph_arr (ir_node *node, int pos, ir_node *value) {
        node->attr.block.graph_arr[pos+1] = value;
 }
 
-void set_Block_cg_cfgpred_arr(ir_node * node, int arity, ir_node ** in) {
+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);
@@ -797,29 +797,29 @@ void set_Block_cg_cfgpred_arr(ir_node * node, int arity, ir_node ** in) {
        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;
 }
@@ -846,6 +846,18 @@ void set_Block_extbb(ir_node *block, ir_extblk *extblk) {
        block->attr.block.extblk = extblk;
 }
 
+/* returns the macro block header of a block. */
+ir_node *get_Block_MacroBlock(const ir_node *block) {
+       assert(is_Block(block));
+       return get_irn_n(block, -1);
+}
+
+/* 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
 get_End_n_keepalives(ir_node *end) {
        assert(end->op == op_End);
@@ -859,7 +871,7 @@ get_End_keepalive(ir_node *end, int pos) {
 }
 
 void
-add_End_keepalive (ir_node *end, ir_node *ka) {
+add_End_keepalive(ir_node *end, ir_node *ka) {
        assert(end->op == op_End);
        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);
@@ -1037,7 +1049,7 @@ set_Return_res(ir_node *node, int pos, ir_node *res){
        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);
 }
 
@@ -1579,7 +1591,7 @@ get_Phi_preds_arr(ir_node *node) {
 }
 
 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));
 }
@@ -1591,7 +1603,7 @@ void set_Phi_n_preds(ir_node *node, int n_preds) {
 */
 
 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);
 }
@@ -1910,16 +1922,6 @@ set_Proj_pred(ir_node *node, ir_node *pred) {
        set_irn_n(node, 0, pred);
 }
 
-long get_VProj_proj(const ir_node *node)
-{
-       return node->attr.proj;
-}
-
-void set_VProj_proj(ir_node *node, long value)
-{
-       node->attr.proj = value;
-}
-
 long
 get_Proj_proj(const ir_node *node) {
        assert(is_Proj(node));
@@ -2000,17 +2002,16 @@ void set_Confirm_bound(ir_node *node, ir_node *bound) {
        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);
@@ -2331,6 +2332,47 @@ void set_Pin_op(ir_node *pin, ir_node *node) {
        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 *
@@ -2493,6 +2535,11 @@ int
        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);
@@ -2523,6 +2570,11 @@ int
        return _is_Sub(node);
 }
 
+int
+(is_Tuple)(const ir_node *node) {
+       return _is_Tuple(node);
+}
+
 int
 (is_Start)(const ir_node *node) {
   return _is_Start(node);
@@ -2654,6 +2706,12 @@ int
        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);
@@ -2684,7 +2742,7 @@ is_fragile_op(const ir_node *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:
@@ -2704,6 +2762,19 @@ ir_node *get_fragile_op_mem(ir_node *node) {
        }
 }
 
+/* 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);
@@ -2774,7 +2845,7 @@ const char *get_cond_jmp_predicate_name(cond_jmp_predicate pred) {
 }
 
 /* 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);
 }