* PURPOSE.
*/
-/*
- * Project: libFIRM
- * File name: ir/tr/entity.c
- * Purpose: Representation of all program known entities.
- * Author: Martin Trapp, Christian Schaefer
- * Modified by: Goetz Lindenmaier, Michael Beck
- * Created:
- * CVS-ID: $Id$
- * Copyright: (c) 1998-2007 Universität Karlsruhe
+/**
+ * @file
+ * @brief Representation of all program known entities.
+ * @author Martin Trapp, Christian Schaefer, Goetz Lindenmaier, Michael Beck
+ * @version $Id$
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
*/
/**
- * @file entity.h
- *
- * Entities represent all program known objects.
- *
- * @author Martin Trapp, Christian Schaefer
- * @author Goetz Lindenmaier
+ * @file entity.h
+ * @brief Representation of all program known entities.
+ * @author Martin Trapp, Christian Schaefer, Goetz Lindenmaier, Michael Beck
+ * @version $Id$
+ * @summary
*
* An entity is the representation of program known objects in Firm.
* The primary concept of entities is to represent members of complex
*
* @link ir_entity
*/
-#ifndef _FIRM_TR_ENTITY_H_
-#define _FIRM_TR_ENTITY_H_
+#ifndef FIRM_TR_ENTITY_H
+#define FIRM_TR_ENTITY_H
#include "firm_types.h"
#include "dbginfo.h"
/** Sets the section of a method. */
void set_method_img_section(ir_entity *method, ir_img_section section);
-#endif /* _FIRM_TR_ENTITY_H_ */
+#endif /* FIRM_TR_ENTITY_H */
*/
/*
- * Project: libFIRM
- * File name: ir/tr/entity_t.h
- * Purpose: Representation of all program known entities -- private header.
- * Author: Martin Trapp, Christian Schaefer
- * Modified by: Goetz Lindenmaier, Michael Beck
- * Created:
- * CVS-ID: $Id$
- * Copyright: (c) 1998-2007 Universität Karlsruhe
+ * @file entity_t.h
+ * @brief Representation of all program known entities -- private header.
+ * @author Martin Trapp, Christian Schaefer, Goetz Lindenmaier, Michael Beck
+ * @version $Id$
*/
-
-/**
- * @file entity_t.h
- *
- * entity.h: entities represent all program known objects.
- *
- * @author Martin Trapp, Christian Schaefer, Goetz Lindenmaier
- *
- * An entity is the representation of program known objects in Firm.
- * The primary concept of entities is to represent members of complex
- * types, i.e., fields and methods of classes. As not all programming
- * language model all variables and methods as members of some class,
- * the concept of entities is extended to cover also local and global
- * variables, and arbitrary procedures.
- *
- * An entity always specifies the type of the object it represents and
- * the type of the object it is a part of, the owner of the entity.
- * Originally this is the type of the class of which the entity is a
- * member.
- * The owner of local variables is the procedure they are defined in.
- * The owner of global variables and procedures visible in the whole
- * program is a universally defined class type "GlobalType". The owner
- * of procedures defined in the scope of an other procedure is the
- * enclosing procedure.
- */
-
-#ifndef _FIRM_TR_ENTITY_T_H_
-#define _FIRM_TR_ENTITY_T_H_
+#ifndef FIRM_TR_ENTITY_T_H
+#define FIRM_TR_ENTITY_T_H
#include "firm_common_t.h"
#include "firm_config.h"
#define get_entity_repr_class(ent) _get_entity_repr_class(ent)
-#endif /* _FIRM_TR_ENTITY_T_H_ */
+#endif /* FIRM_TR_ENTITY_T_H */
* PURPOSE.
*/
-/*
- * Project: libFIRM
- * File name: ir/tr/mangle.c
- * Purpose: Methods to manipulate names.
- * Author: Martin Trapp, Christian Schaefer
- * Modified by: Goetz Lindenmaier, Michael Beck
- * Created:
- * CVS-ID: $Id$
- * Copyright: (c) 1998-2007 Universität Karlsruhe
+/**
+ * @file
+ * @brief Methods to manipulate names.
+ * @author Martin Trapp, Christian Schaefer, Goetz Lindenmaier, Michael Beck
+ * @version $Id$
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
* PURPOSE.
*/
-/*
- * Project: libFIRM
- * File name: ir/tr/mangle.h
- * Purpose: Methods to manipulate names.
- * Author: Martin Trapp, Christian Schaefer
- * Modified by: Goetz Lindenmaier
- * Created:
- * CVS-ID: $Id$
- * Copyright: (c) 1998-2003 Universität Karlsruhe
- */
-
/**
- * @file mangle.h
- *
- * FIRM name mangling -- methods to manipulate names.
- *
- * @author Martin Trapp, Christian Schaefer
+ * @file mangle.h
+ * @brief Methods to manipulate names.
+ * @author Martin Trapp, Christian Schaefer, Goetz Lindenmaier, Michael Beck
+ * @version $Id$
*/
-
-#ifndef _MANGLE_H_
-#define _MANGLE_H_
+#ifndef FIRM_TR_MANGLE_H
+#define FIRM_TR_MANGLE_H
#include "ident.h"
#include "entity.h"
/** returns a mangled name for a Win32 function using it's calling convention */
ident *decorate_win32_c_fkt(ir_entity *ent, ident *id);
-#endif /* _MANGLE_H_ */
+#endif /* FIRM_TR_MANGLE_H */
* PURPOSE.
*/
-/*
- * Project: libFIRM
- * File name: ir/tr/tpop.c
- * Purpose: Opcode of types.
- * Author: Goetz Lindenmaier
- * Modified by:
- * Created:
- * CVS-ID: $Id$
- * Copyright: (c) 2001-2003 Universität Karlsruhe
+/**
+ * @file
+ * @brief Opcode of types.
+ * @author Goetz Lindenmaier, Michael Beck
+ * @version $Id$
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
-# include "xmalloc.h"
-# include "tpop_t.h"
-# include "type_t.h"
+#include "xmalloc.h"
+#include "tpop_t.h"
+#include "type_t.h"
tp_op *type_class; tp_op *get_tpop_class (void) { return type_class; }
tp_op *type_struct; tp_op *get_tpop_struct (void) { return type_struct; }
new_tpop(tp_opcode code, ident *name, unsigned flags, size_t attr_size,
const tp_op_ops *ops)
{
- tp_op *res;
+ tp_op *res;
- res = xmalloc(sizeof(*res));
- res->code = code;
- res->name = name;
- res->flags = flags;
- res->attr_size = attr_size;
+ res = xmalloc(sizeof(*res));
+ res->code = code;
+ res->name = name;
+ res->flags = flags;
+ res->attr_size = attr_size;
- if (ops)
- memcpy(&res->ops, ops, sizeof(res->ops));
- else
- memset(&res->ops, 0, sizeof(res->ops));
+ if (ops)
+ memcpy(&res->ops, ops, sizeof(res->ops));
+ else
+ memset(&res->ops, 0, sizeof(res->ops));
- return res;
+ return res;
}
void
free_tpop(tp_op *tpop) {
- free(tpop);
+ free(tpop);
}
static const tp_op_ops
- /** tpop operations for class types */
- class_ops = {
- free_class_attrs,
- free_class_entities,
- NULL,
- set_class_mode,
- set_class_size_bits,
- get_class_n_members,
- get_class_member,
- get_class_member_index
- },
- /** tpop operations for struct types */
- struct_ops = {
- free_struct_attrs,
- free_struct_entities,
- NULL,
- set_struct_mode,
- set_struct_size_bits,
- get_struct_n_members,
- get_struct_member,
- get_struct_member_index
- },
- /** tpop operations for method types */
- method_ops = {
- free_method_attrs,
- free_method_entities,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
- },
- /** tpop operations for union types */
- union_ops = {
- free_union_attrs,
- free_union_entities,
- NULL,
- NULL,
- set_union_size_bits,
- get_union_n_members,
- get_union_member,
- get_union_member_index
- },
- /** tpop operations for array types */
- array_ops = {
- free_array_attrs,
- free_array_entities,
- free_array_automatic_entities,
- NULL,
- set_array_size_bits,
- NULL,
- NULL,
- NULL
- },
- /** tpop operations for enumeration types */
- enum_ops = {
- free_enumeration_attrs,
- free_enumeration_entities,
- NULL,
- set_enumeration_mode,
- NULL,
- NULL,
- NULL,
- NULL
- },
- /** tpop operations for pointer types */
- pointer_ops = {
- free_pointer_attrs,
- free_pointer_entities,
- NULL,
- set_pointer_mode,
- NULL,
- NULL,
- NULL,
- NULL
- },
- /** tpop operations for pseudo types */
- pseudo_ops = {
- NULL,
- NULL,
- NULL,
- NULL,
- set_default_size_bits,
- NULL,
- NULL,
- NULL
- },
- /** tpop operations for primitive types */
- null_ops = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
- };
+ /** tpop operations for class types */
+ class_ops = {
+ free_class_attrs,
+ free_class_entities,
+ NULL,
+ set_class_mode,
+ set_class_size_bits,
+ get_class_n_members,
+ get_class_member,
+ get_class_member_index
+ },
+ /** tpop operations for struct types */
+ struct_ops = {
+ free_struct_attrs,
+ free_struct_entities,
+ NULL,
+ set_struct_mode,
+ set_struct_size_bits,
+ get_struct_n_members,
+ get_struct_member,
+ get_struct_member_index
+ },
+ /** tpop operations for method types */
+ method_ops = {
+ free_method_attrs,
+ free_method_entities,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+ },
+ /** tpop operations for union types */
+ union_ops = {
+ free_union_attrs,
+ free_union_entities,
+ NULL,
+ NULL,
+ set_union_size_bits,
+ get_union_n_members,
+ get_union_member,
+ get_union_member_index
+ },
+ /** tpop operations for array types */
+ array_ops = {
+ free_array_attrs,
+ free_array_entities,
+ free_array_automatic_entities,
+ NULL,
+ set_array_size_bits,
+ NULL,
+ NULL,
+ NULL
+ },
+ /** tpop operations for enumeration types */
+ enum_ops = {
+ free_enumeration_attrs,
+ free_enumeration_entities,
+ NULL,
+ set_enumeration_mode,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+ },
+ /** tpop operations for pointer types */
+ pointer_ops = {
+ free_pointer_attrs,
+ free_pointer_entities,
+ NULL,
+ set_pointer_mode,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+ },
+ /** tpop operations for pseudo types */
+ pseudo_ops = {
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ set_default_size_bits,
+ NULL,
+ NULL,
+ NULL
+ },
+ /** tpop operations for primitive types */
+ null_ops = {
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+ };
#define C TP_OP_FLAG_COMPOUND
#define ID(s) new_id_from_chars(s, sizeof(s) - 1)
-void
-init_tpop(void)
-{
- type_class = new_tpop(tpo_class , ID("class"), C, sizeof (cls_attr), &class_ops);
- type_struct = new_tpop(tpo_struct , ID("struct"), C, sizeof (stc_attr), &struct_ops);
- type_method = new_tpop(tpo_method , ID("method"), 0, sizeof (mtd_attr), &method_ops);
- type_union = new_tpop(tpo_union , ID("union"), C, sizeof (uni_attr), &union_ops);
- type_array = new_tpop(tpo_array , ID("array"), C, sizeof (arr_attr), &array_ops);
- type_enumeration = new_tpop(tpo_enumeration, ID("enumeration"), 0, sizeof (enm_attr), &enum_ops);
- type_pointer = new_tpop(tpo_pointer , ID("pointer"), 0, sizeof (ptr_attr), &pointer_ops);
- type_primitive = new_tpop(tpo_primitive , ID("primitive"), 0, /* sizeof (pri_attr) */ 0, &null_ops);
- type_id = new_tpop(tpo_id , ID("type_id"), 0, /* sizeof (id_attr) */ 0, &null_ops);
- tpop_none = new_tpop(tpo_none , ID("None"), 0, /* sizeof (non_attr) */ 0, &pseudo_ops);
- tpop_unknown = new_tpop(tpo_unknown , ID("Unknown"), 0, /* sizeof (ukn_attr) */ 0, &pseudo_ops);
+
+void init_tpop(void) {
+ type_class = new_tpop(tpo_class , ID("class"), C, sizeof (cls_attr), &class_ops);
+ type_struct = new_tpop(tpo_struct , ID("struct"), C, sizeof (stc_attr), &struct_ops);
+ type_method = new_tpop(tpo_method , ID("method"), 0, sizeof (mtd_attr), &method_ops);
+ type_union = new_tpop(tpo_union , ID("union"), C, sizeof (uni_attr), &union_ops);
+ type_array = new_tpop(tpo_array , ID("array"), C, sizeof (arr_attr), &array_ops);
+ type_enumeration = new_tpop(tpo_enumeration, ID("enumeration"), 0, sizeof (enm_attr), &enum_ops);
+ type_pointer = new_tpop(tpo_pointer , ID("pointer"), 0, sizeof (ptr_attr), &pointer_ops);
+ type_primitive = new_tpop(tpo_primitive , ID("primitive"), 0, /* sizeof (pri_attr) */ 0, &null_ops);
+ type_id = new_tpop(tpo_id , ID("type_id"), 0, /* sizeof (id_attr) */ 0, &null_ops);
+ tpop_none = new_tpop(tpo_none , ID("None"), 0, /* sizeof (non_attr) */ 0, &pseudo_ops);
+ tpop_unknown = new_tpop(tpo_unknown , ID("Unknown"), 0, /* sizeof (ukn_attr) */ 0, &pseudo_ops);
}
#undef ID
#undef C
/* Finalize the tpop module.
* Frees all type opcodes. */
void finish_tpop(void) {
- free_tpop(type_class ); type_class = NULL;
- free_tpop(type_struct ); type_struct = NULL;
- free_tpop(type_method ); type_method = NULL;
- free_tpop(type_union ); type_union = NULL;
- free_tpop(type_array ); type_array = NULL;
- free_tpop(type_enumeration); type_enumeration = NULL;
- free_tpop(type_pointer ); type_pointer = NULL;
- free_tpop(type_primitive ); type_primitive = NULL;
- free_tpop(type_id ); type_id = NULL;
- free_tpop(tpop_none ); tpop_none = NULL;
- free_tpop(tpop_unknown ); tpop_unknown = NULL;
-}
+ free_tpop(type_class ); type_class = NULL;
+ free_tpop(type_struct ); type_struct = NULL;
+ free_tpop(type_method ); type_method = NULL;
+ free_tpop(type_union ); type_union = NULL;
+ free_tpop(type_array ); type_array = NULL;
+ free_tpop(type_enumeration); type_enumeration = NULL;
+ free_tpop(type_pointer ); type_pointer = NULL;
+ free_tpop(type_primitive ); type_primitive = NULL;
+ free_tpop(type_id ); type_id = NULL;
+ free_tpop(tpop_none ); tpop_none = NULL;
+ free_tpop(tpop_unknown ); tpop_unknown = NULL;
+ }
/* Returns the string for the tp_opcode. */
const char *get_tpop_name(const tp_op *op) {
- return get_id_str(op->name);
+ return get_id_str(op->name);
}
tp_opcode (get_tpop_code)(const tp_op *op) {
- return _get_tpop_code(op);
+ return _get_tpop_code(op);
}
ident *(get_tpop_ident)(const tp_op *op) {
- return _get_tpop_ident(op);
+ return _get_tpop_ident(op);
}
/* returns the attribute size of the operator. */
int (get_tpop_attr_size)(const tp_op *op) {
- return _get_tpop_attr_size(op);
+ return _get_tpop_attr_size(op);
}
*/
/**
- *
- * @file tpop.h
- *
- * Project: libFIRM
- * File name: ir/tr/tpop.h
- * Purpose: Opcode of types.
- * Author: Goetz Lindenmaier
- * Modified by:
- * Created:
- * Copyright: (c) 2001-2003 Universität Karlsruhe
- * CVS-ID: $Id$
+ * @file tpop.h
+ * @brief Opcode of types.
+ * @author Goetz Lindenmaier, Michael Beck
+ * @version $Id$
+ * @summary
*
* This module specifies the kinds of types available in firm.
*
*
* @see type.h
*/
-
-# ifndef _TYPEOP_H_
-# define _TYPEOP_H_
+#ifndef FIRM_TR_TPOP_H
+#define FIRM_TR_TPOP_H
#include "ident.h"
/**
- * An enum for the type kinds.
- * For each type kind exists a typecode to identify it.
+ * An enum for the type kinds.
+ * For each type kind exists a typecode to identify it.
*/
typedef enum {
- tpo_uninitialized = 0, /* not a type opcode */
- tpo_class,
- tpo_struct,
- tpo_method,
- tpo_union,
- tpo_array,
- tpo_enumeration,
- tpo_pointer,
- tpo_primitive,
- tpo_id,
- tpo_none,
- tpo_unknown,
- tpo_max /* not a type opcode */
+ tpo_uninitialized = 0, /* not a type opcode */
+ tpo_class, /**< A class type. */
+ tpo_struct, /**< A struct type. */
+ tpo_method, /**< A method type. */
+ tpo_union, /**< An union type. */
+ tpo_array, /**< An array type. */
+ tpo_enumeration, /**< An enumeration type. */
+ tpo_pointer, /**< A pointer type. */
+ tpo_primitive, /**< A primitive type. */
+ tpo_id, /**< Special Id tag used for type replacement. */
+ tpo_none, /**< Special type for the None type. */
+ tpo_unknown, /**< Special code for the Unknown type. */
+ tpo_max /* not a type opcode */
} tp_opcode;
/**
- * A structure containing information about a kind of type.
- * A structure containing information about a kind of type. So far
- * this is only the kind name, an enum for case-switching and some
- * internal values.
+ * A structure containing information about a kind of type.
+ * A structure containing information about a kind of type. So far
+ * this is only the kind name, an enum for case-switching and some
+ * internal values.
*
* @see get_tpop_name(), get_tpop_code(), get_tpop_ident()
*/
/**
- * Returns the string for the type opcode.
+ * Returns the string for the type opcode.
*
- * @param op The type opcode to get the string from.
- * @return a string. (@todo Null terminated???)
+ * @param op The type opcode to get the string from.
+ * @return a string. (@todo Null terminated???)
*/
const char *get_tpop_name (const tp_op *op);
/**
- * Returns an enum for the type opcode.
+ * Returns an enum for the type opcode.
*
- * @param op The type opcode to get the enum from.
- * @return the enum.
+ * @param op The type opcode to get the enum from.
+ * @return the enum.
*/
tp_opcode get_tpop_code (const tp_op *op);
/**
- * Returns the ident for the type opcode.
+ * Returns the ident for the type opcode.
*
- * @param op The type opcode to get the ident from.
- * @return The ident.
+ * @param op The type opcode to get the ident from.
+ * @return The ident.
*/
ident *get_tpop_ident (const tp_op *op);
/**
- * This type opcode marks that the corresponding type is a class type.
+ * This type opcode marks that the corresponding type is a class type.
*
- * Consequently the type refers to supertypes, subtypes and entities.
- * Entities can be any fields, but also methods.
- * @@@ value class or not???
- * This struct is dynamically allocated but constant for the lifetime
- * of the library.
+ * Consequently the type refers to supertypes, subtypes and entities.
+ * Entities can be any fields, but also methods.
+ * @@@ value class or not???
+ * This struct is dynamically allocated but constant for the lifetime
+ * of the library.
*/
extern tp_op *type_class;
tp_op *get_tpop_class(void);
/**
- * This type opcode marks that the corresponding type is a compound type
- * as a struct in C.
+ * This type opcode marks that the corresponding type is a compound type
+ * as a struct in C.
*
- * Consequently the type refers to a list of entities
- * which may not be methods (but pointers to methods).
- * This struct is dynamically allocated but constant for the lifetime
- * of the library.
+ * Consequently the type refers to a list of entities
+ * which may not be methods (but pointers to methods).
+ * This struct is dynamically allocated but constant for the lifetime
+ * of the library.
*/
extern tp_op *type_struct;
tp_op *get_tpop_struct(void);
/**
- * This type opcode marks that the corresponding type is a method type.
+ * This type opcode marks that the corresponding type is a method type.
*
- * Consequently it refers to a list of arguments and results.
- * This struct is dynamically allocated but constant for the lifetime
- * of the library.
+ * Consequently it refers to a list of arguments and results.
+ * This struct is dynamically allocated but constant for the lifetime
+ * of the library.
*/
extern tp_op *type_method;
tp_op *get_tpop_method(void);
/**
- * This type opcode marks that the corresponding type is a union type.
+ * This type opcode marks that the corresponding type is a union type.
*
- * Consequently it refers to a list of unioned types.
- * This struct is dynamically allocated but constant for the lifetime
- * of the library.
+ * Consequently it refers to a list of unioned types.
+ * This struct is dynamically allocated but constant for the lifetime
+ * of the library.
*/
extern tp_op *type_union;
tp_op *get_tpop_union(void);
/**
- * This type opcode marks that the corresponding type is an array type.
+ * This type opcode marks that the corresponding type is an array type.
*
- * Consequently it contains a list of dimensions (lower and upper bounds)
- * and an element type.
- * This struct is dynamically allocated but constant for the lifetime
- * of the library.
+ * Consequently it contains a list of dimensions (lower and upper bounds)
+ * and an element type.
+ * This struct is dynamically allocated but constant for the lifetime
+ * of the library.
*/
extern tp_op *type_array;
tp_op *get_tpop_array(void);
/**
- * This type opcode marks that the corresponding type is an enumeration type.
+ * This type opcode marks that the corresponding type is an enumeration type.
*
- * Consequently it contains a list of idents for the enumeration identifiers
- * and a list of target values that are the constants used to implement
- * the enumerators.
- * This struct is dynamically allocated but constant for the lifetime
- * of the library.
+ * Consequently it contains a list of idents for the enumeration identifiers
+ * and a list of target values that are the constants used to implement
+ * the enumerators.
+ * This struct is dynamically allocated but constant for the lifetime
+ * of the library.
*/
extern tp_op *type_enumeration;
tp_op *get_tpop_enumeration(void);
/**
- * This type opcode marks that the corresponding type is a pointer type.
+ * This type opcode marks that the corresponding type is a pointer type.
*
- * It contains a reference to the type the pointer points to.
- * This struct is dynamically allocated but constant for the lifetime
- * of the library.
+ * It contains a reference to the type the pointer points to.
+ * This struct is dynamically allocated but constant for the lifetime
+ * of the library.
*/
extern tp_op *type_pointer;
tp_op *get_tpop_pointer(void);
/**
- * This type opcode marks that the corresponding type is a primitive type.
+ * This type opcode marks that the corresponding type is a primitive type.
*
- * Primitive types are types that are directly mapped to target machine
- * modes.
- * This struct is dynamically allocated but constant for the lifetime
- * of the library.
+ * Primitive types are types that are directly mapped to target machine
+ * modes.
+ * This struct is dynamically allocated but constant for the lifetime
+ * of the library.
*/
extern tp_op *type_primitive;
tp_op *get_tpop_primitive(void);
/**
- * This type opcode is an auxiliary opcode dedicated to support transformations
- * of the type structure.
+ * This type opcode is an auxiliary opcode dedicated to support transformations
+ * of the type structure.
*
- * If a type is changed to another type with another
- * opcode the new type will be allocated with new memory. All nodes refering
- * to the old type need to be changed to refer to the new one. This is simplified
- * by turning the old type into an id type that merely forwards to the new type
- * that now replaces the old one.
- * type_ids should never be visible out of the type module. All access routines
- * should automatically check for type_id and eventually follow the forward in
- * type_id. Two types are exchanged by a call to exchange_types.
- * If a type_id is visible externally report this as bug. If it is assured that
- * this never happens this extern variable can be moved to tpop_t.h.
- * This struct is dynamically allocated but constant for the lifetime
- * of the library.
+ * If a type is changed to another type with another
+ * opcode the new type will be allocated with new memory. All nodes refering
+ * to the old type need to be changed to refer to the new one. This is simplified
+ * by turning the old type into an id type that merely forwards to the new type
+ * that now replaces the old one.
+ * type_ids should never be visible out of the type module. All access routines
+ * should automatically check for type_id and eventually follow the forward in
+ * type_id. Two types are exchanged by a call to exchange_types.
+ * If a type_id is visible externally report this as bug. If it is assured that
+ * this never happens this extern variable can be moved to tpop_t.h.
+ * This struct is dynamically allocated but constant for the lifetime
+ * of the library.
*/
extern tp_op *type_id;
tp_op *get_tpop_id(void);
/**
- * This type opcode is an auxiliary opcode dedicated to support type analyses.
+ * This type opcode is an auxiliary opcode dedicated to support type analyses.
*
- * Types with this opcode represents that there is no type.
- * The type can be used to initialize fields of the type* that actually can not
- * contain a type or that are initialized for an analysis. There exists exactly
- * one type with this opcode.
+ * Types with this opcode represents that there is no type.
+ * The type can be used to initialize fields of the type* that actually can not
+ * contain a type or that are initialized for an analysis. There exists exactly
+ * one type with this opcode.
*/
extern tp_op *tpop_none;
tp_op *get_tpop_none(void);
/**
- * This type opcode is an auxiliary opcode dedicated to support type analyses.
+ * This type opcode is an auxiliary opcode dedicated to support type analyses.
*
- * Types with this opcode represents that there could be a type, but it is not
- * known. This type can be used to initialize fields before an analysis (not known
- * yet) or to represent the top of a lattice (could not be determined). There exists
- * exactly one type with this opcode.
+ * Types with this opcode represents that there could be a type, but it is not
+ * known. This type can be used to initialize fields before an analysis (not known
+ * yet) or to represent the top of a lattice (could not be determined). There exists
+ * exactly one type with this opcode.
*/
extern tp_op *tpop_unknown;
tp_op *get_tpop_unknown(void);
-# endif /*_TYPEOP_H_ */
+#endif /* FIRM_TR_TPOP_H */
* PURPOSE.
*/
-/*
- * Project: libFIRM
- * File name: ir/tr/tpop_t.h
- * Purpose: Opcode of types -- private header.
- * Author: Goetz Lindenmaier
- * Modified by:
- * Created:
- * CVS-ID: $Id$
- * Copyright: (c) 2001-2003 Universität Karlsruhe
+/**
+ * @file
+ * @brief Opcode of types -- private header.
+ * @author Goetz Lindenmaier, Michael Beck
+ * @version $Id$
*/
-#ifndef _TPOP_T_H_
-#define _TPOP_T_H_
+#ifndef FIRM_TR_TPOP_T_H
+#define FIRM_TR_TPOP_T_H
#include <stdlib.h>
* tp_op operations.
*/
typedef struct _tp_op_ops {
- free_attrs_func free_attrs; /**< called to free the attributes of a type */
- free_entities_func free_entities; /**< called to free the owned entities of a type */
- free_auto_entities_func free_auto_entities; /**< called to free the automatic allocated entities of a type */
- set_type_mode_func set_type_mode; /**< called to set a ir_mode of a type */
- set_type_size_func set_type_size; /**< called to set the bit size of a type */
- get_n_members_func get_n_members; /**< called to return the number of compound members */
- get_member_func get_member; /**< called to get the pos'th compound member */
- get_member_index_func get_member_index; /**< called to get the index of a compound member */
+ free_attrs_func free_attrs; /**< called to free the attributes of a type */
+ free_entities_func free_entities; /**< called to free the owned entities of a type */
+ free_auto_entities_func free_auto_entities; /**< called to free the automatic allocated entities of a type */
+ set_type_mode_func set_type_mode; /**< called to set a ir_mode of a type */
+ set_type_size_func set_type_size; /**< called to set the bit size of a type */
+ get_n_members_func get_n_members; /**< called to return the number of compound members */
+ get_member_func get_member; /**< called to get the pos'th compound member */
+ get_member_index_func get_member_index; /**< called to get the index of a compound member */
} tp_op_ops;
/** possible flags for a type opcode */
enum tp_op_flags_t {
- TP_OP_FLAG_COMPOUND = 1 /**< is a compound type */
+ TP_OP_FLAG_COMPOUND = 1 /**< is a compound type */
};
/** The type opcode */
struct tp_op {
- tp_opcode code; /**< the tpop code */
- ident *name; /**< the name of the type opcode */
- size_t attr_size; /**< the attribute size for a type of this opcode */
- unsigned flags; /**< flags for this opcode */
- tp_op_ops ops; /**< tp_op operations */
+ tp_opcode code; /**< the tpop code */
+ ident *name; /**< the name of the type opcode */
+ size_t attr_size; /**< the attribute size for a type of this opcode */
+ unsigned flags; /**< flags for this opcode */
+ tp_op_ops ops; /**< tp_op operations */
};
/**
- * Returns a new type opcode.
+ * Returns a new type opcode.
*
- * Allocates a new tp_op struct and initializes it's fields with
- * the passed values. This function is only to be used during
- * initialization of the library.
+ * Allocates a new tp_op struct and initializes it's fields with
+ * the passed values. This function is only to be used during
+ * initialization of the library.
*
- * @param code the enum for this type opcode.
- * @param name an ident for the name of the type opcode.
- * @param flags additional flags
- * @param attr_size the size of the attributes necessary for a type with
- * this opcode
- * @param ops the tp_op operations for this type
- * @return A new type opcode.
+ * @param code the enum for this type opcode.
+ * @param name an ident for the name of the type opcode.
+ * @param flags additional flags
+ * @param attr_size the size of the attributes necessary for a type with
+ * this opcode
+ * @param ops the tp_op operations for this type
+ * @return A new type opcode.
*/
tp_op *new_tpop (tp_opcode code, ident *name, unsigned flags, size_t attr_size,
const tp_op_ops *ops);
void free_tpop(tp_op *tpop);
/**
- * Initialize the tpop module.
+ * Initialize the tpop module.
*
- * Must be called during the initialization of the library. Allocates
- * opcodes and sets the globals that are external visible as specified
- * in tpop.h.
- * Allocates opcodes for classes, struct, method, union, array,
- * enumeration, pointer and primitive and sets the according values.
+ * Must be called during the initialization of the library. Allocates
+ * opcodes and sets the globals that are external visible as specified
+ * in tpop.h.
+ * Allocates opcodes for classes, struct, method, union, array,
+ * enumeration, pointer and primitive and sets the according values.
*/
void init_tpop (void);
/**
- * Finalize the tpop module.
+ * Finalize the tpop module.
*
- * Frees all type opcodes.
+ * Frees all type opcodes.
*/
void finish_tpop(void);
/**
- * Returns the size of the attribute to this kind
- * of type.
- *
- * Internal feature.
+ * Returns the size of the attribute to this kind
+ * of type.
*
- * @param op The type opcode to get the size for.
- * @return The size of the attribute of types with this opcode.
+ * Internal feature.
*
+ * @param op The type opcode to get the size for.
+ * @return The size of the attribute of types with this opcode.
*/
int get_tpop_attr_size (const tp_op *op);
static INLINE tp_opcode
_get_tpop_code(const tp_op *op) {
- return op->code;
+ return op->code;
}
static INLINE ident *
_get_tpop_ident(const tp_op *op){
- return op->name;
+ return op->name;
}
static INLINE size_t
_get_tpop_attr_size(const tp_op *op) {
- return op->attr_size;
+ return op->attr_size;
}
#define get_tpop_code(op) _get_tpop_code(op)
#define get_tpop_ident(op) _get_tpop_ident(op)
#define get_tpop_attr_size(op) _get_tpop_attr_size(op)
-#endif /* _TPOP_T_H_ */
+#endif /* FIRM_TR_TPOP_T_H */