fix more cparser warnings, cleanup some libcore code
[libfirm] / ir / ir / irprog_t.h
index bae4ed1..7eb4436 100644 (file)
@@ -29,8 +29,6 @@
 
 #include "irprog.h"
 #include "irtypes.h"
-#include "pseudo_irg.h"
-#include "ircgcons.h"
 #include "irtypeinfo.h"
 #include "irmemory.h"
 
 #include "array.h"
 
 /** Adds mode to the list of modes in irp. */
-void  add_irp_mode(ir_mode *mode);
+void add_irp_mode(ir_mode *mode);
 
 /* inline functions */
-static inline ir_type *
-_get_segment_type(ir_segment_t segment)
+static inline ir_type *_get_segment_type(ir_segment_t segment)
 {
-       ir_type *type;
-
-       assert(segment < IR_SEGMENT_COUNT);
-       type                        = skip_tid(irp->segment_types[segment]);
-       irp->segment_types[segment] = type;
-       return type;
+       assert(segment <= IR_SEGMENT_LAST);
+       return irp->segment_types[segment];
 }
 
-static inline ir_type *
-_get_glob_type(void) {
+static inline ir_type *_get_glob_type(void)
+{
        return _get_segment_type(IR_SEGMENT_GLOBAL);
 }
 
-static inline ir_type *
-_get_tls_type(void) {
+static inline ir_type *_get_tls_type(void)
+{
        return _get_segment_type(IR_SEGMENT_THREAD_LOCAL);
 }
 
-static inline int
-_get_irp_n_irgs(void) {
-       assert (irp && irp->graphs);
-       if (get_visit_pseudo_irgs()) return get_irp_n_allirgs();
+static inline size_t _get_irp_n_irgs(void)
+{
+       assert(irp && irp->graphs);
        return ARR_LEN(irp->graphs);
 }
 
-static inline ir_graph *
-_get_irp_irg(int pos){
-       if (get_visit_pseudo_irgs()) return get_irp_allirg(pos);
-       assert(0 <= pos && pos <= ARR_LEN(irp->graphs));
+static inline ir_graph *_get_irp_irg(size_t pos)
+{
+       assert(pos < ARR_LEN(irp->graphs));
        return irp->graphs[pos];
 }
 
-
-static inline int
-_get_irp_n_types(void) {
-       assert (irp && irp->types);
+static inline size_t _get_irp_n_types(void)
+{
+       assert(irp && irp->types);
        return ARR_LEN(irp->types);
 }
 
-static inline ir_type *
-_get_irp_type(int pos) {
-       assert (irp && irp->types);
+static inline ir_type *_get_irp_type(size_t pos)
+{
+       assert(irp->types);
+       assert(pos < ARR_LEN(irp->types));
        /* Don't set the skip_tid result so that no double entries are generated. */
-       return skip_tid(irp->types[pos]);
+       return irp->types[pos];
 }
 
-static inline int
-_get_irp_n_modes(void) {
-       assert (irp && irp->modes);
+static inline size_t _get_irp_n_modes(void)
+{
+       assert(irp->modes);
        return ARR_LEN(irp->modes);
 }
 
-static inline ir_mode *
-_get_irp_mode(int pos) {
-       assert (irp && irp->modes);
+static inline ir_mode *_get_irp_mode(size_t pos)
+{
+       assert(irp && irp->modes);
        return irp->modes[pos];
 }
 
-static inline int
-_get_irp_n_opcodes(void) {
-       assert (irp && irp->opcodes);
+static inline size_t _get_irp_n_opcodes(void)
+{
+       assert(irp && irp->opcodes);
        return ARR_LEN(irp->opcodes);
 }
 
-static inline ir_op *
-_get_irp_opcode(int pos) {
-       assert (irp && irp->opcodes);
+static inline ir_op *_get_irp_opcode(size_t pos)
+{
+       assert(irp && irp->opcodes);
        return irp->opcodes[pos];
 }
 
 /** Returns a new, unique number to number nodes or the like. */
-static inline long
-get_irp_new_node_nr(void) {
+static inline long get_irp_new_node_nr(void)
+{
        assert(irp);
        return irp->max_node_nr++;
 }
 
-static inline int
-get_irp_new_irg_idx(void) {
+static inline size_t get_irp_new_irg_idx(void)
+{
        assert(irp);
        return irp->max_irg_idx++;
 }
 
-static inline ir_graph *
-_get_const_code_irg(void) {
+static inline ir_graph *_get_const_code_irg(void)
+{
        return irp->const_code_irg;
 }
 
 /** Returns a new, unique exception region number. */
-static inline ir_exc_region_t
-_get_irp_next_region_nr(void) {
+static inline ir_exc_region_t _get_irp_next_region_nr(void)
+{
        assert(irp);
        return ++irp->last_region_nr;
 }
 
 /** Returns a new, unique label number. */
-static inline ir_label_t
-_get_irp_next_label_nr(void) {
+static inline ir_label_t _get_irp_next_label_nr(void)
+{
        assert(irp);
        return ++irp->last_label_nr;
 }