Commit 30b120ca authored by Götz Lindenmaier's avatar Götz Lindenmaier
Browse files

normalized various stuff

commented

[r3455]
parent 01eb4911
......@@ -17,7 +17,7 @@ subdir := ir/ir
INSTALL_HEADERS = irprog.h irgraph.h irnode.h irmode.h irop.h ircons.h \
irflag.h irvrfy.h irgwalk.h irgmod.h iropt.h irdump.h \
irgopt.h old_fctnames.h ircgcons.h ircgopt.h
irgopt.h ircgcons.h ircgopt.h
SOURCES = $(INSTALL_HEADERS)
......
......@@ -1117,9 +1117,11 @@ new_d_Block (dbg_info* db, int arity, ir_node **in)
res = new_rd_Block(db, current_ir_graph, arity, in);
/* Create and initialize array for Phi-node construction. */
res->attr.block.graph_arr = NEW_ARR_D(ir_node *, current_ir_graph->obst,
current_ir_graph->n_loc);
memset(res->attr.block.graph_arr, 0, sizeof(ir_node *)*current_ir_graph->n_loc);
if (get_irg_phase_state(current_ir_graph) == phase_building) {
res->attr.block.graph_arr = NEW_ARR_D(ir_node *, current_ir_graph->obst,
current_ir_graph->n_loc);
memset(res->attr.block.graph_arr, 0, sizeof(ir_node *)*current_ir_graph->n_loc);
}
for (i = arity-1; i >= 0; i--)
if (get_irn_op(in[i]) == op_Unknown) {
......
This diff is collapsed.
......@@ -1357,7 +1357,7 @@ static void dump_enum_item(type *tp, int pos)
PRINT_ITEMID(tp, pos); fprintf(F, "\"");
fprintf (F, DEFAULT_ENUM_ITEM_ATTRIBUTE);
fprintf (F, "label: ");
fprintf (F, "\"enum item %s\" " ENUM_ITEM_NODE_ATTR, id_to_str(id));
fprintf (F, "\"enum item %s\" " ENUM_ITEM_NODE_ATTR, get_id_str(id));
fprintf (F, "\n info1: \"value: %s\"}\n", buf);
}
......
......@@ -1064,8 +1064,8 @@ static ir_graph *get_call_called_irg(ir_node *call) {
if (get_irn_op(addr) == op_Const) {
/* Check whether the constant is the pointer to a compiled entity. */
tv = get_Const_tarval(addr);
if (tarval_to_entity(tv))
called_irg = get_entity_irg(tarval_to_entity(tv));
if (get_tarval_entity(tv))
called_irg = get_entity_irg(get_tarval_entity(tv));
}
return called_irg;
}
......@@ -1082,8 +1082,8 @@ static void collect_calls(ir_node *call, void *env) {
if (get_irn_op(addr) == op_Const) {
/* Check whether the constant is the pointer to a compiled entity. */
tv = get_Const_tarval(addr);
if (tarval_to_entity(tv)) {
called_irg = get_entity_irg(tarval_to_entity(tv));
if (get_tarval_entity(tv)) {
called_irg = get_entity_irg(get_tarval_entity(tv));
if (called_irg && ienv->pos < MAX_INLINE) {
/* The Call node calls a locally defined method. Remember to inline. */
ienv->calls[ienv->pos++] = call;
......@@ -1127,7 +1127,7 @@ void inline_small_irgs(ir_graph *irg, int size) {
tarval *tv;
ir_graph *callee;
tv = get_Const_tarval(get_Call_ptr(env.calls[i]));
callee = get_entity_irg(tarval_to_entity(tv));
callee = get_entity_irg(get_tarval_entity(tv));
if (((_obstack_memory_used(callee->obst) - obstack_room(callee->obst)) < size) ||
(get_irg_inline_property(callee) == irg_inline_forced)) {
inline_method(env.calls[i], callee);
......
......@@ -83,7 +83,7 @@ typedef struct ir_graph ir_graph;
extern ir_graph *current_ir_graph;
ir_graph *get_current_ir_graph(void);
void set_current_ir_graph(ir_graph *graph);
void set_current_ir_graph(ir_graph *graph);
/** This flag indicate the current view. The behaviour of some methods
* (get_irn_*, set_irn_*) is influenced by this flag. */
......@@ -190,13 +190,7 @@ void set_irg_current_block (ir_graph *irg, ir_node *node);
ir_node *get_irg_bad (ir_graph *irg);
void set_irg_bad (ir_graph *irg, ir_node *node);
/* Use new_Unknown() instead!! */
/* GL removed: we need unknown with mode for analyses.
ir_node *get_irg_unknown (ir_graph *irg);
void set_irg_unknown (ir_graph *irg, ir_node *node);
*/
/** Returns teh number of value numbers of a graph. */
/** Returns the number of value numbers of a graph. */
int get_irg_n_locs (ir_graph *irg);
/** Returns the graph number. */
......
......@@ -198,16 +198,16 @@ int is_mode(void *thing);
/* ********** Access methods to read mode information *********** */
/** Returns the classification of the mode */
modecode get_mode_modecode(const ir_mode *mode);
modecode get_mode_modecode(const ir_mode *mode);
/** Returns the ident* of the mode */
ident *get_mode_ident(const ir_mode *mode);
ident *get_mode_ident(const ir_mode *mode);
/** Returns the null-terminated name of this mode. */
const char *get_mode_name(const ir_mode *mode);
/** Returns a coarse classification of the mode. */
mode_sort get_mode_sort(const ir_mode *mode);
mode_sort get_mode_sort(const ir_mode *mode);
/** Returns the size of values of the mode in bits. */
int get_mode_size_bits(const ir_mode *mode);
......@@ -231,23 +231,27 @@ int get_mode_sign(const ir_mode *mode);
/** Returns the arithmetic of a mode */
int get_mode_arithmetic(const ir_mode *mode);
/** Attribute modulo shift specifies for modes of kind irms_int_number
/** Get the modulo shift attribute.
*
* Attribute modulo shift specifies for modes of kind irms_int_number
* whether shift applies modulo to value of bits to shift. Zero for
* modes that are not integer.
*/
unsigned int get_mode_modulo_shift(const ir_mode *mode);
/** Attribute vector_elem specifies the number of vector elements of
/** Return the number of vector elements.
*
* Attribute vector_elem specifies the number of vector elements of
* a vector mode. For non-vector modes it returns 1 for data and 0
* for all other modes
*/
unsigned int get_mode_vector_elems(const ir_mode *mode);
/** Returns the stored intermediate information. */
void* get_mode_link(const ir_mode *mode);
void *get_mode_link(const ir_mode *mode);
/** Stores new intermediate information. */
void set_mode_link(ir_mode *mode, void *l);
void set_mode_link(ir_mode *mode, void *l);
/**
* Returns the smallest representable value of a given mode.
......
......@@ -245,8 +245,7 @@ typedef enum {
* @remark This is the old name convention, don't use anymore.
*/
typedef enum {
pns_initial_exec, /**< Projection on an executable, the initial control
flow. */
pns_initial_exec, /**< Projection on an executable, the initial control flow. */
pns_global_store, /**< Projection on the global store */
pns_frame_base, /**< Projection on the frame base */
pns_globals, /**< Projection on the pointer to the data segment
......@@ -277,7 +276,7 @@ int is_value_arg_pointer(ir_node *n);
/* @@@ no more supported */
ir_node **get_Block_cfgpred_arr (ir_node *node);
int get_Block_n_cfgpreds (ir_node *node);
int get_Block_n_cfgpreds (ir_node *node);
ir_node *get_Block_cfgpred (ir_node *node, int pos);
void set_Block_cfgpred (ir_node *node, int pos, ir_node *pred);
bool get_Block_matured (ir_node *node);
......@@ -426,8 +425,6 @@ type *get_SymConst_type (ir_node *node);
void set_SymConst_type (ir_node *node, type *tp);
/** Only to access SymConst of kind addr_name. Else assertion: */
#define get_SymConst_ptrinfo get_SymConst_name
#define set_SymConst_ptrinfo set_SymConst_name
ident *get_SymConst_name (ir_node *node);
void set_SymConst_name (ir_node *node, ident *name);
......@@ -751,10 +748,10 @@ long get_Filter_proj(ir_node *node);
void set_Filter_proj(ir_node *node, long proj);
/* set the interprocedural predecessors, ...d_arr uses current_ir_graph.
* @@@ Maybe better: arity is zero if no cg preds. */
void set_Filter_cg_pred_arr(ir_node * node, int arity, ir_node ** in);
void set_Filter_cg_pred(ir_node * node, int pos, ir_node * pred);
int get_Filter_n_cg_preds(ir_node *node);
ir_node * get_Filter_cg_pred(ir_node *node, int pos);
void set_Filter_cg_pred_arr(ir_node * node, int arity, ir_node ** in);
void set_Filter_cg_pred(ir_node * node, int pos, ir_node * pred);
int get_Filter_n_cg_preds(ir_node *node);
ir_node *get_Filter_cg_pred(ir_node *node, int pos);
/**
* Projection numbers for Load: use for Proj nodes!
......@@ -826,7 +823,6 @@ void set_Sync_pred (ir_node *node, int pos, ir_node *pred);
ir_node *get_Proj_pred (ir_node *node);
void set_Proj_pred (ir_node *node, ir_node *pred);
/* Why long? shouldn't int be enough, and smaller? Or even byte? */
long get_Proj_proj (ir_node *node);
void set_Proj_proj (ir_node *node, long proj);
......
......@@ -79,13 +79,26 @@ ir_prog *get_irp(void);
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);
/** frees all memory used by irp. Types in type list and irgs in irg
list must be freed by hand before. */
* list must be freed by hand before. */
void free_ir_prog(void);
/** Sets the file name / executable name or the like. Initially NULL. */
void set_irp_prog_name (ident *name);
/** Gets the file name / executable name or the like. Returns NULL if
* not yet set.
*/
ident *get_irp_prog_ident(void);
/** Gets the file name / executable name or the like. Returns NULL if
* not yet set.
*/
const char *get_irp_prog_name (void);
/** Gets the main routine of the compiled program. */
ir_graph *get_irp_main_irg(void);
......@@ -108,11 +121,15 @@ ir_graph *get_irp_irg(int pos);
/** Sets the ir graph at position pos. */
void set_irp_irg(int pos, ir_graph *irg);
/** Returns the "global" type of the irp. */
type *get_glob_type(void);
/** Adds type to the list of types in irp. */
void add_irp_type(type *typ);
/** Removes type from the list of types, deallocates it and
shrinks the list by one. */
shrinks the list by one. */
void remove_irp_type(type *typ);
/** Returns the number of all types in the irp. */
......@@ -124,29 +141,20 @@ type *get_irp_type(int pos);
/** Overwrites the type at position pos with another type. */
void set_irp_type(int pos, type *typ);
/** Returns the "global" type of the irp. */
type *get_glob_type(void);
/** File name / executable name or the like. Initially NULL! **/
void set_irp_prog_name (ident *name);
ident *get_irp_prog_ident(void);
const char *get_irp_prog_name (void);
/**
* Returns an irgraph that only contains constant
* expressions for constant entities.
* Do not use any access function for this graph, do not generate code
* for this graph. This graph contains only one block. The constant
* expressions may not contain control flow. See also copy_const_code()
* in entity.h.
/** Return the graph for global constants.
*
* Returns an irgraph that only contains constant expressions for
* constant entities. Do not use any access function for this
* graph, do not generate code for this graph. This graph contains
* only one block. The constant expressions may not contain control
* flow.
* Walking the graph starting from any node will not reach the block
* or any controlflow.
* See also copy_const_code() in entity.h.
*/
ir_graph *get_const_code_irg(void);
irg_outs_state get_irp_ip_outs_state(void);
void set_irp_ip_outs_inconsistent(void);
/* @@@ Must this be global visible? */
void set_irp_ip_outedges(ir_node ** ip_outedges);
ir_node** get_irp_ip_outedges(void);
#endif /* ifndef _IRPROG_H_ */
......@@ -105,6 +105,9 @@ __get_const_code_irg(void)
return irp->const_code_irg;
}
void set_irp_ip_outedges(ir_node ** ip_outedges);
ir_node** get_irp_ip_outedges(void);
#define get_irp_n_irgs() __get_irp_n_irgs()
#define get_irp_irg(pos) __get_irp_irg(pos)
#define get_irp_n_types() __get_irp_n_types()
......
......@@ -667,18 +667,29 @@ int irn_vrfy_irg(ir_node *n, ir_graph *irg)
case iro_Const: {
tarval *tv = get_Const_tarval(n);
if (tarval_is_entity(tv))
ASSERT_AND_RET((get_irn_irg(n) == get_const_code_irg()) ||
(get_entity_peculiarity(tarval_to_entity(tv)) != peculiarity_description),
"descriptions have no address", 0);
ASSERT_AND_RET(
/* Const: BB --> data */
(mode_is_data (mymode) ||
mymode == mode_b) /* we want boolean constants for static evaluation */
,"Const node", 0 /* of Cmp. */
);
ASSERT_AND_RET(
(get_irn_irg(n) == get_const_code_irg()) ||
(get_entity_peculiarity(get_tarval_entity(tv)) != peculiarity_description),
"descriptions have no address", 0);
ASSERT_AND_RET(
/* Const: BB --> data */
(mode_is_data (mymode) ||
mymode == mode_b) /* we want boolean constants for static evaluation */
,"Const node", 0 /* of Cmp. */
);
} break;
case iro_SymConst:
if (get_SymConst_kind(n) == symconst_addr_ent) {
entity *ent = get_SymConst_entity(n);
if (is_method_type(get_entity_type(ent)) &&
get_irn_irg(n) != get_const_code_irg()) {
#if 0
ASSERT_AND_RET((get_entity_peculiarity(ent) != peculiarity_description),
"A constant must address an existing method.", 0);
#endif
}
}
ASSERT_AND_RET(
/* SymConst: BB --> int*/
(mode_is_int(mymode) ||
......
/*
* Project: libFIRM
* File name: ir/ir/old_fctnames.h
* Purpose: Some makros supporting old function names.
* Author: Goetz Lindenmaier
* Modified by:
* Created:
* CVS-ID: $Id$
* Copyright: (c) 1998-2003 Universitt Karlsruhe
* Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
*/
#ifndef __OLD_FCTNAMES_H__
#define __OLD_FCTNAMES_H__
/* irgraph */
#define get_irg_params get_irg_n_locs
#define get_irg_n_loc get_irg_n_locs
#define set_irg_params set_irg_n_loc
/* irnode.h */
#define get_Return_n_res get_Return_n_ress
#define get_Sel_n_index get_Sel_n_indexs
/* irmode.h */
#define get_ident_of_mode get_mode_ident
#define get_size_of_mode get_mode_size
#define get_ld_align_of_mode get_mode_ld_align
#define get_min_of_mode get_mode_min
#define get_max_of_mode get_mode_max
#define get_null_of_mode get_mode_null
#define get_fsigned_of_mode get_mode_fsigned
#define get_ffloat_of_mode get_mode_ffloat
#define get_mode_size(X) { assert(get_mode_size_bytes(X) != -1); get_mode_size_bytes(X); }
/* type.h */
#define get_type_nameid(_t_) get_type_ident(_t_)
#define set_type_nameid(_t_,_i_) set_type_ident(_t_,_i_)
#define get_class_n_member get_class_n_members
#define get_class_n_subtype get_class_n_subtypes
#define get_class_n_supertype get_class_n_supertypes
#define get_struct_n_member get_struct_n_members
#define get_method_n_res(X) get_method_n_ress(X)
/* tarval.h */
#define tarval_from_long(X, Y) new_tarval_from_long(Y, X)
#define tarval_P_from_entity(X) new_tarval_from_entity(X, mode_P_mach)
#define get_tarval_entity(X) tarval_to_entity(X)
/* ident.h */ /* @@@ Attention: still in ident.h */
/* #define id_to_str get_id_str */
/* #define id_to_strlen get_id_strlen */
#endif
......@@ -282,7 +282,7 @@ void opt_tail_rec_irg(ir_graph *irg)
if (! tarval_is_entity(tv))
continue;
ent = tarval_to_entity(tv);
ent = get_tarval_entity(tv);
if (!ent || get_entity_irg(ent) != irg)
continue;
......
......@@ -201,7 +201,7 @@ type *get_entity_owner (entity *ent);
ent to owner!! */
void set_entity_owner (entity *ent, type *owner);
/** Asserts if the type owner is neither a compound type or an array */
/** Asserts if the type owner is either a compound type or an array */
void assert_legal_owner_of_ent(type *owner);
/** Returns the type of an entity. */
......@@ -262,9 +262,9 @@ typedef enum {
variability_uninitialized, /**< The content of the entity is completely unknown. */
variability_initialized, /**< After allocation the entity is initalized with the
value given somewhere in the entity. */
variability_part_constant, /**< For entities of compound types. Some members of the entity
are constant. The others are uninitialized. Those members
given a value for are constant. */
variability_part_constant, /**< For entities of compound types.
The members of the entity are mixed constant,
initialized or uninitialized. */
variability_constant /**< The entity is constant. */
} ent_variability;
......
......@@ -23,7 +23,6 @@
# include "ident.h"
# include "entity.h"
# include "type.h"
/** initializes the name mangling code */
void init_mangle (void);
......@@ -37,6 +36,6 @@ ident *mangle_entity (entity *ent);
ident *mangle_u (ident *first, ident* scnd);
/** mangle: Returns a new ident that represents firstscnd. */
ident *mangle (ident *first, ident* scnd);
ident *mangle (ident *first, ident* scnd);
#endif /* _MANGLE_H_ */
......@@ -577,7 +577,7 @@ type *get_method_param_type(type *method, int pos);
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. */
for compounds passed by value. This information is constrnewucted only on demand. */
entity *get_method_value_param_ent(type *method, int pos);
/**
* Returns a type that represents the copied value arguments.
......
......@@ -22,16 +22,15 @@
* This module supplies routines that support changing the type graph.
*/
/**
* replaces one type by the other.
/** Replaces one type by the other.
*
* Old type is replaced by new_type. All references to old_type
* now point to new_type. The memory for the old type is destroyed,
* but still used. Therefore it is not freed.
* All referenced to this memory will be lost after a certain while.
* An exception is the list of types in irp (irprog.h).
* In the future there might be a routine to recover the memory, but
* this will be at considerable runtime cost.
* Old type is replaced by new_type. All references to old_type
* now point to new_type. The memory for the old type is destroyed,
* but still used. Therefore it is not freed.
* All referenced to this memory will be lost after a certain while.
* An exception is the list of types in irp (irprog.h).
* In the future there might be a routine to recover the memory, but
* this will be at considerable runtime cost.
*
* @param old_type - The old type that shall be replaced by the new type.
* @param new_type - The new type that will replace old_type.
......@@ -39,14 +38,13 @@
*/
void exchange_types(type *old_type, type *new_type);
/**
* Skip id types until a useful type is reached.
/** Skip id types until a useful type is reached.
*
* @param tp - A type of arbitrary kind.
* @param tp - A type of arbitrary kind.
*
* @return
* tp if it is not an id type.
* If tp is an id type returns the real type it stands for.
* @return
* tp if it is not an id type.
* If tp is an id type returns the real type it stands for.
*/
type *skip_tid(type *tp);
......
......@@ -425,7 +425,9 @@ int tarval_is_entity(tarval *tv)
&& (tv != tarval_P_void));
}
entity *tarval_to_entity(tarval *tv)
#undef tarval_to_entity
entity *tarval_to_entity(tarval *tv) { return get_tarval_entity(tv); }
entity *get_tarval_entity(tarval *tv)
{
ANNOUNCE();
assert(tv);
......
......@@ -228,8 +228,7 @@ tarval *new_tarval_from_entity (entity *ent, ir_mode *mode);
* Returns the associated entity of a tarval. Asserts if tarval does not
* contain an entity.
*/
#define get_tarval_entity tarval_to_entity
entity *tarval_to_entity(tarval *tv);
entity *get_tarval_entity(tarval *tv);
/**
* Returns non-zero if a the given tarval represents an entity.
......@@ -584,21 +583,7 @@ typedef enum _tarval_classification_t {
*/
tarval_classification_t tarval_classify(tarval *tv);
/**
* Initialization of the tarval module.
*
* Call before init_mode().
*/
void init_tarval_1(void);
/**
* Initialization of the tarval module.
*
* Call after init_mode().
*/
void init_tarval_2(void);
void finish_tarval(void);
/**
* Output of tarvals to a buffer.
......
......@@ -18,8 +18,28 @@
#include "tv.h"
/**
* Initialization of the tarval module.
*
* Call before init_mode().
*/
void init_tarval_1(void);
/**
* Initialization of the tarval module.
*
* Call after init_mode().
*/
void init_tarval_2(void);
/**
* Free all memory occupied by the tarval module.
*/
void finish_tarval(void);
/**
* This struct represents the aforementioned tarvals.
* This struct represents the afore mentioned tarvals.
*
* A tarval struct consists of an internal representation of the
* value and some additional fields further describing the value.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment