Commit 8ca297d3 authored by Michael Beck's avatar Michael Beck
Browse files

Updated header

changed indentation

[r13516]
parent 077b99e3
......@@ -17,15 +17,11 @@
* 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 Universitt 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"
......
......@@ -29,12 +29,11 @@
*/
/**
* @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
......@@ -55,8 +54,8 @@
*
* @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"
......@@ -646,4 +645,4 @@ ir_img_section get_method_img_section(const ir_entity *method);
/** 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 */
......@@ -18,43 +18,13 @@
*/
/*
* 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"
......@@ -467,4 +437,4 @@ _get_entity_repr_class(const ir_entity *ent) {
#define get_entity_repr_class(ent) _get_entity_repr_class(ent)
#endif /* _FIRM_TR_ENTITY_T_H_ */
#endif /* FIRM_TR_ENTITY_T_H */
......@@ -17,15 +17,11 @@
* 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 Universitt 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"
......
......@@ -17,27 +17,14 @@
* 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"
......@@ -62,4 +49,4 @@ ident *mangle (ident *first, ident* scnd);
/** 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 */
......@@ -17,23 +17,19 @@
* 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 Universitt 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; }
......@@ -51,144 +47,143 @@ tp_op *
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
......@@ -196,33 +191,33 @@ init_tpop(void)
/* 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);
}
......@@ -18,17 +18,11 @@
*/
/**
*
* @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.
*
......@@ -39,37 +33,36 @@
*
* @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()
*/
......@@ -77,157 +70,157 @@ typedef struct tp_op tp_op;
/**
* 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.