Commit 3b9811c4 authored by Matthias Braun's avatar Matthias Braun
Browse files

remove unused 'none' type

parent 2ccb5118
......@@ -764,7 +764,6 @@ typedef enum tp_opcode {
tpo_pointer, /**< A pointer type. */
tpo_primitive, /**< A primitive type. */
tpo_code, /**< a piece of code (a basic block) */
tpo_none, /**< Special type for the None type. */
tpo_unknown, /**< Special code for the Unknown type. */
tpo_last = tpo_unknown /* not a type opcode */
} tp_opcode;
......@@ -1885,41 +1884,6 @@ FIRM_API const tp_op *get_tpop_primitive(void);
/** @} */
/**
* @defgroup none_type None
*
* This type is an auxiliary type dedicated to support type analyses.
*
* The none type represents that there is no type. The type can be used to
* initialize fields of type* that actually can not contain a type or that
* are initialized for an analysis. There exists exactly one type none.
* This type is not on the type list in ir_prog. It is
* allocated when initializing the type module.
*
* The following values are set:
* - mode: mode_BAD
* - name: "type_none"
* - state: layout_fixed
* - size: 0
* @{
*/
/** Returns the none type. */
FIRM_API ir_type *get_none_type(void);
/** Checks whether type @p type is the none type. */
FIRM_API int is_none_type(const ir_type *type);
/**
* This type opcode is an auxiliary opcode dedicated to support type analyses.
*
* Types with this opcode represents that there is no type.
* The type can be used to initialize fields of the type* that actually can not
* contain a type or that are initialized for an analysis. There exists exactly
* one type with this opcode.
*/
FIRM_API const tp_op *tpop_none;
/** Returns type opcode for none type. @see tpop_none */
FIRM_API const tp_op *get_tpop_none(void);
/** @} */
/** @defgroup code_type Code
* @{
*/
......
......@@ -821,11 +821,7 @@ static int dump_node_typeinfo(FILE *F, const ir_node *n)
if (get_irg_typeinfo_state(irg) == ir_typeinfo_consistent ||
get_irg_typeinfo_state(irg) == ir_typeinfo_inconsistent) {
ir_type *tp = get_irn_typeinfo_type(n);
if (tp != get_none_type()) {
ir_fprintf(F, "[%+F]", tp);
} else {
fprintf(F, "[] ");
}
ir_fprintf(F, "[%+F]", tp);
}
}
return bad;
......@@ -1763,7 +1759,6 @@ static void dump_type_info(type_or_ent tore, void *env)
case tpo_unknown:
case tpo_code:
case tpo_uninitialized:
case tpo_none:
case tpo_primitive:
break;
}
......
......@@ -343,9 +343,9 @@ void dump_irnode_to_file(FILE *const F, const ir_node *const n)
}
if (get_irg_typeinfo_state(get_irn_irg(n)) == ir_typeinfo_consistent ||
get_irg_typeinfo_state(get_irn_irg(n)) == ir_typeinfo_inconsistent )
if (get_irn_typeinfo_type(n) != get_none_type())
ir_fprintf (F, " Analysed type: %s\n", get_irn_typeinfo_type(n));
get_irg_typeinfo_state(get_irn_irg(n)) == ir_typeinfo_inconsistent) {
ir_fprintf (F, " Analysed type: %s\n", get_irn_typeinfo_type(n));
}
}
void dump_graph_as_text(FILE *const out, const ir_graph *const irg)
......@@ -772,7 +772,6 @@ void dump_type_to_file(FILE *const F, const ir_type *const tp)
break;
case tpo_primitive:
case tpo_none:
case tpo_unknown:
fprintf(F, "\n");
break;
......
......@@ -362,9 +362,6 @@ static void write_type_ref(write_env_t *env, ir_type *type)
case tpo_unknown:
write_symbol(env, "unknown");
return;
case tpo_none:
write_symbol(env, "none");
return;
case tpo_code:
write_symbol(env, "code");
return;
......@@ -670,7 +667,6 @@ static void write_type(write_env_t *env, ir_type *tp)
mark_type_visited(tp);
switch ((tp_opcode)get_type_tpop_code(tp)) {
case tpo_none:
case tpo_unknown:
case tpo_code:
case tpo_uninitialized:
......@@ -1439,10 +1435,6 @@ static ir_type *get_type(read_env_t *env, long typenr)
static ir_type *read_type_ref(read_env_t *env)
{
char *str = read_word(env);
if (strcmp(str, "none") == 0) {
obstack_free(&env->obst, str);
return get_none_type();
}
if (strcmp(str, "unknown") == 0) {
obstack_free(&env->obst, str);
return get_unknown_type();
......@@ -1790,7 +1782,6 @@ static void read_type(read_env_t *env)
goto finish_type;
}
case tpo_none:
case tpo_code:
case tpo_unknown:
case tpo_enumeration:
......
......@@ -588,7 +588,6 @@ struct ir_prog {
ir_entity *unknown_entity; /**< unique 'unknown'-entity */
ir_type *segment_types[IR_SEGMENT_LAST+1];
ir_type **types; /**< A list of all types in the ir. */
ir_type *none_type; /**< unique 'none'-type */
ir_type *code_type; /**< unique 'code'-type */
ir_type *unknown_type; /**< unique 'unknown'-type */
ir_type *byte_type; /**< type for a 'byte' */
......
......@@ -22,7 +22,6 @@ const tp_op *type_enumeration; const tp_op *get_tpop_enumeration(void) { retur
const tp_op *type_pointer; const tp_op *get_tpop_pointer (void) { return type_pointer; }
const tp_op *type_primitive; const tp_op *get_tpop_primitive (void) { return type_primitive; }
const tp_op *tpop_code; const tp_op *get_tpop_code_type (void) { return tpop_code; }
const tp_op *tpop_none; const tp_op *get_tpop_none (void) { return tpop_none; }
const tp_op *tpop_unknown; const tp_op *get_tpop_unknown (void) { return tpop_unknown; }
const tp_op *new_tpop(tp_opcode code, ident *name, unsigned flags,
......@@ -161,7 +160,6 @@ void init_tpop(void)
type_pointer = new_tpop(tpo_pointer , ID("pointer"), 0, sizeof(ptr_attr), &pointer_ops);
type_primitive = new_tpop(tpo_primitive , ID("primitive"), 0, 0, &null_ops);
tpop_code = new_tpop(tpo_code , ID("code"), 0, 0, &null_ops);
tpop_none = new_tpop(tpo_none , ID("None"), 0, 0, &pseudo_ops);
tpop_unknown = new_tpop(tpo_unknown , ID("Unknown"), 0, 0, &pseudo_ops);
#undef ID
}
......@@ -177,7 +175,6 @@ void finish_tpop(void)
free_tpop(type_pointer ); type_pointer = NULL;
free_tpop(type_primitive ); type_primitive = NULL;
free_tpop(tpop_code ); tpop_code = NULL;
free_tpop(tpop_none ); tpop_none = NULL;
free_tpop(tpop_unknown ); tpop_unknown = NULL;
}
......
......@@ -107,7 +107,6 @@ int check_type(const ir_type *tp)
case tpo_method:
case tpo_uninitialized:
case tpo_unknown:
case tpo_none:
case tpo_code:
break;
}
......
......@@ -50,11 +50,6 @@
static ir_type *new_type(tp_op const *type_op, ir_mode *mode, type_dbg_info *db);
ir_type *get_none_type(void)
{
return irp->none_type;
}
ir_type *get_code_type(void)
{
return irp->code_type;
......@@ -67,11 +62,6 @@ ir_type *get_unknown_type(void)
void ir_init_type(ir_prog *irp)
{
/* construct none and unknown type. */
irp->none_type = new_type(tpop_none, mode_BAD, NULL);
set_type_size_bytes(irp->none_type, 0);
set_type_state (irp->none_type, layout_fixed);
irp->code_type = new_type(tpop_code, mode_ANY, NULL);
set_type_state(irp->code_type, layout_fixed);
......@@ -82,7 +72,7 @@ void ir_init_type(ir_prog *irp)
void ir_finish_type(ir_prog *irp)
{
/** nothing todo. (The none, code, unknown types are in the global type list
/** nothing todo. (The code, unknown types are in the global type list
* and freed there */
(void)irp;
}
......@@ -1592,12 +1582,6 @@ int is_unknown_type(const ir_type *tp)
return tp->type_op == tpop_unknown;
}
int is_none_type(const ir_type *tp)
{
assert(tp->kind == k_type);
return tp->type_op == tpop_none;
}
int is_frame_type(const ir_type *tp)
{
return tp->flags & tf_frame_type;
......@@ -1798,9 +1782,6 @@ void ir_print_type(char *buffer, size_t buffer_size, const ir_type *type)
return;
}
case tpo_none:
snprintf(buffer, buffer_size, "none");
return;
case tpo_method:
/* TODO: we should print argument and return types here... */
snprintf(buffer, buffer_size, "method type");
......
......@@ -179,7 +179,6 @@ static void do_type_walk(type_or_ent tore,
case tpo_code:
case tpo_primitive:
case tpo_none:
case tpo_unknown:
/* a leave. */
break;
......
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