Commit 274626e2 authored by Matthias Braun's avatar Matthias Braun
Browse files

make unique types/entities part of irprog

unknown_type, code_type, none_type, unknown_entity reference are hold in
the irprog now. This makes handling more consistent since now all types
and entities are equally part of irprog.
parent a276562e
...@@ -689,9 +689,6 @@ FIRM_API ir_type *get_entity_repr_class(const ir_entity *ent); ...@@ -689,9 +689,6 @@ FIRM_API ir_type *get_entity_repr_class(const ir_entity *ent);
* - link = NULL * - link = NULL
*/ */
/** A variable that contains the only unknown entity. */
FIRM_API ir_entity *unknown_entity;
/** Returns the @link unknown_entity unknown entity @endlink. */ /** Returns the @link unknown_entity unknown entity @endlink. */
FIRM_API ir_entity *get_unknown_entity(void); FIRM_API ir_entity *get_unknown_entity(void);
...@@ -2081,8 +2078,6 @@ FIRM_API const tp_op *get_tpop_primitive(void); ...@@ -2081,8 +2078,6 @@ FIRM_API const tp_op *get_tpop_primitive(void);
* - size: 0 * - size: 0
* @{ * @{
*/ */
/** A variable that contains the only none type. */
FIRM_API ir_type *firm_none_type;
/** Returns the none type. */ /** Returns the none type. */
FIRM_API ir_type *get_none_type(void); FIRM_API ir_type *get_none_type(void);
/** Checks whether type @p type is the none type. */ /** Checks whether type @p type is the none type. */
...@@ -2103,8 +2098,6 @@ FIRM_API const tp_op *get_tpop_none(void); ...@@ -2103,8 +2098,6 @@ FIRM_API const tp_op *get_tpop_none(void);
/** @defgroup code_type Code /** @defgroup code_type Code
* @{ * @{
*/ */
/** A variable that contains the only code type. */
FIRM_API ir_type *firm_code_type;
/** Returns the code type. */ /** Returns the code type. */
FIRM_API ir_type *get_code_type(void); FIRM_API ir_type *get_code_type(void);
/** /**
...@@ -2137,8 +2130,6 @@ FIRM_API const tp_op *get_tpop_code_type(void); ...@@ -2137,8 +2130,6 @@ FIRM_API const tp_op *get_tpop_code_type(void);
* - size: 0 * - size: 0
* @{ * @{
*/ */
/** A variable that contains the only unknown type. */
FIRM_API ir_type *firm_unknown_type;
/** Returns the unknown type. */ /** Returns the unknown type. */
FIRM_API ir_type *get_unknown_type(void); FIRM_API ir_type *get_unknown_type(void);
/** Checks whether type @p type is the unknown type */ /** Checks whether type @p type is the unknown type */
......
...@@ -98,7 +98,7 @@ static ptr_access_kind analyze_arg(ir_node *arg, ptr_access_kind bits) ...@@ -98,7 +98,7 @@ static ptr_access_kind analyze_arg(ir_node *arg, ptr_access_kind bits)
meth_ent = get_Call_callee(succ, c); meth_ent = get_Call_callee(succ, c);
/* unknown_entity is used to signal that we don't know what is called */ /* unknown_entity is used to signal that we don't know what is called */
if (meth_ent == unknown_entity) { if (is_unknown_entity(meth_ent)) {
bits |= ptr_access_all; bits |= ptr_access_all;
break; break;
} }
......
...@@ -619,7 +619,7 @@ static void callee_ana_proj(ir_node *node, long n, pset *methods) ...@@ -619,7 +619,7 @@ static void callee_ana_proj(ir_node *node, long n, pset *methods)
if (is_Tuple(pred)) { if (is_Tuple(pred)) {
callee_ana_proj(get_Tuple_pred(pred, get_Proj_proj(node)), n, methods); callee_ana_proj(get_Tuple_pred(pred, get_Proj_proj(node)), n, methods);
} else { } else {
pset_insert_ptr(methods, unknown_entity); /* free method -> unknown */ pset_insert_ptr(methods, get_unknown_entity()); /* free method -> unknown */
} }
} }
break; break;
...@@ -630,7 +630,7 @@ static void callee_ana_proj(ir_node *node, long n, pset *methods) ...@@ -630,7 +630,7 @@ static void callee_ana_proj(ir_node *node, long n, pset *methods)
break; break;
default: default:
pset_insert_ptr(methods, unknown_entity); /* free method -> unknown */ pset_insert_ptr(methods, get_unknown_entity()); /* free method -> unknown */
break; break;
} }
} }
...@@ -655,7 +655,7 @@ static void callee_ana_node(ir_node *node, pset *methods) ...@@ -655,7 +655,7 @@ static void callee_ana_node(ir_node *node, pset *methods)
case iro_Const: case iro_Const:
/* A direct address call. We tread this as an external /* A direct address call. We tread this as an external
call and ignore it completely. */ call and ignore it completely. */
pset_insert_ptr(methods, unknown_entity); /* free method -> unknown */ pset_insert_ptr(methods, get_unknown_entity()); /* free method -> unknown */
break; break;
case iro_SymConst: { case iro_SymConst: {
...@@ -673,7 +673,7 @@ static void callee_ana_node(ir_node *node, pset *methods) ...@@ -673,7 +673,7 @@ static void callee_ana_node(ir_node *node, pset *methods)
if (ent != NULL) { if (ent != NULL) {
pset_insert_ptr(methods, ent); pset_insert_ptr(methods, ent);
} else { } else {
pset_insert_ptr(methods, unknown_entity); pset_insert_ptr(methods, get_unknown_entity());
} }
} }
break; break;
...@@ -708,7 +708,7 @@ static void callee_ana_node(ir_node *node, pset *methods) ...@@ -708,7 +708,7 @@ static void callee_ana_node(ir_node *node, pset *methods)
case iro_Sub: case iro_Sub:
case iro_Conv: case iro_Conv:
/* extern */ /* extern */
pset_insert_ptr(methods, unknown_entity); /* free method -> unknown */ pset_insert_ptr(methods, get_unknown_entity()); /* free method -> unknown */
break; break;
default: default:
...@@ -736,9 +736,9 @@ static void callee_walker(ir_node *call, void *env) ...@@ -736,9 +736,9 @@ static void callee_walker(ir_node *call, void *env)
foreach_pset(methods, ir_entity*, ent) { foreach_pset(methods, ir_entity*, ent) {
arr[i] = ent; arr[i] = ent;
/* we want the unknown_entity on the zero position for easy tests later */ /* we want the unknown_entity on the zero position for easy tests later */
if (ent == unknown_entity) { if (is_unknown_entity(ent)) {
arr[i] = arr[0]; arr[i] = arr[0];
arr[0] = unknown_entity; arr[0] = get_unknown_entity();
} }
++i; ++i;
} }
......
...@@ -865,7 +865,7 @@ static ir_node *adjust_alloc(be_abi_irg_t *env, ir_node *alloc, ir_node *curr_sp ...@@ -865,7 +865,7 @@ static ir_node *adjust_alloc(be_abi_irg_t *env, ir_node *alloc, ir_node *curr_sp
count = get_Alloc_count(alloc); count = get_Alloc_count(alloc);
/* we might need to multiply the count with the element size */ /* we might need to multiply the count with the element size */
if (type != firm_unknown_type && get_type_size_bytes(type) != 1) { if (!is_unknown_type(type) && get_type_size_bytes(type) != 1) {
ir_mode *mode = get_irn_mode(count); ir_mode *mode = get_irn_mode(count);
ir_tarval *tv = new_tarval_from_long(get_type_size_bytes(type), ir_tarval *tv = new_tarval_from_long(get_type_size_bytes(type),
mode); mode);
...@@ -930,7 +930,7 @@ static ir_node *adjust_free(be_abi_irg_t *env, ir_node *free, ir_node *curr_sp) ...@@ -930,7 +930,7 @@ static ir_node *adjust_free(be_abi_irg_t *env, ir_node *free, ir_node *curr_sp)
assert(get_Free_where(free) == stack_alloc); assert(get_Free_where(free) == stack_alloc);
/* we might need to multiply the size with the element size */ /* we might need to multiply the size with the element size */
if (type != firm_unknown_type && get_type_size_bytes(type) != 1) { if (!is_unknown_type(type) && get_type_size_bytes(type) != 1) {
ir_tarval *tv = new_tarval_from_long(get_type_size_bytes(type), mode_Iu); ir_tarval *tv = new_tarval_from_long(get_type_size_bytes(type), mode_Iu);
ir_node *cnst = new_rd_Const(dbg, irg, tv); ir_node *cnst = new_rd_Const(dbg, irg, tv);
ir_node *mul = new_rd_Mul(dbg, block, get_Free_count(free), ir_node *mul = new_rd_Mul(dbg, block, get_Free_count(free),
......
...@@ -1547,7 +1547,7 @@ char const *be_gas_get_private_prefix(void) ...@@ -1547,7 +1547,7 @@ char const *be_gas_get_private_prefix(void)
void be_gas_emit_entity(const ir_entity *entity) void be_gas_emit_entity(const ir_entity *entity)
{ {
if (entity->type == firm_code_type) { if (entity->type == get_code_type()) {
ir_label_t label = get_entity_label(entity); ir_label_t label = get_entity_label(entity);
be_emit_irprintf("%s_%lu", be_gas_get_private_prefix(), label); be_emit_irprintf("%s_%lu", be_gas_get_private_prefix(), label);
return; return;
...@@ -1585,7 +1585,7 @@ static void emit_global(be_gas_decl_env_t *env, const ir_entity *entity) ...@@ -1585,7 +1585,7 @@ static void emit_global(be_gas_decl_env_t *env, const ir_entity *entity)
ir_linkage linkage = get_entity_linkage(entity); ir_linkage linkage = get_entity_linkage(entity);
/* block labels are already emittet in the code */ /* block labels are already emittet in the code */
if (type == firm_code_type) if (type == get_code_type())
return; return;
/* we already emitted all methods. Except for the trampolines which /* we already emitted all methods. Except for the trampolines which
......
...@@ -517,7 +517,7 @@ static void walk_type(type_or_ent tore, void *ctx) ...@@ -517,7 +517,7 @@ static void walk_type(type_or_ent tore, void *ctx)
tp = tore.typ; tp = tore.typ;
/* ignore the unknown type */ /* ignore the unknown type */
if (tp == firm_unknown_type) if (is_unknown_type(tp))
return; return;
} else { } else {
return; return;
......
...@@ -2022,7 +2022,7 @@ static ir_node *gen_Alloc(ir_node *node) ...@@ -2022,7 +2022,7 @@ static ir_node *gen_Alloc(ir_node *node)
if (get_Alloc_where(node) != stack_alloc) if (get_Alloc_where(node) != stack_alloc)
panic("only stack-alloc supported in sparc backend (at %+F)", node); panic("only stack-alloc supported in sparc backend (at %+F)", node);
/* lowerer should have transformed all allocas to byte size */ /* lowerer should have transformed all allocas to byte size */
if (type != get_unknown_type() && get_type_size_bytes(type) != 1) if (!is_unknown_type(type) && get_type_size_bytes(type) != 1)
panic("Found non-byte alloc in sparc backend (at %+F)", node); panic("Found non-byte alloc in sparc backend (at %+F)", node);
if (is_Const(size)) { if (is_Const(size)) {
...@@ -2082,7 +2082,7 @@ static ir_node *gen_Free(ir_node *node) ...@@ -2082,7 +2082,7 @@ static ir_node *gen_Free(ir_node *node)
if (get_Alloc_where(node) != stack_alloc) if (get_Alloc_where(node) != stack_alloc)
panic("only stack-alloc supported in sparc backend (at %+F)", node); panic("only stack-alloc supported in sparc backend (at %+F)", node);
/* lowerer should have transformed all allocas to byte size */ /* lowerer should have transformed all allocas to byte size */
if (type != get_unknown_type() && get_type_size_bytes(type) != 1) if (!is_unknown_type(type) && get_type_size_bytes(type) != 1)
panic("Found non-byte alloc in sparc backend (at %+F)", node); panic("Found non-byte alloc in sparc backend (at %+F)", node);
if (is_Const(size)) { if (is_Const(size)) {
......
...@@ -102,10 +102,6 @@ void ir_init(void) ...@@ -102,10 +102,6 @@ void ir_init(void)
/* Builds a construct allowing to access all information to be constructed /* Builds a construct allowing to access all information to be constructed
later. */ later. */
init_irprog_2(); init_irprog_2();
/* Initialize the type module and construct some idents needed. */
ir_init_type();
/* initialize the entity module */
ir_init_entity();
/* class cast optimization */ /* class cast optimization */
firm_init_class_casts_opt(); firm_init_class_casts_opt();
/* memory disambiguation */ /* memory disambiguation */
...@@ -127,9 +123,6 @@ void ir_finish(void) ...@@ -127,9 +123,6 @@ void ir_finish(void)
{ {
free_ir_prog(); free_ir_prog();
ir_finish_entity();
ir_finish_type();
finish_tarval(); finish_tarval();
finish_mode(); finish_mode();
finish_tpop(); finish_tpop();
......
...@@ -815,7 +815,7 @@ static int dump_node_typeinfo(FILE *F, const ir_node *n) ...@@ -815,7 +815,7 @@ static int dump_node_typeinfo(FILE *F, const ir_node *n)
if (get_irg_typeinfo_state(current_ir_graph) == ir_typeinfo_consistent || if (get_irg_typeinfo_state(current_ir_graph) == ir_typeinfo_consistent ||
get_irg_typeinfo_state(current_ir_graph) == ir_typeinfo_inconsistent) { get_irg_typeinfo_state(current_ir_graph) == ir_typeinfo_inconsistent) {
ir_type *tp = get_irn_typeinfo_type(n); ir_type *tp = get_irn_typeinfo_type(n);
if (tp != firm_none_type) { if (tp != get_none_type()) {
ir_fprintf(F, "[%+F]", tp); ir_fprintf(F, "[%+F]", tp);
} else { } else {
fprintf(F, "[] "); fprintf(F, "[] ");
......
...@@ -315,7 +315,7 @@ void dump_irnode_to_file(FILE *F, const ir_node *n) ...@@ -315,7 +315,7 @@ void dump_irnode_to_file(FILE *F, const ir_node *n)
if (get_irg_typeinfo_state(get_irn_irg(n)) == ir_typeinfo_consistent || if (get_irg_typeinfo_state(get_irn_irg(n)) == ir_typeinfo_consistent ||
get_irg_typeinfo_state(get_irn_irg(n)) == ir_typeinfo_inconsistent ) get_irg_typeinfo_state(get_irn_irg(n)) == ir_typeinfo_inconsistent )
if (get_irn_typeinfo_type(n) != firm_none_type) if (get_irn_typeinfo_type(n) != get_none_type())
ir_fprintf (F, " Analysed type: %s\n", get_irn_typeinfo_type(n)); ir_fprintf (F, " Analysed type: %s\n", get_irn_typeinfo_type(n));
} }
......
...@@ -122,6 +122,7 @@ typedef enum keyword_t { ...@@ -122,6 +122,7 @@ typedef enum keyword_t {
kw_segment_type, kw_segment_type,
kw_type, kw_type,
kw_typegraph, kw_typegraph,
kw_unknown,
} keyword_t; } keyword_t;
typedef struct symbol_t { typedef struct symbol_t {
...@@ -247,6 +248,7 @@ static void symtbl_init(void) ...@@ -247,6 +248,7 @@ static void symtbl_init(void)
INSERTKEYWORD(segment_type); INSERTKEYWORD(segment_type);
INSERTKEYWORD(type); INSERTKEYWORD(type);
INSERTKEYWORD(typegraph); INSERTKEYWORD(typegraph);
INSERTKEYWORD(unknown);
INSERTENUM(tt_align, align_non_aligned); INSERTENUM(tt_align, align_non_aligned);
INSERTENUM(tt_align, align_is_aligned); INSERTENUM(tt_align, align_is_aligned);
...@@ -397,15 +399,20 @@ static void write_entity_ref(write_env_t *env, ir_entity *entity) ...@@ -397,15 +399,20 @@ static void write_entity_ref(write_env_t *env, ir_entity *entity)
static void write_type_ref(write_env_t *env, ir_type *type) static void write_type_ref(write_env_t *env, ir_type *type)
{ {
if (type == firm_unknown_type) { switch (get_type_tpop_code(type)) {
case tpo_unknown:
write_symbol(env, "unknown"); write_symbol(env, "unknown");
} else if (type == firm_none_type) { return;
case tpo_none:
write_symbol(env, "none"); write_symbol(env, "none");
} else if (type == firm_code_type) { return;
case tpo_code:
write_symbol(env, "code"); write_symbol(env, "code");
} else { return;
write_long(env, get_type_nr(type)); default:
break;
} }
write_long(env, get_type_nr(type));
} }
static void write_string(write_env_t *env, const char *string) static void write_string(write_env_t *env, const char *string)
...@@ -617,7 +624,7 @@ static void write_type_primitive(write_env_t *env, ir_type *tp) ...@@ -617,7 +624,7 @@ static void write_type_primitive(write_env_t *env, ir_type *tp)
write_type_common(env, tp); write_type_common(env, tp);
write_mode_ref(env, get_type_mode(tp)); write_mode_ref(env, get_type_mode(tp));
if (base_type == NULL) if (base_type == NULL)
base_type = firm_none_type; base_type = get_none_type();
write_type_ref(env, base_type); write_type_ref(env, base_type);
fputc('\n', env->file); fputc('\n', env->file);
} }
...@@ -772,6 +779,10 @@ static void write_entity(write_env_t *env, ir_entity *ent) ...@@ -772,6 +779,10 @@ static void write_entity(write_env_t *env, ir_entity *ent)
case IR_ENTITY_LABEL: write_symbol(env, "label"); break; case IR_ENTITY_LABEL: write_symbol(env, "label"); break;
case IR_ENTITY_COMPOUND_MEMBER: write_symbol(env, "compound_member"); break; case IR_ENTITY_COMPOUND_MEMBER: write_symbol(env, "compound_member"); break;
case IR_ENTITY_PARAMETER: write_symbol(env, "parameter"); break; case IR_ENTITY_PARAMETER: write_symbol(env, "parameter"); break;
case IR_ENTITY_UNKNOWN:
write_symbol(env, "unknown");
write_long(env, get_entity_nr(ent));
return;
} }
write_long(env, get_entity_nr(ent)); write_long(env, get_entity_nr(ent));
...@@ -830,6 +841,7 @@ static void write_entity(write_env_t *env, ir_entity *ent) ...@@ -830,6 +841,7 @@ static void write_entity(write_env_t *env, ir_entity *ent)
} }
break; break;
} }
case IR_ENTITY_UNKNOWN:
case IR_ENTITY_LABEL: case IR_ENTITY_LABEL:
case IR_ENTITY_METHOD: case IR_ENTITY_METHOD:
break; break;
...@@ -1474,11 +1486,11 @@ static ir_type *get_type(read_env_t *env, long typenr) ...@@ -1474,11 +1486,11 @@ static ir_type *get_type(read_env_t *env, long typenr)
ir_type *type = (ir_type *) get_id(env, typenr); ir_type *type = (ir_type *) get_id(env, typenr);
if (type == NULL) { if (type == NULL) {
parse_error(env, "Type %ld not defined (yet?)\n", typenr); parse_error(env, "Type %ld not defined (yet?)\n", typenr);
return firm_unknown_type; return get_unknown_type();
} }
if (type->kind != k_type) { if (type->kind != k_type) {
parse_error(env, "Object %ld is not a type (but should be)\n", typenr); parse_error(env, "Object %ld is not a type (but should be)\n", typenr);
return firm_unknown_type; return get_unknown_type();
} }
return type; return type;
} }
...@@ -1488,15 +1500,15 @@ static ir_type *read_type_ref(read_env_t *env) ...@@ -1488,15 +1500,15 @@ static ir_type *read_type_ref(read_env_t *env)
char *str = read_word(env); char *str = read_word(env);
if (strcmp(str, "none") == 0) { if (strcmp(str, "none") == 0) {
obstack_free(&env->obst, str); obstack_free(&env->obst, str);
return firm_none_type; return get_none_type();
} }
if (strcmp(str, "unknown") == 0) { if (strcmp(str, "unknown") == 0) {
obstack_free(&env->obst, str); obstack_free(&env->obst, str);
return firm_unknown_type; return get_unknown_type();
} }
if (strcmp(str, "code") == 0) { if (strcmp(str, "code") == 0) {
obstack_free(&env->obst, str); obstack_free(&env->obst, str);
return firm_code_type; return get_code_type();
} }
long nr = atol(str); long nr = atol(str);
obstack_free(&env->obst, str); obstack_free(&env->obst, str);
...@@ -1507,7 +1519,7 @@ static ir_type *read_type_ref(read_env_t *env) ...@@ -1507,7 +1519,7 @@ static ir_type *read_type_ref(read_env_t *env)
static ir_entity *create_error_entity(void) static ir_entity *create_error_entity(void)
{ {
ir_entity *res = new_entity(get_glob_type(), new_id_from_str("error"), ir_entity *res = new_entity(get_glob_type(), new_id_from_str("error"),
firm_unknown_type); get_unknown_type());
return res; return res;
} }
...@@ -1833,7 +1845,7 @@ static void read_type(read_env_t *env) ...@@ -1833,7 +1845,7 @@ static void read_type(read_env_t *env)
ir_mode *mode = read_mode_ref(env); ir_mode *mode = read_mode_ref(env);
ir_type *base_type = read_type_ref(env); ir_type *base_type = read_type_ref(env);
type = new_type_primitive(mode); type = new_type_primitive(mode);
if (base_type != firm_none_type) { if (base_type != get_none_type()) {
set_primitive_base_type(type, base_type); set_primitive_base_type(type, base_type);
} }
goto finish_type; goto finish_type;
...@@ -1875,6 +1887,13 @@ finish_type: ...@@ -1875,6 +1887,13 @@ finish_type:
set_id(env, typenr, type); set_id(env, typenr, type);
} }
static void read_unknown_entity(read_env_t *env)
{
long entnr = read_long(env);
ir_entity *entity = get_unknown_entity();
set_id(env, entnr, entity);
}
/** Reads an entity description and remembers it by its id. */ /** Reads an entity description and remembers it by its id. */
static void read_entity(read_env_t *env, ir_entity_kind kind) static void read_entity(read_env_t *env, ir_entity_kind kind)
{ {
...@@ -1952,6 +1971,8 @@ static void read_entity(read_env_t *env, ir_entity_kind kind) ...@@ -1952,6 +1971,8 @@ static void read_entity(read_env_t *env, ir_entity_kind kind)
ir_label_t nr = get_irp_next_label_nr(); ir_label_t nr = get_irp_next_label_nr();
entity = new_label_entity(nr); entity = new_label_entity(nr);
break; break;
case IR_ENTITY_UNKNOWN:
panic("read_entity with IR_ENTITY_UNKNOWN?");
} }
} }
...@@ -2006,6 +2027,9 @@ static void read_typegraph(read_env_t *env) ...@@ -2006,6 +2027,9 @@ static void read_typegraph(read_env_t *env)
case kw_parameter: case kw_parameter:
read_entity(env, IR_ENTITY_PARAMETER); read_entity(env, IR_ENTITY_PARAMETER);
break; break;
case kw_unknown:
read_unknown_entity(env);
break;
default: default:
parse_error(env, "type graph element not supported yet: %d\n", kwkind); parse_error(env, "type graph element not supported yet: %d\n", kwkind);
skip_to(env, '\n'); skip_to(env, '\n');
......
...@@ -1513,7 +1513,7 @@ static ir_entity *get_SymConst_attr_entity(const ir_node *self) ...@@ -1513,7 +1513,7 @@ static ir_entity *get_SymConst_attr_entity(const ir_node *self)
static ir_type *get_Null_type(const ir_node *n) static ir_type *get_Null_type(const ir_node *n)
{ {
(void) n; (void) n;
return firm_unknown_type; return get_unknown_type();
} }
void firm_set_default_get_type_attr(unsigned code, ir_op_ops *ops) void firm_set_default_get_type_attr(unsigned code, ir_op_ops *ops)
......
...@@ -76,7 +76,7 @@ static ir_prog *new_incomplete_ir_prog(void) ...@@ -76,7 +76,7 @@ static ir_prog *new_incomplete_ir_prog(void)
* @param irp the (yet incomplete) irp * @param irp the (yet incomplete) irp
* @param module_name the (module) name for this irp * @param module_name the (module) name for this irp
*/ */
static ir_prog *complete_ir_prog(ir_prog *irp, const char *module_name) static void complete_ir_prog(ir_prog *irp, const char *module_name)
{ {
#define IDENT(x) new_id_from_chars(x, sizeof(x) - 1) #define IDENT(x) new_id_from_chars(x, sizeof(x) - 1)
...@@ -104,10 +104,6 @@ static ir_prog *complete_ir_prog(ir_prog *irp, const char *module_name) ...@@ -104,10 +104,6 @@ static ir_prog *complete_ir_prog(ir_prog *irp, const char *module_name)
irp->phase_state = phase_building; irp->phase_state = phase_building;
irp->class_cast_state = ir_class_casts_transitive; irp->class_cast_state = ir_class_casts_transitive;
irp->globals_entity_usage_state = ir_entity_usage_not_computed; irp->globals_entity_usage_state = ir_entity_usage_not_computed;
current_ir_graph = irp->const_code_irg;
return irp;
#undef IDENT #undef IDENT
} }
...@@ -118,12 +114,16 @@ void init_irprog_1(void) ...@@ -118,12 +114,16 @@ void init_irprog_1(void)
void init_irprog_2(void) void init_irprog_2(void)
{ {
(void)complete_ir_prog(irp, INITAL_PROG_NAME); complete_ir_prog(irp, INITAL_PROG_NAME);
ir_init_type(irp);
ir_init_entity(irp);
} }
ir_prog *new_ir_prog(const char *name) ir_prog *new_ir_prog(const char *name)
{ {
return complete_ir_prog(new_incomplete_ir_prog(), name); ir_prog *irp = new_incomplete_ir_prog();
complete_ir_prog(irp, name);
return irp;
} }
void free_ir_prog(void) void free_ir_prog(void)
......
...@@ -622,8 +622,12 @@ struct ir_prog { ...@@ -622,8 +622,12 @@ struct ir_prog {
to allocate nodes the represent values to allocate nodes the represent values
of constant entities. It is not meant as of constant entities. It is not meant as
a procedure. */ a procedure. */
ir_entity *unknown_entity; /**< unique 'unknown'-entity */
ir_type *segment_types[IR_SEGMENT_LAST+1]; ir_type *segment_types[IR_SEGMENT_LAST+1];
ir_type **types; /**< A list of all types in the ir. */ 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_mode **modes; /**< A list of all modes in the ir. */ ir_mode **modes; /**< A list of all modes in the ir. */
ir_op **opcodes; /**< A list of all opcodes in the ir. */