get_divop_resmod() added
[libfirm] / ir / ir / irnode.h
index 55bb437..a523b26 100644 (file)
@@ -131,7 +131,7 @@ int add_irn_dep(ir_node *node, ir_node *dep);
 
 /**
  * Copy all dependencies from a node to another.
- * @param tgt The node which sould be enriched.
+ * @param tgt The node which should be enriched.
  * @param src The node whose dependencies shall be copied.
  */
 void add_irn_deps(ir_node *tgt, ir_node *src);
@@ -378,22 +378,25 @@ int       Block_block_visited(const ir_node *node);
  * predecessors are removed, the node has the same predecessors in
  * both views.
  * @@@ Maybe better:  arity is zero if no cg preds. */
-void      set_Block_cg_cfgpred_arr(ir_node * node, int arity, ir_node ** in);
-void      set_Block_cg_cfgpred(ir_node * node, int pos, ir_node * pred);
+void      set_Block_cg_cfgpred_arr(ir_node *node, int arity, ir_node *in[]);
+void      set_Block_cg_cfgpred(ir_node *node, int pos, ir_node *pred);
 /* @@@ not supported */
-ir_node **get_Block_cg_cfgpred_arr(ir_node * node);
+ir_node **get_Block_cg_cfgpred_arr(ir_node *node);
 /** Returns the number of interprocedural predecessors.  0 if none. */
-int       get_Block_cg_n_cfgpreds(ir_node * node);
+int       get_Block_cg_n_cfgpreds(ir_node *node);
 /** Return the interprocedural predecessor at position pos. */
-ir_node  *get_Block_cg_cfgpred(ir_node * node, int pos);
-/* frees the memory. */
-void      remove_Block_cg_cfgpred_arr(ir_node * node);
+ir_node  *get_Block_cg_cfgpred(ir_node *node, int pos);
+/** Frees the memory allocated for interprocedural predecessors. */
+void      remove_Block_cg_cfgpred_arr(ir_node *node);
 
-/** returns the extended basic block a block belongs to */
+/** Returns the extended basic block a block belongs to. */
 ir_extblk *get_Block_extbb(const ir_node *block);
-/** sets the extended basic block a block belongs to */
+/** Sets the extended basic block a block belongs to. */
 void set_Block_extbb(ir_node *block, ir_extblk *extblk);
 
+/** Get the Macro Block header of a (sub-) block. */
+ir_node *get_Block_MacroBlock(const ir_node *block);
+
 /** Return the number of Keep alive node. */
 int  get_End_n_keepalives(ir_node *end);
 
@@ -471,6 +474,9 @@ int       get_Return_n_ress(ir_node *node);
 ir_node  *get_Return_res(ir_node *node, int pos);
 void      set_Return_res(ir_node *node, int pos, ir_node *res);
 
+/**
+ * Possible classes for constant classification.
+ */
 typedef enum {
   CNST_NULL     =  0, /**< The node is a const(0). */
   CNST_ONE      = +1, /**< The node is a const(1). */
@@ -480,7 +486,7 @@ typedef enum {
   CNST_NO_CONST =  4  /**< The node is no const at all. */
 } cnst_classify_t;
 
-tarval  *get_Const_tarval(ir_node *node);
+tarval  *get_Const_tarval(const ir_node *node);
 void     set_Const_tarval(ir_node *node, tarval *con);
 
 /**
@@ -594,13 +600,14 @@ void       set_Sel_entity (ir_node *node, ir_entity *ent);
  */
 typedef enum {
   pn_Call_M_regular = 0,       /**< The memory result. */
-  pn_Call_T_result  = 2,       /**< The tuple containing all (0, 1, 2, ...) results */
-  pn_Call_P_value_res_base = 4,/**< A pointer to the memory region containing copied results
+  pn_Call_X_regular = 1,       /**< The control flow result when no exception occurs. */
+  pn_Call_X_except  = 2,       /**< The control flow result branching to the exception handler. */
+  pn_Call_T_result  = 3,       /**< The tuple containing all (0, 1, 2, ...) results. */
+  pn_Call_M_except  = 4,       /**< The memory result in case the called method terminated with
+                                    an exception. */
+  pn_Call_P_value_res_base = 5,/**< A pointer to the memory region containing copied results
                                     passed by value (for compound result types). */
-  pn_Call_X_except  = 1,       /**< The control flow result branching to the exception handler */
-  pn_Call_M_except  = 3,       /**< The memory result in case the called method terminated with
-                                    an exception */
-  pn_Call_max       = 5        /**< number of projections from a Call */
+  pn_Call_max       = 6        /**< number of projections from a Call */
 } pn_Call;   /* Projection numbers for Call. */
 #define pn_Call_M pn_Call_M_regular
 
@@ -693,12 +700,15 @@ ir_node *get_Quot_right(const ir_node *node);
 void     set_Quot_right(ir_node *node, ir_node *right);
 ir_node *get_Quot_mem(ir_node *node);
 void     set_Quot_mem(ir_node *node, ir_node *mem);
+ir_mode *get_Quot_resmode(const ir_node *node);
+void     set_Quot_resmode(ir_node *node, ir_mode *mode);
 
 /**
  * Projection numbers for Quot: use for Proj nodes!
  */
 typedef enum {
-  pn_Quot_M,           /**< Memory result.    */
+  pn_Quot_M,           /**< Memory result. */
+  pn_Quot_X_regular,   /**< Execution result if no exception occurred. */
   pn_Quot_X_except,    /**< Execution result if exception occurred. */
   pn_Quot_res,         /**< Result of computation. */
   pn_Quot_max          /**< number of projections from a Quot */
@@ -710,12 +720,15 @@ ir_node *get_DivMod_right(const ir_node *node);
 void     set_DivMod_right(ir_node *node, ir_node *right);
 ir_node *get_DivMod_mem(ir_node *node);
 void     set_DivMod_mem(ir_node *node, ir_node *mem);
+ir_mode *get_DivMod_resmode(const ir_node *node);
+void     set_DivMod_resmode(ir_node *node, ir_mode *mode);
 
 /**
  * Projection numbers for DivMod: use for Proj nodes!
  */
 typedef enum {
-  pn_DivMod_M,           /**< Memory result.    */
+  pn_DivMod_M,           /**< Memory result. */
+  pn_DivMod_X_regular,   /**< Execution result if no exception occurred. */
   pn_DivMod_X_except,    /**< Execution result if exception occurred. */
   pn_DivMod_res_div,     /**< Result of computation a / b. */
   pn_DivMod_res_mod,     /**< Result of computation a % b. */
@@ -728,12 +741,15 @@ ir_node *get_Div_right(const ir_node *node);
 void     set_Div_right(ir_node *node, ir_node *right);
 ir_node *get_Div_mem(ir_node *node);
 void     set_Div_mem(ir_node *node, ir_node *mem);
+ir_mode *get_Div_resmode(const ir_node *node);
+void     set_Div_resmode(ir_node *node, ir_mode *mode);
 
 /**
  * Projection numbers for Div: use for Proj nodes!
  */
 typedef enum {
-  pn_Div_M,           /**< Memory result.    */
+  pn_Div_M,           /**< Memory result. */
+  pn_Div_X_regular,   /**< Execution result if no exception occurred. */
   pn_Div_X_except,    /**< Execution result if exception occurred. */
   pn_Div_res,         /**< Result of computation. */
   pn_Div_max          /**< number of projections from a Div */
@@ -745,12 +761,15 @@ ir_node *get_Mod_right(const ir_node *node);
 void     set_Mod_right(ir_node *node, ir_node *right);
 ir_node *get_Mod_mem(ir_node *node);
 void     set_Mod_mem(ir_node *node, ir_node *mem);
+ir_mode *get_Mod_resmode(const ir_node *node);
+void     set_Mod_resmode(ir_node *node, ir_mode *mode);
 
 /**
  * Projection numbers for Mod: use for Proj nodes!
  */
 typedef enum {
   pn_Mod_M,           /**< Memory result.    */
+  pn_Mod_X_regular,   /**< Execution result if no exception occurred. */
   pn_Mod_X_except,    /**< Execution result if exception occurred. */
   pn_Mod_res,         /**< Result of computation. */
   pn_Mod_max          /**< number of projections from a Mod */
@@ -883,8 +902,8 @@ int       is_Phi(const ir_node *n);
 int       is_Phi0(const ir_node *n);
 /* These routines also work for Filter nodes in interprocedural view. */
 ir_node **get_Phi_preds_arr(ir_node *node);
-int       get_Phi_n_preds(ir_node *node);
-ir_node  *get_Phi_pred(ir_node *node, int pos);
+int       get_Phi_n_preds(const ir_node *node);
+ir_node  *get_Phi_pred(const ir_node *node, int pos);
 void      set_Phi_pred(ir_node *node, int pos, ir_node *pred);
 
 ir_node  *get_Filter_pred(ir_node *node);
@@ -913,7 +932,8 @@ void     set_memop_ptr(ir_node *node, ir_node *ptr);
  * Projection numbers for Load: use for Proj nodes!
  */
 typedef enum {
-  pn_Load_M,         /**< Memory result.    */
+  pn_Load_M,         /**< Memory result. */
+  pn_Load_X_regular, /**< Execution result if no exception occurred. */
   pn_Load_X_except,  /**< Execution result if exception occurred. */
   pn_Load_res,       /**< Result of load operation. */
   pn_Load_max        /**< number of projections from a Load */
@@ -932,7 +952,8 @@ void           set_Load_volatility(ir_node *node, ir_volatility volatility);
  * Projection numbers for Store: use for Proj nodes!
  */
 typedef enum {
-  pn_Store_M,         /**< Memory result.    */
+  pn_Store_M,         /**< Memory result. */
+  pn_Store_X_regular, /**< Execution result if no exception occurred. */
   pn_Store_X_except,  /**< Execution result if exception occurred. */
   pn_Store_max        /**< number of projections from a Store */
 } pn_Store;  /* Projection numbers for Store. */
@@ -951,6 +972,7 @@ void           set_Store_volatility(ir_node *node, ir_volatility volatility);
  */
 typedef enum {
   pn_Alloc_M,         /**< Memory result. */
+  pn_Alloc_X_regular, /**< Execution result if no exception occurred. */
   pn_Alloc_X_except,  /**< Execution result if exception occurred. */
   pn_Alloc_res,       /**< Result of allocation. */
   pn_Alloc_max        /**< number of projections from an Alloc */
@@ -1047,10 +1069,11 @@ int      get_Psi_n_conds(ir_node *node);
  */
 typedef enum {
   pn_CopyB_M_regular = 0,  /**< The memory result. */
-  pn_CopyB_X_except  = 1,  /**< The control flow result branching to the exception handler */
-  pn_CopyB_M_except  = 2,  /**< The memory result in case the runtime function terminated with
+  pn_CopyB_X_regular = 1,  /**< Execution result if no exception occurred. */
+  pn_CopyB_X_except  = 2,  /**< The control flow result branching to the exception handler */
+  pn_CopyB_M_except  = 3,  /**< The memory result in case the runtime function terminated with
                                 an exception */
-  pn_CopyB_max       = 3   /**< number of projections from a CopyB */
+  pn_CopyB_max       = 4   /**< number of projections from a CopyB */
 } pn_CopyB;   /* Projection numbers for CopyB. */
 #define pn_CopyB_M pn_CopyB_M_regular
 
@@ -1068,11 +1091,12 @@ void     set_CopyB_type(ir_node *node, ir_type *data_type);
  */
 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
+  pn_InstOf_X_regular = 1,   /**< Execution result if no exception occurred. */
+  pn_InstOf_X_except = 2,    /**< The control flow result branching to the exception handler */
+  pn_InstOf_res = 3,         /**< The checked object pointer. */
+  pn_InstOf_M_except = 4,    /**< The memory result in case the runtime function terminated with
                                  an exception */
-  pn_InstOf_max = 4          /**< number of projections from an InstOf */
+  pn_InstOf_max = 5          /**< number of projections from an InstOf */
 } pn_InstOf;
 #define pn_InstOf_M pn_InstOf_M_regular
 
@@ -1103,9 +1127,10 @@ void     set_Raise_exo_ptr(ir_node *node, ir_node *exoptr);
  */
 typedef enum {
   pn_Bound_M = 0,           /**< The memory result. */
-  pn_Bound_X_except = 1,    /**< The control flow result branching to the exception handler */
-  pn_Bound_res = 2,         /**< The checked index. */
-  pn_Bound_max = 3          /**< number of projections from a Bound */
+  pn_Bound_X_regular = 1,   /**< Execution result if no exception occurred. */
+  pn_Bound_X_except = 2,    /**< The control flow result branching to the exception handler */
+  pn_Bound_res = 3,         /**< The checked index. */
+  pn_Bound_max = 4          /**< number of projections from a Bound */
 } pn_Bound;
 
 /** Returns the memory input of a Bound operation. */
@@ -1230,6 +1255,8 @@ int is_ip_cfop(const ir_node *node);
 int is_fragile_op(const ir_node *node);
 /** Returns the memory operand of fragile operations. */
 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);
 
 /** Returns true if the operation is a forking control flow
  *  operation: Cond. */
@@ -1295,7 +1322,7 @@ typedef enum {
 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);
 
 /** Sets a new conditional jump prediction. */
 void set_Cond_jmp_pred(ir_node *cond, cond_jmp_predicate pred);