Commit 31025513 authored by Matthias Braun's avatar Matthias Braun
Browse files

remove new_d_type like functions

Types need not be in their final form after the new_entity so there is no
need to have _d variants like we have with all the graph nodes. You can easily
use set_entity_dbg_info() after construction.
parent 69654226
......@@ -1164,9 +1164,6 @@ FIRM_API long get_type_nr(const ir_type *tp);
/** Creates a new class type. */
FIRM_API ir_type *new_type_class(ident *name);
/** Creates a new class type with debug information. */
FIRM_API ir_type *new_d_type_class(ident *name, type_dbg_info *db);
/** Returns identifier of the class type */
FIRM_API ident *get_class_ident(const ir_type *clss);
......@@ -1309,8 +1306,6 @@ FIRM_API const tp_op *get_tpop_class(void);
/** Creates a new type struct */
FIRM_API ir_type *new_type_struct(ident *name);
/** Creates a new type struct with debug information. */
FIRM_API ir_type *new_d_type_struct(ident *name, type_dbg_info* db);
/** Returns struct identifier */
FIRM_API ident *get_struct_ident(const ir_type *strct);
......@@ -1362,10 +1357,6 @@ FIRM_API const tp_op *get_tpop_struct(void);
/** Creates a new type union. */
FIRM_API ir_type *new_type_union(ident *name);
/** Creates a new type union with debug information. */
FIRM_API ir_type *new_d_type_union(ident *name, type_dbg_info* db);
/** Returns union identifier */
FIRM_API ident *get_union_ident(const ir_type *uni);
......@@ -1438,18 +1429,6 @@ FIRM_API const tp_op *get_tpop_union(void);
*/
FIRM_API ir_type *new_type_method(size_t n_param, size_t n_res);
/** Create a new method type with debug information.
*
* @param n_param the number of parameters
* @param n_res the number of results
* @param db user defined debug information
*
* The arrays for the parameter and result types are not initialized by
* the constructor.
*/
FIRM_API ir_type *new_d_type_method(size_t n_param, size_t n_res,
type_dbg_info *db);
/** Returns the number of parameters of this method. */
FIRM_API size_t get_method_n_params(const ir_type *method);
......@@ -1609,18 +1588,6 @@ FIRM_API const tp_op *get_tpop_method(void);
*/
FIRM_API ir_type *new_type_array(size_t n_dims, ir_type *element_type);
/** Create a new type array with debug information.
*
* Sets n_dimension to dimension and all dimension entries to NULL.
* Initializes order to the order of the dimensions.
* The entity for array elements is built automatically.
* Sets dimension sizes after call to constructor with set_* routines.
* A legal array type must have at least one dimension set.
*/
FIRM_API ir_type *new_d_type_array(size_t n_dims, ir_type *element_type,
type_dbg_info* db);
/** Returns the number of array dimensions of this type. */
FIRM_API size_t get_array_n_dimensions(const ir_type *array);
......@@ -1729,10 +1696,6 @@ FIRM_API const tp_op *get_tpop_array(void);
/** Creates a new type pointer. */
FIRM_API ir_type *new_type_pointer(ir_type *points_to);
/** Creates a new type pointer with debug information. */
FIRM_API ir_type *new_d_type_pointer(ir_type *points_to, type_dbg_info* db);
/** Sets the type to which a pointer points to. */
FIRM_API void set_pointer_points_to_type(ir_type *pointer, ir_type *tp);
......@@ -1771,9 +1734,6 @@ FIRM_API const tp_op *get_tpop_pointer(void);
/** Creates a new primitive type. */
FIRM_API ir_type *new_type_primitive(ir_mode *mode);
/** Creates a new primitive type with debug information. */
FIRM_API ir_type *new_d_type_primitive(ir_mode *mode, type_dbg_info* db);
/** Returns true if a type is a primitive type. */
FIRM_API int is_Primitive_type(const ir_type *primitive);
......
......@@ -132,7 +132,7 @@ bool sparc_variadic_fixups(ir_graph *irg, calling_convention_t *cconv)
size_t n_ress = get_method_n_ress(mtp);
size_t new_n_params
= n_params + (SPARC_N_PARAM_REGS - cconv->n_param_regs);
ir_type *new_mtp = new_d_type_method(new_n_params, n_ress, dbgi);
ir_type *new_mtp = new_type_method(new_n_params, n_ress);
ir_mode *gp_reg_mode = sparc_reg_classes[CLASS_sparc_gp].mode;
ir_type *gp_reg_type = get_type_for_mode(gp_reg_mode);
ir_type *frame_type = get_irg_frame_type(irg);
......@@ -151,6 +151,7 @@ bool sparc_variadic_fixups(ir_graph *irg, calling_convention_t *cconv)
new_parameter_entity(frame_type, i, gp_reg_type);
}
set_type_dbg_info(new_mtp, dbgi);
set_method_variadicity(new_mtp, get_method_variadicity(mtp));
set_method_calling_convention(new_mtp, get_method_calling_convention(mtp));
set_method_additional_properties(new_mtp, get_method_additional_properties(mtp));
......
......@@ -6258,7 +6258,8 @@ static ir_node *transform_node_Call(ir_node *call)
n_res = get_method_n_ress(mtp);
n_param = get_method_n_params(mtp);
ctp = new_d_type_method(n_param + 1, n_res, tdb);
ctp = new_type_method(n_param + 1, n_res);
set_type_dbg_info(ctp, tdb);
for (i = 0; i < n_res; ++i)
set_method_res_type(ctp, i, get_method_res_type(mtp, i));
......
......@@ -167,7 +167,8 @@ static ir_type *lower_mtp(compound_call_lowering_flags flags, ir_type *mtp)
assert(nn_params <= n_params + n_ress);
/* create the new type */
lowered = new_d_type_method(nn_params, nn_ress, get_type_dbg_info(mtp));
lowered = new_type_method(nn_params, nn_ress);
set_type_dbg_info(lowered, get_type_dbg_info(mtp));
/* fill it */
for (i = 0; i < nn_params; ++i)
......
......@@ -1604,7 +1604,8 @@ static ir_type *lower_mtp(ir_type *mtp)
return mtp;
}
res = new_d_type_method(n_param, n_res, get_type_dbg_info(mtp));
res = new_type_method(n_param, n_res);
set_type_dbg_info(res, get_type_dbg_info(mtp));
/* set param types and result types */
for (i = n_param = 0; i < orig_n_params; ++i) {
......@@ -2172,7 +2173,8 @@ static ir_type *lower_Builtin_type_high(ir_type *mtp)
return mtp;
}
res = new_d_type_method(n_params, n_results, get_type_dbg_info(mtp));
res = new_type_method(n_params, n_results);
set_type_dbg_info(res, get_type_dbg_info(mtp));
/* set param types and result types */
for (size_t i = 0; i < n_params; ++i) {
......@@ -2262,7 +2264,8 @@ static ir_type *lower_Builtin_type_low(ir_type *mtp)
return mtp;
}
res = new_d_type_method(n_params, n_results, get_type_dbg_info(mtp));
res = new_type_method(n_params, n_results);
set_type_dbg_info(res, get_type_dbg_info(mtp));
/* set param types and result types */
for (size_t i = 0; i < n_params; ++i) {
......
......@@ -48,7 +48,7 @@
#include "array.h"
static ir_type *new_type(tp_op const *type_op, ir_mode *mode, type_dbg_info *db);
static ir_type *new_type(tp_op const *type_op, ir_mode *mode);
ir_type *get_code_type(void)
{
......@@ -62,10 +62,10 @@ ir_type *get_unknown_type(void)
void ir_init_type(ir_prog *irp)
{
irp->code_type = new_type(tpop_code, mode_ANY, NULL);
irp->code_type = new_type(tpop_code, mode_ANY);
set_type_state(irp->code_type, layout_fixed);
irp->unknown_type = new_type(tpop_unknown, mode_ANY, NULL);
irp->unknown_type = new_type(tpop_unknown, mode_ANY);
set_type_size_bytes(irp->unknown_type, 0);
set_type_state (irp->unknown_type, layout_fixed);
}
......@@ -99,12 +99,11 @@ void (inc_master_type_visited)(void)
*
* @param type_op the kind of this type. May not be type_id.
* @param mode the mode to be used for this type, may be NULL
* @param db debug info
*
* @return A new type of the given type. The remaining private attributes are
* not initialized. The type is in state layout_undefined.
*/
static ir_type *new_type(tp_op const *type_op, ir_mode *mode, type_dbg_info *db)
static ir_type *new_type(tp_op const *type_op, ir_mode *mode)
{
size_t const node_size = offsetof(ir_type, attr) + type_op->attr_size;
ir_type *const res = (ir_type*)xmalloc(node_size);
......@@ -119,7 +118,6 @@ static ir_type *new_type(tp_op const *type_op, ir_mode *mode, type_dbg_info *db)
res->align = 0;
res->visit = 0;
res->link = NULL;
res->dbi = db;
#ifdef DEBUG_libfirm
res->nr = get_irp_new_node_nr();
#endif /* defined DEBUG_libfirm */
......@@ -378,9 +376,9 @@ int (is_type)(const void *thing)
return _is_type(thing);
}
ir_type *new_d_type_class(ident *name, type_dbg_info *db)
ir_type *new_type_class(ident *name)
{
ir_type *res = new_type(type_class, NULL, db);
ir_type *res = new_type(type_class, NULL);
res->name = name;
res->attr.ca.members = NEW_ARR_F (ir_entity *, 0);
......@@ -394,11 +392,6 @@ ir_type *new_d_type_class(ident *name, type_dbg_info *db)
return res;
}
ir_type *new_type_class(ident *name)
{
return new_d_type_class(name, NULL);
}
void free_class_entities(ir_type *clss)
{
assert(clss && clss->type_op == type_class);
......@@ -676,9 +669,9 @@ void set_class_size(ir_type *tp, unsigned size)
}
ir_type *new_d_type_struct(ident *name, type_dbg_info *db)
ir_type *new_type_struct(ident *name)
{
ir_type *res = new_type(type_struct, NULL, db);
ir_type *res = new_type(type_struct, NULL);
res->name = name;
res->attr.sa.members = NEW_ARR_F(ir_entity *, 0);
......@@ -686,11 +679,6 @@ ir_type *new_d_type_struct(ident *name, type_dbg_info *db)
return res;
}
ir_type *new_type_struct(ident *name)
{
return new_d_type_struct (name, NULL);
}
void free_struct_entities(ir_type *strct)
{
assert(strct->type_op == type_struct);
......@@ -781,10 +769,10 @@ void set_struct_size(ir_type *tp, unsigned size)
tp->size = size;
}
ir_type *new_d_type_method(size_t n_param, size_t n_res, type_dbg_info *db)
ir_type *new_type_method(size_t n_param, size_t n_res)
{
assert((get_mode_size_bits(mode_P_code) % 8 == 0) && "unorthodox modes not implemented");
ir_type *res = new_type(type_method, mode_P_code, db);
ir_type *res = new_type(type_method, mode_P_code);
res->flags |= tf_layout_fixed;
res->size = get_mode_size_bytes(mode_P_code);
res->attr.ma.n_params = n_param;
......@@ -797,11 +785,6 @@ ir_type *new_d_type_method(size_t n_param, size_t n_res, type_dbg_info *db)
return res;
}
ir_type *new_type_method(size_t n_param, size_t n_res)
{
return new_d_type_method(n_param, n_res, NULL);
}
ir_type *clone_type_method(ir_type *tp)
{
assert(is_Method_type(tp));
......@@ -809,7 +792,8 @@ ir_type *clone_type_method(ir_type *tp)
size_t n_params = tp->attr.ma.n_params;
size_t n_res = tp->attr.ma.n_res;
type_dbg_info *db = tp->dbi;
ir_type *res = new_type(type_method, mode, db);
ir_type *res = new_type(type_method, mode);
set_type_dbg_info(res, db);
res->flags = tp->flags;
res->higher_type = tp->higher_type;
......@@ -952,9 +936,9 @@ int (is_Method_type)(const ir_type *method)
}
ir_type *new_d_type_union(ident *name, type_dbg_info *db)
ir_type *new_type_union(ident *name)
{
ir_type *res = new_type(type_union, NULL, db);
ir_type *res = new_type(type_union, NULL);
res->name = name;
res->attr.ua.members = NEW_ARR_F(ir_entity *, 0);
......@@ -962,11 +946,6 @@ ir_type *new_d_type_union(ident *name, type_dbg_info *db)
return res;
}
ir_type *new_type_union(ident *name)
{
return new_d_type_union(name, NULL);
}
void free_union_entities(ir_type *uni)
{
assert(uni->type_op == type_union);
......@@ -1058,12 +1037,11 @@ ir_type *new_type_segment(ident *const name, type_flags const flags)
}
ir_type *new_d_type_array(size_t n_dimensions, ir_type *element_type,
type_dbg_info *db)
ir_type *new_type_array(size_t n_dimensions, ir_type *element_type)
{
assert(!is_Method_type(element_type));
ir_type *res = new_type(type_array, NULL, db);
ir_type *res = new_type(type_array, NULL);
res->attr.aa.n_dimensions = n_dimensions;
res->attr.aa.lower_bound = XMALLOCNZ(ir_node*, n_dimensions);
res->attr.aa.upper_bound = XMALLOCNZ(ir_node*, n_dimensions);
......@@ -1085,11 +1063,6 @@ ir_type *new_d_type_array(size_t n_dimensions, ir_type *element_type,
return res;
}
ir_type *new_type_array(size_t n_dimensions, ir_type *element_type)
{
return new_d_type_array(n_dimensions, element_type, NULL);
}
void free_array_automatic_entities(ir_type *array)
{
assert(array->type_op == type_array);
......@@ -1279,7 +1252,7 @@ void set_array_size(ir_type *tp, unsigned size)
}
ir_type *new_d_type_pointer(ir_type *points_to, type_dbg_info *db)
ir_type *new_type_pointer(ir_type *points_to)
{
ir_mode *mode;
if (is_Method_type(points_to) || is_code_type(points_to)) {
......@@ -1288,7 +1261,7 @@ ir_type *new_d_type_pointer(ir_type *points_to, type_dbg_info *db)
mode = mode_P_data;
}
ir_type *res = new_type(type_pointer, mode, db);
ir_type *res = new_type(type_pointer, mode);
res->attr.pa.points_to = points_to;
assert((get_mode_size_bits(res->mode) % 8 == 0) && "unorthodox modes not implemented");
res->size = get_mode_size_bytes(res->mode);
......@@ -1297,11 +1270,6 @@ ir_type *new_d_type_pointer(ir_type *points_to, type_dbg_info *db)
return res;
}
ir_type *new_type_pointer(ir_type *points_to)
{
return new_d_type_pointer(points_to, NULL);
}
void free_pointer_entities(ir_type *pointer)
{
(void) pointer;
......@@ -1349,20 +1317,15 @@ ir_type *find_pointer_type_to_type(ir_type *tp)
}
ir_type *new_d_type_primitive(ir_mode *mode, type_dbg_info *db)
ir_type *new_type_primitive(ir_mode *mode)
{
ir_type *res = new_type(type_primitive, mode, db);
ir_type *res = new_type(type_primitive, mode);
res->size = get_mode_size_bytes(mode);
res->flags |= tf_layout_fixed;
hook_new_type(res);
return res;
}
ir_type *new_type_primitive(ir_mode *mode)
{
return new_d_type_primitive(mode, NULL);
}
int (is_Primitive_type)(const ir_type *primitive)
{
return _is_primitive_type(primitive);
......
Markdown is supported
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