+#include "irtypes.h"
+#include "pseudo_irg.h"
+#include "ircgcons.h"
+#include "firm_common_t.h"
+#include "irtypeinfo.h"
+#include "irmemory.h"
+
+#include "callgraph.h"
+#include "field_temperature.h"
+#include "execution_frequency.h"
+
+#include "array.h"
+
+/** Adds mode to the list of modes in irp. */
+void add_irp_mode(ir_mode *mode);
+
+/* INLINE functions */
+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;
+}
+
+static INLINE ir_type *
+_get_glob_type(void) {
+ return _get_segment_type(IR_SEGMENT_GLOBAL);
+}
+
+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();
+ 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 <= _get_irp_n_irgs());
+ return irp->graphs[pos];
+}
+
+
+static INLINE int
+_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);
+ /* Don't set the skip_tid result so that no double entries are generated. */
+ return skip_tid(irp->types[pos]);
+}
+
+static INLINE int
+_get_irp_n_modes(void) {
+ assert (irp && irp->modes);
+ return ARR_LEN(irp->modes);
+}
+
+static INLINE ir_mode *
+_get_irp_mode(int pos) {
+ assert (irp && irp->modes);
+ return irp->modes[pos];
+}
+
+static INLINE int
+_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);
+ return irp->opcodes[pos];
+}