Switch irg index to type size_t, making the API more consistent.
[libfirm] / include / libfirm / irprog.h
index 926f44d..66c695c 100644 (file)
  *     program.  It is not the base class of
  *     all classes in a class hierarchy (as, e.g., "object" in java).
  *   - A degenerated graph that contains constant expressions.
- *   - interprocedural outs state.
- *   - a flag indicating validity of the interprocedural representation.
  *   - the output file name
  */
 #ifndef FIRM_IR_IRPROG_H
 #define FIRM_IR_IRPROG_H
 
+#include <stddef.h>
 #include "firm_types.h"
 #include "irgraph.h"
 #include "begin.h"
@@ -64,14 +63,14 @@ typedef enum ir_segment_t {
 
        IR_SEGMENT_LAST = IR_SEGMENT_DESTRUCTORS
 } ir_segment_t;
+ENUM_COUNTABLE(ir_segment_t)
 
 /**
  * A variable pointing to the current irp (program or module).
  * This variable should be considered constant. Moreover, one should use get_irp()
  * to get access the the irp.
  *
- * @note
- *     Think of the irp as the "handle" of a program.
+ * @note Think of the irp as the "handle" of a program.
  */
 FIRM_API ir_prog *irp;
 
@@ -140,23 +139,16 @@ FIRM_API void remove_irp_irg_from_list(ir_graph *irg);
 FIRM_API void remove_irp_irg(ir_graph *irg);
 
 /** returns the biggest not used irg index number */
-FIRM_API int get_irp_last_idx(void);
+FIRM_API size_t get_irp_last_idx(void);
 
 /** Returns the number of ir graphs in the irp. */
-FIRM_API int get_irp_n_irgs(void);
+FIRM_API size_t get_irp_n_irgs(void);
 
 /** Returns the ir graph at position pos in the irp. */
-FIRM_API ir_graph *get_irp_irg(int pos);
+FIRM_API ir_graph *get_irp_irg(size_t pos);
 
 /** Sets the ir graph at position pos. */
-FIRM_API void set_irp_irg(int pos, ir_graph *irg);
-
-/** Gets the number of graphs _and_ pseudo graphs. */
-FIRM_API int get_irp_n_allirgs(void);
-
-/** Returns the ir graph at position pos of all graphs (including
- pseudo graphs).  Visits first graphs, then pseudo graphs. */
-FIRM_API ir_graph *get_irp_allirg(int pos);
+FIRM_API void set_irp_irg(size_t pos, ir_graph *irg);
 
 /**
  * Returns the type containing the entities for a segment.
@@ -196,25 +188,25 @@ FIRM_API void remove_irp_type(ir_type *typ);
  * Returns the number of all types in the irp.
  * @deprecated
  */
-FIRM_API int get_irp_n_types(void);
+FIRM_API size_t get_irp_n_types(void);
 
 /**
  * Returns the type at position pos in the irp.
  * @deprecated
  */
-FIRM_API ir_type *get_irp_type(int pos);
+FIRM_API ir_type *get_irp_type(size_t pos);
 
 /**
  * Overwrites the type at position pos with another type.
  * @deprecated
  */
-FIRM_API void set_irp_type(int pos, ir_type *typ);
+FIRM_API void set_irp_type(size_t pos, ir_type *typ);
 
 /** Returns the number of all modes in the irp. */
-FIRM_API int get_irp_n_modes(void);
+FIRM_API size_t get_irp_n_modes(void);
 
 /** Returns the mode at position pos in the irp. */
-FIRM_API ir_mode *get_irp_mode(int pos);
+FIRM_API ir_mode *get_irp_mode(size_t pos);
 
 /** Adds opcode to the list of opcodes in irp. */
 FIRM_API void add_irp_opcode(ir_op *opcode);
@@ -224,10 +216,10 @@ FIRM_API void add_irp_opcode(ir_op *opcode);
 FIRM_API void remove_irp_opcode(ir_op *opcode);
 
 /** Returns the number of all opcodes in the irp. */
-FIRM_API int get_irp_n_opcodes(void);
+FIRM_API size_t get_irp_n_opcodes(void);
 
 /** Returns the opcode at position pos in the irp. */
-FIRM_API ir_op *get_irp_opcode(int pos);
+FIRM_API ir_op *get_irp_opcode(size_t pos);
 
 /** Sets the generic function pointer of all opcodes to NULL */
 FIRM_API void clear_irp_opcodes_generic_func(void);
@@ -285,10 +277,10 @@ FIRM_API ir_label_t get_irp_next_label_nr(void);
 FIRM_API void add_irp_asm(ident *asm_string);
 
 /** Return the number of global asm includes. */
-FIRM_API int get_irp_n_asms(void);
+FIRM_API size_t get_irp_n_asms(void);
 
 /** Return the global asm include at position pos. */
-FIRM_API ident *get_irp_asm(int pos);
+FIRM_API ident *get_irp_asm(size_t pos);
 
 #include "end.h"