* NOTE Preliminary documentation ;-)
*
* FIELDS
- * type A list containing all types known to the translated program.
- * Some types can have several entries in this list (as a result of
- * using exchange_types()).
- * ...
+ * main_irg The ir graph that is the entry point to the program.
+ * (Anything not reachable from here may be optimized away.
+ * If we want to translate libraries or the like correctly
+ * we must replace this by a list.)
+ * irg List of all ir graphs in the program.
+ * type A list containing all types known to the translated program.
+ * Some types can have several entries in this list (as a result of
+ * using exchange_types()).
+ * glob_type The unique global type that is owner of all global entities.
+ *
* SOURCE
*/
typedef struct ir_prog ir_prog;
/* A variable from where everything in the ir can be accessed. */
extern ir_prog *irp;
-/* initializes ir_prog. Calles the constructor for an ir_prog. */
+/* initializes ir_prog. Calls the constructor for an ir_prog. */
void init_irprog(void);
/* Creates a new ir_prog, returns it and sets irp with it.
- Automatically called by init_firm through init_irprog. */
+ Automatically called by init_firm through init_irprog. */
ir_prog *new_ir_prog (void);
/* Access the main routine of the compiled program. */
* entity - An abstract data type to represent program entites.
* NOTE
*
- * ... not documented ...
- *
* ATTRIBUTES
+ * owner A compound type this entity is a part of.
+ * type The type of this entity.
+ * name The string that represents this entity in the source program.
+ * allocation A flag saying whether the entity is dynamically or statically
+ * allocated (values: dynamic_allocated, static_allocated).
+ * @@@ Does this make sense???
+ * visibility A flag indicating the visibility of this entity (values: local,
+ * external_visible, external_allocated)
+ * offset The offset of the entity within the compound object. Only set
+ * if IR in the state "@@@" Wie nennen wir den??
+ * overwrites A list of entities overwritten by this entity. This list is only
+ * existent if the owner of this entity is a class. The members in
+ * this list must be entities of super classes.
+ * irg If the entity is a method this is the ir graph that represents the
+ * code of the method.
*
*
* These fields can only be accessed via access functions.
set_type_state(type *tp, type_state state) {
assert(tp);
/* For pointer and primitive always fixed. */
- if ((tp->type_op != type_pointer) && (tp->type_op != type_primitive))
+ if ((tp->type_op != type_pointer) && (tp->type_op != type_primitive)) {
+ /* @@@ assert that the layout really is fixed!!! */
tp->state = state;
+ }
}
unsigned long get_type_visited(type *tp) {
* occupy size bytes in memory. In several cases this is
* determined when fixing the layout of this type (class,
* struct, union, array, enumeration).
+ * state The state of the type. The state represents whether the
+ * layout of the type is undefined or fixed (values: layout_undefined
+ * or layout_fixed). Compound types can have an undefined
+ * layout. The layout of the basic types primitive and pointer
+ * is always layout_fixed. If the layout of
+ * compound types is fixed all entities must have an offset
+ * and the size of the type must be set.
+ * A fixed layout for enumeration types means that each enumeration
+ * is associated with an implementation value.
* visit A counter for walks of the type information.
*
* These fields can only be accessed via access functions.