Added const modifier to various functions.
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Tue, 25 Mar 2003 14:03:47 +0000 (14:03 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Tue, 25 Mar 2003 14:03:47 +0000 (14:03 +0000)
[r967]

ir/ir/irnode.c
ir/ir/irnode.h
ir/ir/irnode_t.h

index 96c6844..02aa313 100644 (file)
 #define END_KEEPALIVE_OFFSET 0
 
 /* Declarations for inlineing */
-INLINE ir_node ** get_irn_in (ir_node *node);
-INLINE ir_mode *get_irn_mode (ir_node *node);
-INLINE ir_op *get_irn_op (ir_node *node);
-INLINE opcode get_irn_opcode (ir_node *node);
-INLINE ident *get_irn_opident (ir_node *node);
+INLINE ir_node ** get_irn_in (const ir_node *node);
+INLINE ir_mode *get_irn_mode (const ir_node *node);
+INLINE ir_op *get_irn_op (const ir_node *node);
+INLINE opcode get_irn_opcode (const ir_node *node);
+INLINE ident *get_irn_opident (const ir_node *node);
 INLINE type *get_SymConst_type (ir_node *node);
 INLINE ir_node *skip_nop (ir_node *node);
-INLINE int is_Proj (ir_node *node);
+INLINE int is_Proj (const ir_node *node);
 
 
-static char *pnc_name_arr [] = {"False", "Eq", "Lt", "Le",
-                               "Gt", "Ge", "Lg", "Leg", "Uo",
-                               "Ue", "Ul", "Ule", "Ug", "Uge",
-                               "Ne", "True" };
+static const char *pnc_name_arr [] = {
+  "False", "Eq", "Lt", "Le",
+  "Gt", "Ge", "Lg", "Leg", "Uo",
+  "Ue", "Ul", "Ule", "Ug", "Uge",
+  "Ne", "True"
+};
 
-INLINE char *get_pnc_string(int pnc) {
+INLINE const char *get_pnc_string(int pnc) {
   return pnc_name_arr[pnc];
 }
 
@@ -77,10 +79,14 @@ get_negated_pnc(int pnc) {
   return 99; /* to shut up gcc */
 }
 
-static char *pns_name_arr [] = {"initial_exec", "global_store",
-                               "frame_base", "globals", "args"};
+static const char *pns_name_arr [] = {
+  "initial_exec", "global_store",
+  "frame_base", "globals", "args"
+};
 
-static char *symconst_name_arr [] = {"type_tag", "size", "linkage_ptr_info"};
+static const char *symconst_name_arr [] = {
+  "type_tag", "size", "linkage_ptr_info"
+};
 
 void
 init_irnode (void)
@@ -192,7 +198,7 @@ ir_node_print (XP_PAR1, const xprintf_info *info ATTRIBUTE((unused)), XP_PARN)
 
 /* returns the number of predecessors without the block predecessor. */
 INLINE int
-get_irn_arity (ir_node *node) {
+get_irn_arity (const ir_node *node) {
   assert(node);
   if (interprocedural_view) { /* handle Filter and Block specially */
     if (get_irn_opcode(node) == iro_Filter) {
@@ -213,7 +219,7 @@ get_irn_arity (ir_node *node) {
    lists of operands as predecessors of Block or arguments of a Call are
    consecutive. */
 INLINE ir_node **
-get_irn_in (ir_node *node) {
+get_irn_in (const ir_node *node) {
   assert(node);
   if (interprocedural_view) { /* handle Filter and Block specially */
     if (get_irn_opcode(node) == iro_Filter) {
@@ -302,14 +308,14 @@ set_irn_n (ir_node *node, int n, ir_node *in) {
 }
 
 INLINE ir_mode *
-get_irn_mode (ir_node *node)
+get_irn_mode (const ir_node *node)
 {
   assert (node);
   return node->mode;
 }
 
 INLINE modecode
-get_irn_modecode (ir_node *node)
+get_irn_modecode (const ir_node *node)
 {
   assert (node);
   return node->mode->code;
@@ -317,14 +323,14 @@ get_irn_modecode (ir_node *node)
 
 
 INLINE ident *
-get_irn_modeident (ir_node *node)
+get_irn_modeident (const ir_node *node)
 {
   assert(node);
   return node->mode->name;
 }
 
 INLINE ir_op *
-get_irn_op (ir_node *node)
+get_irn_op (const ir_node *node)
 {
   assert (node);
   return node->op;
@@ -339,7 +345,7 @@ set_irn_op (ir_node *node, ir_op *op)
 }
 
 INLINE opcode
-get_irn_opcode (ir_node *node)
+get_irn_opcode (const ir_node *node)
 {
   assert (node);
   assert (k_ir_node == get_kind(node));
@@ -348,21 +354,21 @@ get_irn_opcode (ir_node *node)
 }
 
 INLINE const char *
-get_irn_opname (ir_node *node)
+get_irn_opname (const ir_node *node)
 {
   assert(node);
   return id_to_str(node->op->name);
 }
 
 INLINE ident *
-get_irn_opident (ir_node *node)
+get_irn_opident (const ir_node *node)
 {
   assert(node);
   return node->op->name;
 }
 
 INLINE unsigned long
-get_irn_visited (ir_node *node)
+get_irn_visited (const ir_node *node)
 {
   assert (node);
   return node->visited;
@@ -382,13 +388,13 @@ mark_irn_visited (ir_node *node) {
 }
 
 INLINE int
-irn_not_visited  (ir_node *node) {
+irn_not_visited  (const ir_node *node) {
   assert (node);
   return (node->visited < current_ir_graph->visited);
 }
 
 INLINE int
-irn_visited  (ir_node *node) {
+irn_visited  (const ir_node *node) {
   assert (node);
   return (node->visited >= current_ir_graph->visited);
 }
@@ -404,14 +410,14 @@ set_irn_link (ir_node *node, void *link) {
 }
 
 INLINE void *
-get_irn_link (ir_node *node) {
+get_irn_link (const ir_node *node) {
   assert (node);
   return node->link;
 }
 
 /* Outputs a unique number for this node */
 INLINE long
-get_irn_node_nr(ir_node *node) {
+get_irn_node_nr(const ir_node *node) {
   assert(node);
 #ifdef DEBUG_libfirm
   return node->node_nr;
@@ -706,12 +712,12 @@ free_End (ir_node *end) {
                       in array afterwards ... */
 }
 
-ir_graph *get_EndReg_irg (ir_node *end) {
+ir_graph *get_EndReg_irg (const ir_node *end) {
   assert (end->op == op_EndReg);
   return end->attr.end.irg;
 }
 
-ir_graph *get_EndExcept_irg  (ir_node *end) {
+ir_graph *get_EndExcept_irg  (const ir_node *end) {
   assert (end->op == op_EndReg);
   return end->attr.end.irg;
 }
@@ -855,7 +861,7 @@ set_Const_tarval (ir_node *node, tarval *con) {
 }
 
 INLINE symconst_kind
-get_SymConst_kind (ir_node *node) {
+get_SymConst_kind (const ir_node *node) {
   assert (node->op == op_SymConst);
   return node->attr.i.num;
 }
@@ -2238,7 +2244,7 @@ is_Block (ir_node *node) {
 }
 
 INLINE int
-is_Proj (ir_node *node) {
+is_Proj (const ir_node *node) {
   assert(node);
   return node->op == op_Proj
     || (!interprocedural_view && node->op == op_Filter);
index 28bb20f..a24ba98 100644 (file)
@@ -61,7 +61,7 @@ typedef struct ir_node ir_node;
  */
 
 /** returns the number of predecessors without the block predecessor: */
-int                  get_irn_arity         (ir_node *node);
+int                  get_irn_arity         (const ir_node *node);
 
 /** Replaces the old in array by a new one that will contain the ins given in
    the parameters.  Conserves the block predecessor.  It copies the array passed.
@@ -81,34 +81,34 @@ INLINE void          set_irn_in            (ir_node *node, int arity,
 INLINE ir_node      *get_irn_n             (ir_node *node, int n);
 INLINE void          set_irn_n             (ir_node *node, int n, ir_node *in);
 /* Get the mode struct. */
-INLINE ir_mode      *get_irn_mode          (ir_node *node);
+INLINE ir_mode      *get_irn_mode          (const ir_node *node);
 /* Get the mode-enum modecode */
-INLINE modecode      get_irn_modecode      (ir_node *node);
+INLINE modecode      get_irn_modecode      (const ir_node *node);
 /* Get the ident for a string representation of the mode */
-INLINE ident        *get_irn_modeident     (ir_node *node);
+INLINE ident        *get_irn_modeident     (const ir_node *node);
 /* Access the opcode struct of the node */
-INLINE ir_op        *get_irn_op            (ir_node *node);
+INLINE ir_op        *get_irn_op            (const ir_node *node);
 INLINE void          set_irn_op            (ir_node *node, ir_op *op);
 /* Get the opcode-enum of the node */
-INLINE opcode        get_irn_opcode        (ir_node *node);
-/* Get the ident for a string representation of the opcode */
-INLINE ident        *get_irn_opident       (ir_node *node);
+INLINE opcode        get_irn_opcode        (const ir_node *node);
 /* Get the string representation of the opcode */
-INLINE const char   *get_irn_opname        (ir_node *node);
+INLINE const char   *get_irn_opname        (const ir_node *node);
+/* Get the ident for a string representation of the opcode */
+INLINE ident        *get_irn_opident       (const ir_node *node);
+INLINE unsigned long get_irn_visited (const ir_node *node);
 INLINE void          set_irn_visited (ir_node *node, unsigned long visited);
-INLINE unsigned long get_irn_visited (ir_node *node);
 /* Sets visited to get_irg_visited(current_ir_graph) */
 INLINE void          mark_irn_visited (ir_node *node);
 /* Returns 1 if visited < get_irg_visited(current_ir_graph).  */
-INLINE int           irn_not_visited  (ir_node *node);
+INLINE int           irn_not_visited  (const ir_node *node);
 /* Returns 1 if visited >= get_irg_visited(current_ir_graph).  */
-INLINE int           irn_visited      (ir_node *node);
+INLINE int           irn_visited      (const ir_node *node);
 INLINE void          set_irn_link          (ir_node *node, void *link);
-INLINE void         *get_irn_link          (ir_node *node);
+INLINE void         *get_irn_link          (const ir_node *node);
 
 /** Outputs a unique number for this node if libfirm is compiled for
    debugging, (configure with --enable-debug) else returns 0. */
-INLINE long get_irn_node_nr(ir_node *node);
+INLINE long get_irn_node_nr(const ir_node *node);
 
 /** Returns the ir_graph this node belongs to. Only valid for
  * CallBegin, EndReg and EndExcept */
@@ -188,8 +188,8 @@ INLINE void set_End_keepalive(ir_node *end, int pos, ir_node *ka);
    free_End frees these data structures. */
 INLINE void free_End (ir_node *end);
 
-ir_graph *get_EndReg_irg (ir_node *end);
-ir_graph *get_EndExcept_irg  (ir_node *end);
+ir_graph *get_EndReg_irg (const ir_node *end);
+ir_graph *get_EndExcept_irg  (const ir_node *end);
 
 /* We distinguish three kinds of Cond nodes.  These can be distinguished
    by the mode of the selector operand and an internal flag of type cond_kind.
@@ -250,7 +250,7 @@ typedef enum {
                        by the linker. Type_or_id_p is ident *. */
 } symconst_kind;
 typedef union type_or_id * type_or_id_p;
-INLINE symconst_kind get_SymConst_kind (ir_node *node);
+INLINE symconst_kind get_SymConst_kind (const ir_node *node);
 INLINE void          set_SymConst_kind (ir_node *node, symconst_kind num);
 /* Only to access SymConst of kind type_tag or size.  Else assertion: */
 INLINE type    *get_SymConst_type (ir_node *node);
@@ -409,7 +409,7 @@ typedef enum {
   /* not_mask = Leg*/  /* bits to flip to negate comparison * @@ hack for jni interface */
 } pnc_number;
 #define not_mask Leg
-INLINE char *get_pnc_string(int pnc);
+INLINE const char *get_pnc_string(int pnc);
 INLINE int   get_negated_pnc(int pnc);
 INLINE ir_node *get_Cmp_left (ir_node *node);
 INLINE void     set_Cmp_left (ir_node *node, ir_node *left);
@@ -535,7 +535,7 @@ INLINE int      is_no_Block (ir_node *node);
 INLINE int      is_Block (ir_node *node);
 /** returns true if node is a Proj node or a Filter node in
  * intraprocedural view */
-INLINE int      is_Proj (ir_node *node);
+INLINE int      is_Proj (const ir_node *node);
 /** Returns true if the operation manipulates control flow:
    Start, End, Jmp, Cond, Return, Raise, Bad, CallBegin, EndReg, EndExcept */
 int is_cfop(ir_node *node);
@@ -554,10 +554,8 @@ ir_node *get_fragile_op_mem(ir_node *node);
 
 #include "ident.h"
 
-/*@{*/
-/** Makros for debugging the libfirm */
 #ifdef __GNUC__
-/* GNU C has the  extension */
+/* GNU C has the __FUNCTION__ extension */
 #define __MYFUNC__ __FUNCTION__
 #else
 /* use Filename instead */
@@ -586,8 +584,6 @@ ir_node *get_fragile_op_mem(ir_node *node);
 /** Output information about a mode */
 #define DDMM(X)  printf("%s(l.%i) %s: %p\n",                 __MYFUNC__, __LINE__, get_mode_name(X), (X))
 
-/*@}*/  /* Macros for debug.. */
-
 /*@}*/ /* end of ir_node group definition */
 
 
index eceb7fe..e572848 100644 (file)
@@ -190,7 +190,7 @@ int ir_node_print (XP_PAR1, const xprintf_info *, XP_PARN);
 
 /** Returns the array with the ins.  The content of the array may not be
    changed.  */
-ir_node     **get_irn_in            (ir_node *node);
+ir_node     **get_irn_in            (const ir_node *node);
 
 /*@{*/
 /** access attributes directly */