From: Matthias Braun Date: Wed, 6 Oct 2010 08:40:42 +0000 (+0000) Subject: remove irsimpletype stuff (unused/broken) X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=f8d7cadcac7404b56a67f0c6b6cd71a76cda9bd6;p=libfirm remove irsimpletype stuff (unused/broken) [r28043] --- diff --git a/include/libfirm/firm.h b/include/libfirm/firm.h index 56e7ddf2f..771203e76 100644 --- a/include/libfirm/firm.h +++ b/include/libfirm/firm.h @@ -102,7 +102,6 @@ #include "irpass.h" #include "irprintf.h" #include "irprog.h" -#include "irsimpletype.h" #include "irtypeinfo.h" #include "irverify.h" #include "lowering.h" diff --git a/include/libfirm/ircons.h b/include/libfirm/ircons.h index 4533a9631..b98030f9d 100644 --- a/include/libfirm/ircons.h +++ b/include/libfirm/ircons.h @@ -1207,22 +1207,6 @@ FIRM_API ir_node *new_rd_Cond(dbg_info *db, ir_node *block, ir_node *c); FIRM_API ir_node *new_rd_Return(dbg_info *db, ir_node *block, ir_node *store, int arity, ir_node *in[]); -/** Constructor for a Const_type node. - * - * Adds the node to the start block. - * - * The constant represents a target value. This constructor sets high - * level type information for the constant value. - * Derives mode from passed tarval. - * - * @param *db A pointer for debug information. - * @param *irg The IR graph the node belongs to. - * @param *con Points to an entry in the constant table. - * @param *tp The type of the constant. - */ -FIRM_API ir_node *new_rd_Const_type(dbg_info *db, ir_graph *irg, - tarval *con, ir_type *tp); - /** Constructor for a Const node. * * Adds the node to the start block. @@ -1255,7 +1239,7 @@ FIRM_API ir_node *new_rd_Const(dbg_info *db, ir_graph *irg, tarval *con); FIRM_API ir_node *new_rd_Const_long(dbg_info *db, ir_graph *irg, ir_mode *mode, long value); -/** Constructor for a SymConst_type node. +/** Constructor for a SymConst node. * * This is the constructor for a symbolic constant. * There are several kinds of symbolic constants: @@ -1289,15 +1273,6 @@ FIRM_API ir_node *new_rd_Const_long(dbg_info *db, ir_graph *irg, * @param val A type, ident, entity or enum constant depending on the * SymConst kind. * @param kind The kind of the symbolic constant, see the list above - * @param tp The source type of the constant. - */ -FIRM_API ir_node *new_rd_SymConst_type(dbg_info *db, ir_graph *irg, - ir_mode *mode, union symconst_symbol val, - symconst_kind kind, ir_type *tp); - -/** Constructor for a SymConst node. - * - * Same as new_rd_SymConst_type, except that it sets the type to type_unknown. */ FIRM_API ir_node *new_rd_SymConst(dbg_info *db, ir_graph *irg, ir_mode *mode, union symconst_symbol value, @@ -1305,51 +1280,46 @@ FIRM_API ir_node *new_rd_SymConst(dbg_info *db, ir_graph *irg, ir_mode *mode, /** Constructor for a SymConst addr_ent node. * - * Same as new_rd_SymConst_type, except that the constructor is tailored for + * Same as new_rd_SymConst, except that the constructor is tailored for * symconst_addr_ent. * Adds the SymConst to the start block of irg. */ FIRM_API ir_node *new_rd_SymConst_addr_ent(dbg_info *db, ir_graph *irg, - ir_mode *mode, ir_entity *symbol, - ir_type *tp); + ir_mode *mode, ir_entity *symbol); /** Constructor for a SymConst ofs_ent node. * - * Same as new_rd_SymConst_type, except that the constructor is tailored for + * Same as new_rd_SymConst, except that the constructor is tailored for * symconst_ofs_ent. * Adds the SymConst to the start block of irg. */ FIRM_API ir_node *new_rd_SymConst_ofs_ent(dbg_info *db, ir_graph *irg, - ir_mode *mode, ir_entity *symbol, - ir_type *tp); + ir_mode *mode, ir_entity *symbol); /** Constructor for a SymConst type_tag node. * - * Same as new_rd_SymConst_type, except that the constructor is tailored for + * Same as new_rd_SymConst, except that the constructor is tailored for * symconst_type_tag. * Adds the SymConst to the start block of irg. */ FIRM_API ir_node *new_rd_SymConst_type_tag(dbg_info *db, ir_graph *irg, - ir_mode *mode, ir_type *symbol, - ir_type *tp); + ir_mode *mode, ir_type *symbol); /** Constructor for a SymConst size node. * - * Same as new_rd_SymConst_type, except that the constructor is tailored for + * Same as new_rd_SymConst, except that the constructor is tailored for * symconst_type_size. * Adds the SymConst to the start block of irg. */ FIRM_API ir_node *new_rd_SymConst_size(dbg_info *db, ir_graph *irg, - ir_mode *mode, ir_type *symbol, - ir_type *tp); + ir_mode *mode, ir_type *symbol); /** Constructor for a SymConst size node. * - * Same as new_rd_SymConst_type, except that the constructor is tailored for + * Same as new_rd_SymConst, except that the constructor is tailored for * symconst_type_align. * Adds the SymConst to the start block of irg. */ FIRM_API ir_node *new_rd_SymConst_align(dbg_info *db, ir_graph *irg, - ir_mode *mode, ir_type *symbol, - ir_type *tp); + ir_mode *mode, ir_type *symbol); /** Constructor for a simpleSel node. * @@ -2052,20 +2022,6 @@ FIRM_API ir_node *new_r_Const(ir_graph *irg, tarval *con); */ FIRM_API ir_node *new_r_Const_long(ir_graph *irg, ir_mode *mode, long value); -/** Constructor for a Const_type node. - * - * Adds the node to the start block. - * - * The constant represents a target value. This constructor sets high - * level type information for the constant value. - * Derives mode from passed tarval. - * - * @param *irg The IR graph the node belongs to. - * @param *con Points to an entry in the constant table. - * @param *tp The type of the constant. - */ -FIRM_API ir_node *new_r_Const_type(ir_graph *irg, tarval *con, ir_type *tp); - /** Constructor for a SymConst node. * * This is the constructor for a symbolic constant. @@ -2759,21 +2715,6 @@ FIRM_API ir_node *new_d_Cond(dbg_info *db, ir_node *c); FIRM_API ir_node *new_d_Return(dbg_info *db, ir_node *store, int arity, ir_node *in[]); -/** Constructor for a Const_type node. - * - * Adds the node to the start block. - * - * The constant represents a target value. This constructor sets high - * level type information for the constant value. - * Derives mode from passed tarval. - * - * @param *db A pointer for debug information. - * @param *con Points to an entry in the constant table. This pointer is - added to the attributes of the node. - * @param *tp The type of the constant. - */ -FIRM_API ir_node *new_d_Const_type(dbg_info *db, tarval *con, ir_type *tp); - /** Constructor for a Const node. * * Adds the node to the block in current_ir_block. @@ -2798,7 +2739,7 @@ FIRM_API ir_node *new_d_Const(dbg_info *db, tarval *con); */ FIRM_API ir_node *new_d_Const_long(dbg_info *db, ir_mode *mode, long value); -/** Constructor for a SymConst_type node. +/** Constructor for a SymConst node. * * This is the constructor for a symbolic constant. * There are several kinds of symbolic constants: @@ -2831,15 +2772,6 @@ FIRM_API ir_node *new_d_Const_long(dbg_info *db, ir_mode *mode, long value); * @param value A type, ident, entity or enum constant depending on the * SymConst kind. * @param kind The kind of the symbolic constant, see the list above - * @param tp The source type of the constant. - */ -FIRM_API ir_node *new_d_SymConst_type(dbg_info *db, ir_mode *mode, - union symconst_symbol value, - symconst_kind kind, ir_type *tp); - -/** Constructor for a SymConst node. - * - * Same as new_d_SymConst_type, except that it sets the type to type_unknown. */ FIRM_API ir_node *new_d_SymConst(dbg_info *db, ir_mode *mode, union symconst_symbol value, @@ -3539,48 +3471,6 @@ FIRM_API ir_node *new_Const(tarval *con); */ FIRM_API ir_node *new_Const_long(ir_mode *mode, long value); -/** Constructor for a Const node. - * - * Derives mode from passed tarval. */ -FIRM_API ir_node *new_Const_type(tarval *con, ir_type *tp); - -/** Constructor for a SymConst_type node. - * - * This is the constructor for a symbolic constant. - * There are several kinds of symbolic constants: - * - symconst_type_tag The symbolic constant represents a type tag. The - * type the tag stands for is given explicitly. - * - symconst_type_size The symbolic constant represents the size of a type. - * The type of which the constant represents the size - * is given explicitly. - * - symconst_type_align The symbolic constant represents the alignment of a - * type. The type of which the constant represents the - * size is given explicitly. - * - symconst_addr_ent The symbolic constant represents the address of an - * entity (variable or method). The variable is given - * explicitly by a firm entity. - * - symconst_ofs_ent The symbolic constant represents the offset of an - * entity in its owner type. - * - symconst_enum_const The symbolic constant is a enumeration constant of - * an enumeration type. - * - * Inputs to the node: - * No inputs except the block it belongs to. - * Outputs of the node. - * An unsigned integer (I_u) or a pointer (P). - * - * Mention union in declaration so that the firmjni generator recognizes that - * it can not cast the argument to an int. - * - * @param mode The mode for the SymConst. - * @param value A type, ident, entity or enum constant depending on the - * SymConst kind. - * @param kind The kind of the symbolic constant, see the list above - * @param tp The source type of the constant. - */ -FIRM_API ir_node *new_SymConst_type(ir_mode *mode, union symconst_symbol value, - symconst_kind kind, ir_type *tp); - /** Constructor for a SymConst node. * * This is the constructor for a symbolic constant. diff --git a/include/libfirm/irnode.h b/include/libfirm/irnode.h index bef1ada2e..c3185157f 100644 --- a/include/libfirm/irnode.h +++ b/include/libfirm/irnode.h @@ -391,14 +391,6 @@ FIRM_API int is_strictConv(const ir_node *node); /** Returns true if node is a SymConst node with kind symconst_addr_ent. */ FIRM_API int is_SymConst_addr_ent(const ir_node *node); -/** Returns the source language type of a Const node. - * Must be an atomic type. Mode of type must be mode of node. - */ -FIRM_API ir_type *get_Const_type(const ir_node *node); - -/** Sets the source language type of a Const node. */ -FIRM_API void set_Const_type(ir_node *node, ir_type *tp); - /** Returns non-zero if s symconst kind has a type attribute */ #define SYMCONST_HAS_TYPE(kind) ((kind) <= symconst_type_align) @@ -432,12 +424,6 @@ FIRM_API union symconst_symbol get_SymConst_symbol(const ir_node *node); FIRM_API void set_SymConst_symbol(ir_node *node, union symconst_symbol sym); -/** Access the type of the value represented by the SymConst. - * - * Example: primitive type int for SymConst size. */ -FIRM_API ir_type *get_SymConst_value_type(const ir_node *node); -FIRM_API void set_SymConst_value_type(ir_node *node, ir_type *tp); - FIRM_API ir_node **get_Sel_index_arr(ir_node *node); FIRM_API int get_Sel_n_indexs(const ir_node *node); FIRM_API ir_node *get_Sel_index(const ir_node *node, int pos); @@ -666,11 +652,6 @@ FIRM_API int is_irn_forking(const ir_node *node); */ FIRM_API void copy_node_attr(ir_graph *irg, const ir_node *old_node, ir_node *new_node); -/** Return the type associated with the value produced by n - * if the node remarks this type as it is the case for - * Cast, Const, SymConst and some Proj nodes or unknown_type. */ -FIRM_API ir_type *get_irn_type(ir_node *n); - /** Return the type attribute of a node n (SymConst, Call, Alloc, Free, Cast) or NULL.*/ FIRM_API ir_type *get_irn_type_attr(ir_node *n); diff --git a/include/libfirm/irop.h b/include/libfirm/irop.h index fb9992a06..0f3aad087 100644 --- a/include/libfirm/irop.h +++ b/include/libfirm/irop.h @@ -182,12 +182,6 @@ typedef int (*reassociate_func)(ir_node **n); */ typedef void (*copy_attr_func)(ir_graph *irg, const ir_node *old_node, ir_node *new_node); -/** - * The get_type operation. - * Return the type of the node self. - */ -typedef ir_type *(*get_type_func)(const ir_node *self); - /** * The get_type_attr operation. Used to traverse all types that can be * accessed from an ir_graph. @@ -251,7 +245,6 @@ typedef struct { node_cmp_attr_func node_cmp_attr; /**< Compares two node attributes. */ reassociate_func reassociate; /**< Reassociate a tree. */ copy_attr_func copy_attr; /**< Copy node attributes. */ - get_type_func get_type; /**< Return the type of a node. */ get_type_attr_func get_type_attr; /**< Return the type attribute of a node. */ get_entity_attr_func get_entity_attr; /**< Return the entity attribute of a node. */ verify_node_func verify_node; /**< Verify the node. */ diff --git a/include/libfirm/irsimpletype.h b/include/libfirm/irsimpletype.h deleted file mode 100644 index 1627b2228..000000000 --- a/include/libfirm/irsimpletype.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. - * - * This file is part of libFirm. - * - * This file may be distributed and/or modified under the terms of the - * GNU General Public License version 2 as published by the Free Software - * Foundation and appearing in the file LICENSE.GPL included in the - * packaging of this file. - * - * Licensees holding valid libFirm Professional Edition licenses may use - * this file in accordance with the libFirm Commercial License. - * Agreement provided with the Software. - * - * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE. - */ - -/** - * @file - * @brief Run most simple type analyses. - * @author Goetz Lindenmaier - * @date 22.8.2003 - * @version $Id$ - * @brief - * We compute type information for each node. It is derived from the - * types of the origines of values, e.g. parameter types can be derived - * from the method type. - * The type information so far is saved in the link field. - */ -#ifndef FIRM_ANA_IRSIMPLETYPE_H -#define FIRM_ANA_IRSIMPLETYPE_H - -#include "irgraph.h" -#include "irnode.h" -#include "typerep.h" -#include "begin.h" - -/* ------------ Building and Removing the type information ----------- */ - -/** Computes type information for each node in all ir graphs. - * - * Computes type information for each node. Stores the information in the - * field defined in irtypeinfo.h. Sets typestate in irg to irg_typeinfo_consistent. - * - * Derives the information from nodes/patterns that give hints about the - * type, as projecting an argument from the Start node. Deletes all previous - * type information. - * - * If a non-pointer type is specified for a pointer value (as the Alloc node does: - * it contains the type allocated, but to type the result we need the type that - * describes a pointer to the allocated type) searches for a corresponding pointer - * type. If several exist, uses one of them. If none exists, uses unknown_type. - * - * Uses the link field of types. Sets this field of each type to point to a - * pointer type that points to the type (Got it? ;-)). - */ -FIRM_API void simple_analyse_types(void); - -/** Frees all type information datastructures. Sets the flag in irg to "???". */ -FIRM_API void free_simple_type_information(void); - -#include "end.h" - -#endif diff --git a/ir/ana/irconsconfirm.c b/ir/ana/irconsconfirm.c index b7f9ea6cd..2ff2b9ea1 100644 --- a/ir/ana/irconsconfirm.c +++ b/ir/ana/irconsconfirm.c @@ -111,9 +111,8 @@ static void handle_case(ir_node *block, ir_node *irn, long nr, env_t *env) if (! c) { ir_mode *mode = get_irn_mode(irn); - ir_type *tp = get_irn_type(irn); - tarval *tv = new_tarval_from_long(nr, mode); - c = new_r_Const_type(current_ir_graph, tv, tp); + tarval *tv = new_tarval_from_long(nr, mode); + c = new_r_Const(current_ir_graph, tv); } set_irn_n(succ, pos, c); diff --git a/ir/ana/irsimpletype.c b/ir/ana/irsimpletype.c deleted file mode 100644 index 54ffe4855..000000000 --- a/ir/ana/irsimpletype.c +++ /dev/null @@ -1,462 +0,0 @@ -/* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. - * - * This file is part of libFirm. - * - * This file may be distributed and/or modified under the terms of the - * GNU General Public License version 2 as published by the Free Software - * Foundation and appearing in the file LICENSE.GPL included in the - * packaging of this file. - * - * Licensees holding valid libFirm Professional Edition licenses may use - * this file in accordance with the libFirm Commercial License. - * Agreement provided with the Software. - * - * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE. - */ - -/** - * @file - * @brief Run most simple type analyses. - * @author Goetz Lindenmaier - * @date 22.8.2003 - * @version $Id$ - * @brief - * Runs most simple type analyses. - * - * We compute type information for each node. It is derived from the - * types of the origines of values, e.g. parameter types can be derived - * from the method type. - * The type information so far is saved in the link field. - */ -#include "config.h" - -#include "irtypeinfo.h" -#include "irsimpletype.h" - -#include "irnode_t.h" -#include "irprog_t.h" -#include "irgwalk.h" -#include "ident.h" -#include "trouts.h" -#include "debug.h" -#include "error.h" - -DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL); - -static ir_type *phi_cycle_type = NULL; - - -/* ------------ Building and Removing the type information ----------- */ - - -/** - * init type link field so that types point to their pointers. - */ -static void precompute_pointer_types(void) -{ -#if 0 - int i; - set_type_link(firm_unknown_type, firm_unknown_type); - set_type_link(firm_none_type, firm_unknown_type); - - for (i = get_irp_n_types() - 1; i >= 0; --i) - set_type_link(get_irp_type(i), (void *)firm_unknown_type); - - for (i = get_irp_n_types() - 1; i >= 0; --i) { - ir_type *tp = get_irp_type(i); - if (is_Pointer_type(tp)) - set_type_link(get_pointer_points_to_type(tp), (void *)tp); - } -#else - compute_trouts(); -#endif -} - -/** - * Returns a pointer to type which was stored in the link field - * to speed up search. - */ -static ir_type *find_pointer_type_to (ir_type *tp) -{ -#if 0 - return (ir_type *)get_type_link(tp); -#else - if (get_type_n_pointertypes_to(tp) > 0) - return get_type_pointertype_to(tp, 0); - else - return firm_unknown_type; -#endif -} - -static ir_type *compute_irn_type(ir_node *n); - -/** - * Try to determine a type for a Proj node. - * If a type cannot be determined, return @p firm_none_type. - */ -static ir_type *find_type_for_Proj(ir_node *n) -{ - ir_type *tp; - - /* Avoid nested Tuples. */ - ir_node *pred = skip_Tuple(get_Proj_pred(n)); - ir_mode *m = get_irn_mode(n); - - if (m == mode_T || - m == mode_BB || - m == mode_X || - m == mode_M || - m == mode_b ) - return firm_none_type; - - switch (get_irn_opcode(pred)) { - case iro_Proj: { - ir_node *pred_pred; - /* Deal with Start / Call here: we need to know the Proj Nr. */ - assert(get_irn_mode(pred) == mode_T); - pred_pred = get_Proj_pred(pred); - if (is_Start(pred_pred)) { - ir_type *mtp = get_entity_type(get_irg_entity(get_irn_irg(pred_pred))); - tp = get_method_param_type(mtp, get_Proj_proj(n)); - } else if (is_Call(pred_pred)) { - ir_type *mtp = get_Call_type(pred_pred); - tp = get_method_res_type(mtp, get_Proj_proj(n)); - } else if (is_Tuple(pred_pred)) { - panic("Encountered nested Tuple"); - } else { - DB((dbg, SET_LEVEL_1, "Proj %ld from Proj from ??: unknown type\n", get_irn_node_nr(n))); - tp = firm_unknown_type; - } - break; - } - case iro_Start: - /* frame pointer, globals and tls */ - switch (get_Proj_proj(n)) { - case pn_Start_P_frame_base: - tp = find_pointer_type_to(get_irg_frame_type(get_irn_irg(pred))); - break; - case pn_Start_P_tls: - tp = find_pointer_type_to(get_tls_type()); - break; - default: - DB((dbg, SET_LEVEL_1, "Proj %ld %ld from Start: unknown type\n", get_Proj_proj(n), get_irn_node_nr(n))); - tp = firm_unknown_type; - } - break; - case iro_Call: - /* value args pointer */ - if (get_Proj_proj(n) == pn_Call_P_value_res_base) { - DB((dbg, SET_LEVEL_1, "Value res base Proj %ld from Call: unknown type\n", get_irn_node_nr(n))); - tp = firm_unknown_type; /* find_pointer_type_to(get....get_Call_type(pred)); */ - } else { - DB((dbg, SET_LEVEL_1, "Proj %ld %ld from Call: unknown type\n", get_Proj_proj(n), get_irn_node_nr(n))); - tp = firm_unknown_type; - } - break; - case iro_Tuple: - tp = compute_irn_type(get_Tuple_pred(pred, get_Proj_proj(n))); - break; - default: - tp = compute_irn_type(pred); - } - - return tp; -} - -/** - * Try to determine the type of a node. - * If a type cannot be determined, return @p firm_none_type. - */ -static ir_type *find_type_for_node(ir_node *n) -{ - ir_type *tp = firm_unknown_type; - ir_type *tp1 = NULL, *tp2 = NULL; - ir_node *a = NULL, *b = NULL; - - if (is_unop(n)) { - a = get_unop_op(n); - tp1 = compute_irn_type(a); - } - if (is_binop(n)) { - a = get_binop_left(n); - b = get_binop_right(n); - tp1 = compute_irn_type(a); - tp2 = compute_irn_type(b); - } - - switch (get_irn_opcode(n)) { - - case iro_InstOf: - assert(0 && "op_InstOf not supported"); - break; - - /* has no type */ - case iro_Return: { - /* Check returned type. */ - /* - int i; - ir_type *meth_type = get_entity_type(get_irg_entity(current_ir_graph)); - for (i = 0; i < get_method_n_ress(meth_type); i++) { - ir_type *res_type = get_method_res_type(meth_type, i); - ir_type *ana_res_type = get_irn_type(get_Return_res(n, i)); - if (ana_res_type == firm_unknown_type) continue; - if (res_type != ana_res_type && "return value has wrong type") { - assert(res_type == ana_res_type && "return value has wrong type"); - } - } - */ - } - case iro_Block: - case iro_Start: - case iro_End: - case iro_Jmp: - case iro_Cond: - case iro_Raise: - case iro_Call: - case iro_Cmp: - case iro_Store: - case iro_Free: - case iro_Sync: - case iro_Tuple: - case iro_Bad: - case iro_NoMem: - break; - - /* compute the type */ - case iro_Const: - tp = get_Const_type(n); - break; - case iro_SymConst: - tp = get_SymConst_value_type(n); - break; - case iro_Sel: - tp = find_pointer_type_to(get_entity_type(get_Sel_entity(n))); - break; - - /* asymmetric binops */ - case iro_Shl: - case iro_Shr: - case iro_Shrs: - case iro_Rotl: - tp = tp1; - break; - case iro_Cast: - tp = get_Cast_type(n); - break; - case iro_Phi: { - int i; - int n_preds = get_Phi_n_preds(n); - - if (n_preds == 0) - break; - - /* initialize this Phi */ - set_irn_typeinfo_type(n, phi_cycle_type); - - /* find a first real type */ - for (i = 0; i < n_preds; ++i) { - tp1 = compute_irn_type(get_Phi_pred(n, i)); - assert(tp1 != initial_type); - if ((tp1 != phi_cycle_type) && (tp1 != firm_none_type)) - break; - } - - /* find a second real type */ - tp2 = tp1; - for (; (i < n_preds); ++i) { - tp2 = compute_irn_type(get_Phi_pred(n, i)); - if ((tp2 == phi_cycle_type) || (tp2 == firm_none_type)) { - tp2 = tp1; - continue; - } - if (tp2 != tp1) break; - } - - /* printf("Types in Phi %s and %s \n", get_type_name(tp1), get_type_name(tp2)); */ - - if (tp1 == tp2) { tp = tp1; break; } - - DB((dbg, SET_LEVEL_2, "Phi %ld with two different types: %+F, %+F: unknown type.\n", get_irn_node_nr(n), tp1, tp2)); - tp = firm_unknown_type; /* Test for supertypes? */ - break; - } - - case iro_Load: { - ir_node *a = get_Load_ptr(n); - if (is_Sel(a)) - tp = get_entity_type(get_Sel_entity(a)); - else if (is_Pointer_type(compute_irn_type(a))) { - tp = get_pointer_points_to_type(get_irn_typeinfo_type(a)); - if (is_Array_type(tp)) - tp = get_array_element_type(tp); - } else { - DB((dbg, SET_LEVEL_1, "Load %ld with typeless address. result: unknown type\n", get_irn_node_nr(n))); - } - break; - } - case iro_Alloc: - tp = find_pointer_type_to(get_Alloc_type(n)); - break; - case iro_Proj: - tp = find_type_for_Proj(n); - break; - case iro_Id: - tp = compute_irn_type(get_Id_pred(n)); - break; - case iro_Unknown: - tp = firm_unknown_type; - break; - - /* catch special cases with fallthrough to binop/unop cases in default. */ - case iro_Sub: - if (mode_is_int(get_irn_mode(n)) && - mode_is_reference(get_irn_mode(a)) && - mode_is_reference(get_irn_mode(b)) ) { - DB((dbg, SET_LEVEL_1, "Sub %ld ptr - ptr = int: unknown type\n", get_irn_node_nr(n))); - tp = firm_unknown_type; break; - } - /* fall through to Add. */ - case iro_Add: - if (mode_is_reference(get_irn_mode(n)) && - mode_is_reference(get_irn_mode(a)) && - mode_is_int(get_irn_mode(b)) ) { - tp = tp1; break; - } - if (mode_is_reference(get_irn_mode(n)) && - mode_is_int(get_irn_mode(a)) && - mode_is_reference(get_irn_mode(b)) ) { - tp = tp2; break; - } - goto default_code; - - case iro_Mul: - if (get_irn_mode(n) != get_irn_mode(a)) { - DB((dbg, SET_LEVEL_1, "Mul %ld int1 * int1 = int2: unknown type\n", get_irn_node_nr(n))); - tp = firm_unknown_type; break; - } - goto default_code; - - case iro_Mux: - a = get_Mux_true(n); - b = get_Mux_false(n); - tp1 = compute_irn_type(a); - tp2 = compute_irn_type(b); - if (tp1 == tp2) - tp = tp1; - break; - - case iro_Bound: - tp = compute_irn_type(get_Bound_index(n)); - break; - case iro_Confirm: - tp = compute_irn_type(get_Confirm_value(n)); - break; - case iro_Conv: - /* Conv is a unop, but changing the mode implies - changing the type. */ - break; - - default: -default_code: - if (is_unop(n)) { - /* It's not proper to walk past a Conv, so this case is handled above. */ - tp = tp1; - break; - } - - if (is_binop(n)) { - if (tp1 == tp2) { - tp = tp1; - break; - } - if ((tp1 == phi_cycle_type) || (tp2 == phi_cycle_type)) { - tp = phi_cycle_type; - break; - } - DB((dbg, SET_LEVEL_2, "Binop %ld with two different types: %+F, %+F: unknown type\n", get_irn_node_nr(n), tp1, tp2)); - tp = firm_unknown_type; - break; - } - - panic(" not implemented: %+F", n); - } /* end switch */ - - return tp; -} - -/** Compute the type of an IR node. */ -static ir_type *compute_irn_type(ir_node *n) -{ - ir_type *tp = get_irn_typeinfo_type(n); - - if (tp == initial_type) { - tp = find_type_for_node(n); - set_irn_typeinfo_type(n, tp); - } - return tp; -} - -/** - * Post-Walker: computes the type for every node - * and store it into a map. - * Post-walking ensures that the types for all predecessor - * nodes are already computed. - */ -static void compute_type(ir_node *n, void *env) -{ - ir_type *tp = get_irn_typeinfo_type(n); - (void) env; - if (tp == phi_cycle_type) { - set_irn_typeinfo_type(n, initial_type); - } - compute_irn_type(n); -} - -/** - * Compute the types for all nodes of a graph. - */ -static void analyse_irg (ir_graph *irg) -{ - set_irg_typeinfo_state(irg, ir_typeinfo_consistent); - irg_walk_graph(irg, NULL, compute_type, NULL); -} - -/** - * Initialize the analysis by creating a phi_cycle_type and - * computing pointer types for all class and struct types. - */ -static void init_irsimpletype(void) -{ - init_irtypeinfo(); - if (!phi_cycle_type) - phi_cycle_type = new_type_class(new_id_from_str("phi_cycle_type")); - precompute_pointer_types(); -} - -/* Computes type information for each node in all ir graphs. */ -void simple_analyse_types(void) -{ - int i; - FIRM_DBG_REGISTER(dbg, "firm.ana.simpletype"); - - init_irsimpletype(); - for (i = get_irp_n_irgs() - 1; i >= 0; --i) { - ir_graph *irg = get_irp_irg(i); - analyse_irg(irg); - } - set_irp_typeinfo_state(ir_typeinfo_consistent); -} - -void free_simple_type_information(void) -{ - free_irtypeinfo(); - - if (phi_cycle_type) { - free_type(phi_cycle_type); - phi_cycle_type = NULL; - } - set_irp_typeinfo_state(ir_typeinfo_none); -} diff --git a/ir/be/beabi.c b/ir/be/beabi.c index a7bcf4ed3..a12c7f765 100644 --- a/ir/be/beabi.c +++ b/ir/be/beabi.c @@ -2140,7 +2140,7 @@ static void fix_pic_symconsts(ir_node *node, void *data) dbgi = get_irn_dbg_info(pred); trampoline = get_trampoline(be, entity); trampoline_const = new_rd_SymConst_addr_ent(dbgi, irg, mode_P_code, - trampoline, NULL); + trampoline); set_irn_n(node, i, trampoline_const); continue; } @@ -2163,7 +2163,7 @@ static void fix_pic_symconsts(ir_node *node, void *data) dbgi = get_irn_dbg_info(pred); pic_symbol = get_pic_symbol(be, entity); pic_symconst = new_rd_SymConst_addr_ent(dbgi, irg, mode_P_code, - pic_symbol, NULL); + pic_symbol); add = new_r_Add(block, pic_base, pic_symconst, mode); mark_irn_visited(add); diff --git a/ir/be/benode.c b/ir/be/benode.c index df4acac97..87c0b8473 100644 --- a/ir/be/benode.c +++ b/ir/be/benode.c @@ -1302,7 +1302,6 @@ static const ir_op_ops be_node_op_ops = { NULL, NULL, NULL, - NULL, dump_node, NULL, &be_node_irn_ops diff --git a/ir/ir/ircons.c b/ir/ir/ircons.c index 18971fd8c..ee9839b09 100644 --- a/ir/ir/ircons.c +++ b/ir/ir/ircons.c @@ -92,26 +92,19 @@ ir_node *new_rd_Phi(dbg_info *db, ir_node *block, int arity, ir_node **in, return res; } -ir_node *new_rd_Const_type(dbg_info *db, ir_graph *irg, tarval *con, - ir_type *tp) +ir_node *new_rd_Const(dbg_info *db, ir_graph *irg, tarval *con) { ir_node *block = get_irg_start_block(irg); ir_mode *mode = get_tarval_mode(con); ir_node *res = new_ir_node(db, irg, block, op_Const, mode, 0, NULL); res->attr.con.tarval = con; - set_Const_type(res, tp); /* Call method because of complex assertion. */ + res = optimize_node (res); - assert(get_Const_type(res) == tp); irn_verify_irg(res, irg); return res; } -ir_node *new_rd_Const(dbg_info *db, ir_graph *irg, tarval *con) -{ - return new_rd_Const_type(db, irg, con, firm_unknown_type); -} - ir_node *new_rd_Const_long(dbg_info *db, ir_graph *irg, ir_mode *mode, long value) { @@ -128,22 +121,6 @@ ir_node *new_rd_defaultProj(dbg_info *db, ir_node *arg, long max_proj) return res; } -ir_node *new_rd_SymConst_type(dbg_info *db, ir_graph *irg, ir_mode *mode, - symconst_symbol value, symconst_kind symkind, - ir_type *tp) -{ - ir_node *block = get_irg_start_block(irg); - ir_node *res = new_ir_node(db, irg, block, op_SymConst, mode, 0, NULL); - - res->attr.symc.kind = symkind; - res->attr.symc.sym = value; - res->attr.symc.tp = tp; - - res = optimize_node(res); - irn_verify_irg(res, irg); - return res; -} - ir_node *new_rd_Sync(dbg_info *db, ir_node *block, int arity, ir_node *in[]) { ir_graph *irg = get_irn_irg(block); @@ -192,42 +169,49 @@ ir_node *new_rd_simpleSel(dbg_info *db, ir_node *block, ir_node *store, ir_node *new_rd_SymConst(dbg_info *db, ir_graph *irg, ir_mode *mode, symconst_symbol value, symconst_kind symkind) { - return new_rd_SymConst_type(db, irg, mode, value, symkind, firm_unknown_type); + ir_node *block = get_irg_start_block(irg); + ir_node *res = new_ir_node(db, irg, block, op_SymConst, mode, 0, NULL); + res->attr.symc.kind = symkind; + res->attr.symc.sym = value; + + res = optimize_node(res); + irn_verify_irg(res, irg); + return res; } -ir_node *new_rd_SymConst_addr_ent(dbg_info *db, ir_graph *irg, ir_mode *mode, ir_entity *symbol, ir_type *tp) +ir_node *new_rd_SymConst_addr_ent(dbg_info *db, ir_graph *irg, ir_mode *mode, ir_entity *symbol) { symconst_symbol sym; sym.entity_p = symbol; - return new_rd_SymConst_type(db, irg, mode, sym, symconst_addr_ent, tp); + return new_rd_SymConst(db, irg, mode, sym, symconst_addr_ent); } -ir_node *new_rd_SymConst_ofs_ent(dbg_info *db, ir_graph *irg, ir_mode *mode, ir_entity *symbol, ir_type *tp) +ir_node *new_rd_SymConst_ofs_ent(dbg_info *db, ir_graph *irg, ir_mode *mode, ir_entity *symbol) { symconst_symbol sym; sym.entity_p = symbol; - return new_rd_SymConst_type(db, irg, mode, sym, symconst_ofs_ent, tp); + return new_rd_SymConst(db, irg, mode, sym, symconst_ofs_ent); } -ir_node *new_rd_SymConst_type_tag(dbg_info *db, ir_graph *irg, ir_mode *mode, ir_type *symbol, ir_type *tp) +ir_node *new_rd_SymConst_type_tag(dbg_info *db, ir_graph *irg, ir_mode *mode, ir_type *symbol) { symconst_symbol sym; sym.type_p = symbol; - return new_rd_SymConst_type(db, irg, mode, sym, symconst_type_tag, tp); + return new_rd_SymConst(db, irg, mode, sym, symconst_type_tag); } -ir_node *new_rd_SymConst_size(dbg_info *db, ir_graph *irg, ir_mode *mode, ir_type *symbol, ir_type *tp) +ir_node *new_rd_SymConst_size(dbg_info *db, ir_graph *irg, ir_mode *mode, ir_type *symbol) { symconst_symbol sym; sym.type_p = symbol; - return new_rd_SymConst_type(db, irg, mode, sym, symconst_type_size, tp); + return new_rd_SymConst(db, irg, mode, sym, symconst_type_size); } -ir_node *new_rd_SymConst_align(dbg_info *db, ir_graph *irg, ir_mode *mode, ir_type *symbol, ir_type *tp) +ir_node *new_rd_SymConst_align(dbg_info *db, ir_graph *irg, ir_mode *mode, ir_type *symbol) { symconst_symbol sym; sym.type_p = symbol; - return new_rd_SymConst_type(db, irg, mode, sym, symconst_type_align, tp); + return new_rd_SymConst(db, irg, mode, sym, symconst_type_align); } ir_node *new_r_Start(ir_graph *irg) @@ -246,10 +230,6 @@ ir_node *new_r_Const_long(ir_graph *irg, ir_mode *mode, long value) { return new_rd_Const_long(NULL, irg, mode, value); } -ir_node *new_r_Const_type(ir_graph *irg, tarval *con, ir_type *tp) -{ - return new_rd_Const_type(NULL, irg, con, tp); -} ir_node *new_r_SymConst(ir_graph *irg, ir_mode *mode, symconst_symbol value, symconst_kind symkind) { @@ -686,12 +666,6 @@ ir_node *new_d_Const_long(dbg_info *db, ir_mode *mode, long value) return new_rd_Const_long(db, current_ir_graph, mode, value); } -ir_node *new_d_Const_type(dbg_info *db, tarval *con, ir_type *tp) -{ - assert(get_irg_phase_state(current_ir_graph) == phase_building); - return new_rd_Const_type(db, current_ir_graph, con, tp); -} - ir_node *new_d_defaultProj(dbg_info *db, ir_node *arg, long max_proj) { ir_node *res; @@ -710,19 +684,11 @@ ir_node *new_d_simpleSel(dbg_info *db, ir_node *store, ir_node *objptr, store, objptr, 0, NULL, ent); } -ir_node *new_d_SymConst_type(dbg_info *db, ir_mode *mode, symconst_symbol value, - symconst_kind kind, ir_type *tp) -{ - assert(get_irg_phase_state(current_ir_graph) == phase_building); - return new_rd_SymConst_type(db, current_ir_graph, mode, value, kind, tp); -} - ir_node *new_d_SymConst(dbg_info *db, ir_mode *mode, symconst_symbol value, symconst_kind kind) { assert(get_irg_phase_state(current_ir_graph) == phase_building); - return new_rd_SymConst_type(db, current_ir_graph, mode, value, kind, - firm_unknown_type); + return new_rd_SymConst(db, current_ir_graph, mode, value, kind); } ir_node *new_d_Sync(dbg_info *db, int arity, ir_node *in[]) @@ -1008,15 +974,6 @@ ir_node *new_Const_long(ir_mode *mode, long value) return new_d_Const_long(NULL, mode, value); } -ir_node *new_Const_type(tarval *con, ir_type *tp) -{ - return new_d_Const_type(NULL, con, tp); -} - -ir_node *new_SymConst_type(ir_mode *mode, symconst_symbol value, symconst_kind kind, ir_type *type) -{ - return new_d_SymConst_type(NULL, mode, value, kind, type); -} ir_node *new_SymConst(ir_mode *mode, symconst_symbol value, symconst_kind kind) { return new_d_SymConst(NULL, mode, value, kind); diff --git a/ir/ir/irdumptxt.c b/ir/ir/irdumptxt.c index f9f4c76d6..829597b0b 100644 --- a/ir/ir/irdumptxt.c +++ b/ir/ir/irdumptxt.c @@ -208,10 +208,6 @@ void dump_irnode_to_file(FILE *F, ir_node *n) get_method_res_type(tp, i)); } } break; - case iro_Const: { - assert(get_Const_type(n) != firm_none_type); - ir_fprintf(F, " Const of type %+F\n", get_Const_type(n)); - } break; case iro_SymConst: { switch (get_SymConst_kind(n)) { case symconst_addr_ent: @@ -244,7 +240,6 @@ void dump_irnode_to_file(FILE *F, ir_node *n) fprintf(F, " name: %s\n", get_enumeration_const_name(get_SymConst_enum(n))); break; } - ir_fprintf(F, " type of value: %+F\n", get_SymConst_value_type(n)); } break; case iro_Load: fprintf(F, " mode of loaded value: %s\n", get_mode_name_ex(get_Load_mode(n), NULL)); diff --git a/ir/ir/irnode.c b/ir/ir/irnode.c index 3269e204d..3cb9e7639 100644 --- a/ir/ir/irnode.c +++ b/ir/ir/irnode.c @@ -890,25 +890,6 @@ int (is_Const_all_one)(const ir_node *node) } -/* The source language type. Must be an atomic type. Mode of type must - be mode of node. For tarvals from entities type must be pointer to - entity type. */ -ir_type *get_Const_type(const ir_node *node) -{ - assert(is_Const(node)); - return node->attr.con.tp; -} - -void set_Const_type(ir_node *node, ir_type *tp) -{ - assert(is_Const(node)); - if (tp != firm_unknown_type) { - assert(is_atomic_type(tp)); - assert(get_type_mode(tp) == get_irn_mode(node)); - } - node->attr.con.tp = tp; -} - symconst_kind get_SymConst_kind(const ir_node *node) { @@ -978,18 +959,6 @@ void set_SymConst_symbol(ir_node *node, union symconst_symbol sym) node->attr.symc.sym = sym; } -ir_type *get_SymConst_value_type(const ir_node *node) -{ - assert(is_SymConst(node)); - return node->attr.symc.tp; -} - -void set_SymConst_value_type(ir_node *node, ir_type *tp) -{ - assert(is_SymConst(node)); - node->attr.symc.tp = tp; -} - int get_Sel_n_indexs(const ir_node *node) { assert(is_Sel(node)); @@ -1716,14 +1685,6 @@ void (copy_node_attr)(ir_graph *irg, const ir_node *old_node, ir_node *new_node) _copy_node_attr(irg, old_node, new_node); } -/* Return the type associated with the value produced by n - * if the node remarks this type as it is the case for - * Cast, Const, SymConst and some Proj nodes. */ -ir_type *(get_irn_type)(ir_node *node) -{ - return _get_irn_type(node); -} - /* Return the type attribute of a node n (SymConst, Call, Alloc, Free, Cast) or NULL.*/ ir_type *(get_irn_type_attr)(ir_node *node) @@ -1797,30 +1758,6 @@ const char *get_cond_jmp_predicate_name(cond_jmp_predicate pred) #undef X } -/** the get_type operation must be always implemented and return a firm type */ -static ir_type *get_Default_type(const ir_node *n) -{ - (void) n; - return get_unknown_type(); -} - -/* Sets the get_type operation for an ir_op_ops. */ -ir_op_ops *firm_set_default_get_type(ir_opcode code, ir_op_ops *ops) -{ - switch (code) { - case iro_Const: ops->get_type = get_Const_type; break; - case iro_SymConst: ops->get_type = get_SymConst_value_type; break; - case iro_Cast: ops->get_type = get_Cast_type; break; - case iro_Proj: ops->get_type = get_Proj_type; break; - default: - /* not allowed to be NULL */ - if (! ops->get_type) - ops->get_type = get_Default_type; - break; - } - return ops; -} - /** Return the attribute type of a SymConst node if exists */ static ir_type *get_SymConst_attr_type(const ir_node *self) { diff --git a/ir/ir/irnode_t.h b/ir/ir/irnode_t.h index aad7621f3..08c884e2f 100644 --- a/ir/ir/irnode_t.h +++ b/ir/ir/irnode_t.h @@ -47,17 +47,6 @@ ir_node **get_irn_in (const ir_node *node); */ extern unsigned firm_add_node_size; -/** - * Sets the get_type operation for an ir_op_ops. - * - * @param code the opcode for the default operation - * @param ops the operations initialized - * - * @return - * The operations. - */ -ir_op_ops *firm_set_default_get_type(ir_opcode code, ir_op_ops *ops); - /** * Sets the get_type_attr operation for an ir_op_ops. * @@ -478,10 +467,6 @@ static inline int _is_irn_forking(const ir_node *node) { return is_op_forking(_get_irn_op(node)); } -static inline ir_type *_get_irn_type(ir_node *node) { - return _get_irn_op(node)->ops.get_type(node); -} - static inline ir_type *_get_irn_type_attr(ir_node *node) { return _get_irn_op(node)->ops.get_type_attr(node); } diff --git a/ir/ir/iropt.c b/ir/ir/iropt.c index 75b98dce0..3dded3adc 100644 --- a/ir/ir/iropt.c +++ b/ir/ir/iropt.c @@ -1372,22 +1372,6 @@ restart: return n; } /* equivalent_node_Conv */ -/** - * A Cast may be removed if the type of the previous node - * is already the type of the Cast. - */ -static ir_node *equivalent_node_Cast(ir_node *n) -{ - ir_node *oldn = n; - ir_node *pred = get_Cast_op(n); - - if (get_irn_type(pred) == get_Cast_type(n)) { - n = pred; - DBG_OPT_ALGSIM0(oldn, n, FS_OPT_CAST); - } - return n; -} /* equivalent_node_Cast */ - /** * - fold Phi-nodes, iff they have only one predecessor except * themselves. @@ -1965,7 +1949,6 @@ static ir_op_ops *firm_set_default_equivalent_node(ir_opcode code, ir_op_ops *op CASE(Or); CASE(And); CASE(Conv); - CASE(Cast); CASE(Phi); CASE(Sync); CASE_PROJ(Tuple); @@ -2080,7 +2063,7 @@ static ir_node *apply_binop_on_phi(ir_node *phi, tarval *other, eval_func eval, irg = get_irn_irg(phi); for (i = 0; i < n; ++i) { pred = get_irn_n(phi, i); - res[i] = new_r_Const_type(irg, res[i], get_Const_type(pred)); + res[i] = new_r_Const(irg, res[i]); } return new_r_Phi(get_nodes_block(phi), n, (ir_node **)res, mode); } /* apply_binop_on_phi */ @@ -2125,7 +2108,7 @@ static ir_node *apply_binop_on_2_phis(ir_node *a, ir_node *b, eval_func eval, ir irg = get_irn_irg(a); for (i = 0; i < n; ++i) { pred = get_irn_n(a, i); - res[i] = new_r_Const_type(irg, res[i], get_Const_type(pred)); + res[i] = new_r_Const(irg, res[i]); } return new_r_Phi(get_nodes_block(a), n, (ir_node **)res, mode); } /* apply_binop_on_2_phis */ @@ -2163,7 +2146,7 @@ static ir_node *apply_unop_on_phi(ir_node *phi, tarval *(*eval)(tarval *)) irg = get_irn_irg(phi); for (i = 0; i < n; ++i) { pred = get_irn_n(phi, i); - res[i] = new_r_Const_type(irg, res[i], get_Const_type(pred)); + res[i] = new_r_Const(irg, res[i]); } return new_r_Phi(get_nodes_block(phi), n, (ir_node **)res, mode); } /* apply_unop_on_phi */ @@ -2198,7 +2181,7 @@ static ir_node *apply_conv_on_phi(ir_node *phi, ir_mode *mode) irg = get_irn_irg(phi); for (i = 0; i < n; ++i) { pred = get_irn_n(phi, i); - res[i] = new_r_Const_type(irg, res[i], get_Const_type(pred)); + res[i] = new_r_Const(irg, res[i]); } return new_r_Phi(get_nodes_block(phi), n, (ir_node **)res, mode); } /* apply_conv_on_phi */ @@ -3822,29 +3805,6 @@ static ir_node *transform_node_Minus(ir_node *n) return n; } /* transform_node_Minus */ -/** - * Transform a Cast_type(Const) into a new Const_type - */ -static ir_node *transform_node_Cast(ir_node *n) -{ - ir_node *oldn = n; - ir_node *pred = get_Cast_op(n); - ir_type *tp = get_irn_type(n); - - if (is_Const(pred) && get_Const_type(pred) != tp) { - ir_graph *irg = get_irn_irg(n); - n = new_rd_Const_type(NULL, irg, get_Const_tarval(pred), tp); - DBG_OPT_CSTEVAL(oldn, n); - } else if (is_SymConst(pred) && get_SymConst_value_type(pred) != tp) { - ir_graph *irg = get_irn_irg(n); - n = new_rd_SymConst_type(NULL, irg, get_irn_mode(pred), - get_SymConst_symbol(pred), get_SymConst_kind(pred), tp); - DBG_OPT_CSTEVAL(oldn, n); - } - - return n; -} /* transform_node_Cast */ - /** * Transform a Proj(Load) with a non-null address. */ @@ -6149,7 +6109,6 @@ static ir_op_ops *firm_set_default_transform_node(ir_opcode code, ir_op_ops *ops CASE(Eor); CASE(Not); CASE(Minus); - CASE(Cast); CASE_PROJ(Load); CASE_PROJ(Store); CASE_PROJ(Bound); @@ -6187,9 +6146,8 @@ static ir_op_ops *firm_set_default_transform_node(ir_opcode code, ir_op_ops *ops /** Compares the attributes of two Const nodes. */ static int node_cmp_attr_Const(ir_node *a, ir_node *b) { - return (get_Const_tarval(a) != get_Const_tarval(b)) - || (get_Const_type(a) != get_Const_type(b)); -} /* node_cmp_attr_Const */ + return get_Const_tarval(a) != get_Const_tarval(b); +} /** Compares the attributes of two Proj nodes. */ static int node_cmp_attr_Proj(ir_node *a, ir_node *b) @@ -6219,9 +6177,8 @@ static int node_cmp_attr_SymConst(ir_node *a, ir_node *b) const symconst_attr *pa = &a->attr.symc; const symconst_attr *pb = &b->attr.symc; return (pa->kind != pb->kind) - || (pa->sym.type_p != pb->sym.type_p) - || (pa->tp != pb->tp); -} /* node_cmp_attr_SymConst */ + || (pa->sym.type_p != pb->sym.type_p); +} /** Compares the attributes of two Call nodes. */ static int node_cmp_attr_Call(ir_node *a, ir_node *b) @@ -6741,16 +6698,8 @@ ir_node *optimize_node(ir_node *n) tv = computed_value(n); if (tv != tarval_bad) { ir_node *nw; - ir_type *old_tp = get_irn_type(n); - int i, arity = get_irn_arity(n); int node_size; - /* - * Try to recover the type of the new expression. - */ - for (i = 0; i < arity && !old_tp; ++i) - old_tp = get_irn_type(get_irn_n(n, i)); - /* * we MUST copy the node here temporary, because it's still needed * for DBG_OPT_CSTEVAL @@ -6771,8 +6720,6 @@ ir_node *optimize_node(ir_node *n) irg_kill_node(irg, n); nw = new_r_Const(irg, tv); - if (old_tp && get_type_mode(old_tp) == get_tarval_mode(tv)) - set_Const_type(nw, old_tp); DBG_OPT_CSTEVAL(oldn, nw); return nw; } @@ -6853,21 +6800,10 @@ ir_node *optimize_in_place_2(ir_node *n) tv = computed_value(n); if (tv != tarval_bad) { /* evaluation was successful -- replace the node. */ - ir_type *old_tp = get_irn_type(n); ir_graph *irg = get_irn_irg(n); - int i, arity = get_irn_arity(n); - - /* - * Try to recover the type of the new expression. - */ - for (i = 0; i < arity && !old_tp; ++i) - old_tp = get_irn_type(get_irn_n(n, i)); n = new_r_Const(irg, tv); - if (old_tp && get_type_mode(old_tp) == get_tarval_mode(tv)) - set_Const_type(n, old_tp); - DBG_OPT_CSTEVAL(oldn, n); return n; } @@ -7009,7 +6945,6 @@ ir_op_ops *firm_set_default_operations(ir_opcode code, ir_op_ops *ops) ops = firm_set_default_equivalent_node(code, ops); ops = firm_set_default_transform_node(code, ops); ops = firm_set_default_node_cmp_attr(code, ops); - ops = firm_set_default_get_type(code, ops); ops = firm_set_default_get_type_attr(code, ops); ops = firm_set_default_get_entity_attr(code, ops); diff --git a/ir/ir/irprofile.c b/ir/ir/irprofile.c index c53cd6d31..a7846be65 100644 --- a/ir/ir/irprofile.c +++ b/ir/ir/irprofile.c @@ -180,7 +180,7 @@ static void add_constructor(ir_entity *method) ir_entity *ptr = new_entity(constructors, ide, ptr_type); ir_graph *irg = get_const_code_irg(); ir_node *val = new_rd_SymConst_addr_ent(NULL, irg, mode_P_code, - method, NULL); + method); set_entity_compiler_generated(ptr, 1); set_entity_linkage(ptr, IR_LINKAGE_CONSTANT); diff --git a/ir/ir/irtypes.h b/ir/ir/irtypes.h index cfe604ae6..6c9486062 100644 --- a/ir/ir/irtypes.h +++ b/ir/ir/irtypes.h @@ -173,14 +173,12 @@ typedef struct { /** Const attributes. */ typedef struct { tarval *tarval; /**< the target value */ - ir_type *tp; /**< the source type, for analyses. default: type_unknown. */ } const_attr; /** SymConst attributes. */ typedef struct { symconst_symbol sym; // old tori symconst_kind kind; - ir_type *tp; /**< the source type, for analyses. default: type_unknown. */ } symconst_attr; /** Sel attributes. */ diff --git a/ir/lower/lower_hl.c b/ir/lower/lower_hl.c index ddc668c66..c4f297990 100644 --- a/ir/lower/lower_hl.c +++ b/ir/lower/lower_hl.c @@ -230,7 +230,7 @@ static void lower_sel(ir_node *sel) } } else { /* global_type */ - newn = new_rd_SymConst_addr_ent(NULL, irg, mode, ent, firm_unknown_type); + newn = new_rd_SymConst_addr_ent(NULL, irg, mode, ent); } } /* run the hooks */ diff --git a/ir/lower/lower_intrinsics.c b/ir/lower/lower_intrinsics.c index 4e1b36970..d68d8fc90 100644 --- a/ir/lower/lower_intrinsics.c +++ b/ir/lower/lower_intrinsics.c @@ -675,7 +675,7 @@ static ir_node *eval_strlen(ir_graph *irg, ir_entity *ent, ir_type *res_tp) } if (len >= 0) { tarval *tv = new_tarval_from_long(len, get_type_mode(res_tp)); - return new_r_Const_type(irg, tv, res_tp); + return new_r_Const(irg, tv); } return NULL; } @@ -689,7 +689,7 @@ static ir_node *eval_strlen(ir_graph *irg, ir_entity *ent, ir_type *res_tp) ir_initializer_t *val = get_initializer_compound_value(initializer, i); if (initializer_val_is_null(val)) { tarval *tv = new_tarval_from_long(i, get_type_mode(res_tp)); - return new_r_Const_type(irg, tv, res_tp); + return new_r_Const(irg, tv); } } @@ -806,7 +806,7 @@ static ir_node *eval_strcmp(ir_graph *irg, ir_entity *left, ir_entity *right, if (i < n) { /* we found an end */ tarval *tv = new_tarval_from_long(res, get_type_mode(res_tp)); - return new_r_Const_type(irg, tv, res_tp); + return new_r_Const(irg, tv); } return NULL; } diff --git a/ir/opt/proc_cloning.c b/ir/opt/proc_cloning.c index cb5fda1ac..743030ef2 100644 --- a/ir/opt/proc_cloning.c +++ b/ir/opt/proc_cloning.c @@ -350,9 +350,7 @@ static void create_clone_proc_irg(ir_entity *ent, quadruple_t *q) arg = get_irg_arg(get_entity_irg(q->ent), q->pos); /* we will replace the argument in position "q->pos" by this constant. */ - const_arg = new_r_Const_type( - clone_irg, q->tv, - get_method_param_type(get_entity_type(q->ent), q->pos)); + const_arg = new_r_Const(clone_irg, q->tv); /* args copy in the cloned graph will be the const. */ set_irn_link(arg, const_arg); diff --git a/ir/opt/tropt.c b/ir/opt/tropt.c index 5595e4679..3716a70d2 100644 --- a/ir/opt/tropt.c +++ b/ir/opt/tropt.c @@ -32,7 +32,6 @@ #include "irprog.h" #include "irtypeinfo.h" #include "irgwalk.h" -#include "irsimpletype.h" #include "trouts.h" #include "ircons.h" #include "irgmod.h" @@ -219,8 +218,10 @@ void normalize_irp_class_casts(gen_pointer_type_to_func gppt_fct) int i; if (gppt_fct) gen_pointer_type_to = gppt_fct; +#if 0 if (get_irp_typeinfo_state() != ir_typeinfo_consistent) simple_analyse_types(); +#endif for (i = get_irp_n_irgs() - 1; i >= 0; --i) { pure_normalize_irg_class_casts(get_irp_irg(i)); @@ -448,7 +449,7 @@ static int remove_Cmp_Null_cast(ir_node *cmp) irg = get_irn_irg(cmp); set_irn_n(cmp, cast_pos, get_Cast_op(cast)); fromtype = get_irn_typeinfo_type(get_Cast_op(cast)); - new_null = new_r_Const_type(irg, get_Const_tarval(null), fromtype); + new_null = new_r_Const(irg, get_Const_tarval(null)); set_irn_typeinfo_type(new_null, fromtype); set_irn_n(cmp, null_pos, new_null); ++n_casts_removed; @@ -476,8 +477,10 @@ void optimize_class_casts(void) { int changed; +#if 0 if (get_irp_typeinfo_state() != ir_typeinfo_consistent) simple_analyse_types(); +#endif changed = 0; all_irg_walk(NULL, irn_optimize_class_cast, &changed); diff --git a/ir/tr/compound_path.c b/ir/tr/compound_path.c index 07b508ab9..d5585f9ca 100644 --- a/ir/tr/compound_path.c +++ b/ir/tr/compound_path.c @@ -297,7 +297,6 @@ void set_array_entity_values(ir_entity *ent, tarval **values, int num_vals) int i; ir_type *arrtp = get_entity_type(ent); ir_node *val; - ir_type *elttp = get_array_element_type(arrtp); ir_graph *irg = get_const_code_irg(); assert(is_Array_type(arrtp)); @@ -307,7 +306,7 @@ void set_array_entity_values(ir_entity *ent, tarval **values, int num_vals) assert(get_array_lower_bound (arrtp, 0) || get_array_upper_bound (arrtp, 0)); for (i = 0; i < num_vals; i++) { - val = new_r_Const_type(irg, values[i], elttp); + val = new_r_Const(irg, values[i]); add_compound_ent_value(ent, val, get_array_element_entity(arrtp)); set_compound_graph_path_array_index(get_compound_ent_value_path(ent, i), 0, i); } diff --git a/ir/tr/entity.c b/ir/tr/entity.c index 858a53639..72231c6ef 100644 --- a/ir/tr/entity.c +++ b/ir/tr/entity.c @@ -520,11 +520,10 @@ ir_node *copy_const_value(dbg_info *dbg, ir_node *n, ir_node *block) m = get_irn_mode(n); switch (get_irn_opcode(n)) { case iro_Const: - nn = new_rd_Const_type(dbg, irg, get_Const_tarval(n), get_Const_type(n)); + nn = new_rd_Const(dbg, irg, get_Const_tarval(n)); break; case iro_SymConst: - nn = new_rd_SymConst_type(dbg, irg, get_irn_mode(n), get_SymConst_symbol(n), get_SymConst_kind(n), - get_SymConst_value_type(n)); + nn = new_rd_SymConst(dbg, irg, get_irn_mode(n), get_SymConst_symbol(n), get_SymConst_kind(n)); break; case iro_Add: nn = new_rd_Add(dbg, block,