- add block Phi list resource
[libfirm] / include / libfirm / irprog.h
index b754108..3d8abcb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
+ * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
  *
  * This file is part of libFirm.
  *
 #include "firm_types.h"
 #include "irgraph.h"
 
+typedef enum ir_segment_t {
+       IR_SEGMENT_FIRST,
+       /** "normal" global data */
+       IR_SEGMENT_GLOBAL = IR_SEGMENT_FIRST,
+       /** thread local storage segment */
+       IR_SEGMENT_THREAD_LOCAL,
+       /**
+        * the constructors segment. Contains pointers to functions which are
+        * executed on module initialization (program start or when a library is
+        * dynamically loaded)
+        */
+       IR_SEGMENT_CONSTRUCTORS,
+       /** like constructors, but functions are executed on module exit */
+       IR_SEGMENT_DESTRUCTORS,
+
+       IR_SEGMENT_COUNT
+} ir_segment_t;
+
 /**
  * Datastructure that holds central information about a program
  *
@@ -75,6 +93,16 @@ typedef struct ir_prog ir_prog;
  */
 extern ir_prog *irp;
 
+#ifndef NDEBUG
+void irp_reserve_resources(ir_prog *irp, ir_resources_t resources);
+void irp_free_resources(ir_prog *irp, ir_resources_t resources);
+ir_resources_t irp_resources_reserved(const ir_prog *irp);
+#else
+void irp_reserve_resources(irp, resources)
+void irp_free_resources(irp, resources)
+ir_resources_t irp_resources_reserved(irp)   0
+#endif
+
 /**
  * Returns the access points from where everything in the ir can be accessed.
  *
@@ -140,9 +168,15 @@ int get_irp_n_allirgs(void);
  pseudo graphs).  Visits first graphs, then pseudo graphs. */
 ir_graph *get_irp_allirg(int pos);
 
+/**
+ * returns the type containing the entities for a segment
+ */
+ir_type *get_segment_type(ir_segment_t segment);
+
 /**
  * Returns the "global" type of the irp.
  * Upon creation this is an empty class type.
+ * This is a convenience function for get_segment_type(IR_SEGMENT_GLOBAL)
  */
 ir_type *get_glob_type(void);
 
@@ -229,4 +263,13 @@ ir_exc_region_t get_irp_next_region_nr(void);
 /** Returns a new, unique label number. */
 ir_label_t get_irp_next_label_nr(void);
 
+/** Add a new global asm include. */
+void add_irp_asm(ident *asm_string);
+
+/** Return the number of global asm includes. */
+int get_irp_n_asms(void);
+
+/** Return the global asm include at position pos. */
+ident *get_irp_asm(int pos);
+
 #endif