/*
- * (C) 2001 by Universitaet Karlsruhe
+ * Project: libFIRM
+ * File name: ir/tr/type.h
+ * Purpose: Representation of types.
+ * Author: Goetz Lindenmaier
+ * Modified by:
+ * Created:
+ * CVS-ID: $Id$
+ * Copyright: (c) 2001-2003 Universität Karlsruhe
+ * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
*/
/**
* on the level of the programming language, modes at the level of
* the target processor.
*
- * @see tpop.h
+ * @see tpop.h
*/
-/* $Id$ */
-
# ifndef _TYPE_H_
# define _TYPE_H_
/** This enumeration flags the peculiarity of entities and types. */
typedef enum peculiarity {
- description, /**< Represents only a description. The entity/type is never
- allocated, no code/data exists for this entity/type. */
- inherited, /**< Describes explicitly that other entities are
- inherited to the owner of this entity.
- Overwrites must refer to at least one other
- entity. If this is a method entity there exists
- no irg for this entity, only for one of the
- overwritten ones. */
- existent /**< The entity/type (can) exist. */
+ peculiarity_description, /**< Represents only a description. The entity/type is never
+ allocated, no code/data exists for this entity/type. */
+ peculiarity_inherited, /**< Describes explicitly that other entities are
+ inherited to the owner of this entity.
+ Overwrites must refer to at least one other
+ entity. If this is a method entity there exists
+ no irg for this entity, only for one of the
+ overwritten ones. */
+ peculiarity_existent /**< The entity/type (can) exist. */
} peculiarity;
/* The peculiarity of the class. The enumeration peculiarity is defined
* in the parameter tuple that is a result of the start node.
* (See ircons.h for more information.)
*
+ * - value_param_ents
+ * A list of entities (whose owner is a struct private to the
+ * method type) that represent parameters passed by value.
+ *
* - n_res: The number of results of the method. In general, procedures
* have zero results, functions one.
*
* - res_type: A list with the types of parameters. This list is ordered.
* The nth type in this list corresponds to the nth input to
* Return nodes. (See ircons.h for more information.)
+ *
+ * - value_res_ents
+ * A list of entities (whose owner is a struct private to the
+ * method type) that represent results passed by value.
*/
+/* These makros define the suffixes for the types and entities used
+ to represent value parameters / results. */
+#define VALUE_PARAMS_SUFFIX "val_param"
+#define VALUE_RESS_SUFFIX "val_res"
+
/** Create a new method type.
*
* @param name the name (ident) of this type
/** Returns the type of the parameter at position pos of a method. */
type *get_method_param_type(type *method, int pos);
-
-/** Sets the type of the parameter at position pos of a method. */
+/** Sets the type of the parameter at position pos of a method.
+ Also changes the type in the pass-by-value representation by just
+ changing the type of the corresponding entity if the representation is constructed. */
void set_method_param_type(type *method, int pos, type* tp);
+/* Returns an entity that represents the copied value argument. Only necessary
+ for compounds passed by value. This information is constructed only on demand. */
+entity *get_method_value_param_ent(type *method, int pos);
int get_method_n_ress (type *method);
type *get_method_res_type(type *method, int pos);
+/** Sets the type of the result at position pos of a method.
+ Also changes the type in the pass-by-value representation by just
+ changing the type of the corresponding entity if the representation is constructed. */
void set_method_res_type(type *method, int pos, type* tp);
+/* Returns an entity that represents the copied value result. Only necessary
+ for compounds passed by value. This information is constructed only on demand. */
+entity *get_method_value_res_ent(type *method, int pos);
/**
* this enum flags the variadicity of methods (methods with a
void set_array_lower_bound_int (type *array, int dimension, int lower_bound);
void set_array_upper_bound (type *array, int dimension, ir_node *upper_bound);
void set_array_upper_bound_int (type *array, int dimension, int lower_bound);
+/* returns true if lower bound != Unknown */
+int has_array_lower_bound (type *array, int dimension);
ir_node * get_array_lower_bound (type *array, int dimension);
+int has_array_upper_bound (type *array, int dimension);
ir_node * get_array_upper_bound (type *array, int dimension);
void set_array_order (type *array, int dimension, int order);
/**
* @page pointer_type Representation of a pointer type
*
+ * The mode of the pointer type must be a mode_reference.
+ *
* Pointer types:
* - points_to: The type of the entity this pointer points to.
*/
-/** Creates a new type pointer. */
-type *new_type_pointer (ident *name, type *points_to);
-/** Creates a new type pointer with debug information. */
-type *new_d_type_pointer (ident *name, type *points_to, dbg_info* db);
+/** Creates a new type pointer with mode mode_p. */
+#define new_type_pointer(N, P) new_type_pointer_mode(N, P, mode_P)
+//type *new_type_pointer (ident *name, type *points_to);
+
+/** Creates a new type pointer with given pointer mode. */
+type *new_type_pointer_mode (ident *name, type *points_to, ir_mode *ptr_mode);
+
+/** Creates a new type pointer given pointer mode and with debug information. */
+type *new_d_type_pointer (ident *name, type *points_to, ir_mode *ptr_mode, dbg_info* db);
/* --- manipulate fields of type_pointer --- */