/**
* Beware: do not set the entity ld_name
*/
-static const char *get_entity_ld_name_ex(entity *ent) {
+static const char *get_entity_ld_name_ex(ir_entity *ent) {
if (ent->ld_name)
return get_entity_ld_name(ent);
return get_entity_name(ent);
char add[64];
char buf[256];
char tv_buf[256];
- entity *ent;
+ ir_entity *ent;
buf[0] = '\0';
add[0] = '\0';
* - are external visible
* - are dereferenced somewhere within the program (i.e., the address of the
* method is stored somewhere). */
-static void caller_init(int arr_length, entity ** free_methods) {
+static void caller_init(int arr_length, ir_entity ** free_methods) {
int i, j;
for (i = get_irp_n_irgs() - 1; i >= 0; --i) {
set_entity_link(get_irg_entity(get_irp_irg(i)), irg_data_create());
for (call = get_irn_link(get_irg_end(irg)); call; call = get_irn_link(call)) {
if (get_irn_op(call) != op_Call) continue;
for (j = get_Call_n_callees(call) - 1; j >= 0; --j) {
- entity * ent = get_Call_callee(call, j);
+ ir_entity * ent = get_Call_callee(call, j);
if (get_entity_irg(ent)) {
irg_data_t * data = get_entity_link(ent);
# ifndef CATE_jni
/* Zwischengespeicherte Daten wieder freigeben. */
static void cleanup_irg(ir_graph * irg) {
- entity * ent = get_irg_entity(irg);
+ ir_entity * ent = get_irg_entity(irg);
irg_data_t * data = get_entity_link(ent);
assert(data);
if (data->res) DEL_ARR_F(data->res);
/* Abhängigkeiten vom Start-Block und den Filter-Operationen im
* Start-Block auf den Aufrufer hinzufügen. */
-static void construct_start(entity * caller, entity * callee,
+static void construct_start(ir_entity * caller, ir_entity * callee,
ir_node * call, ir_node * exec) {
irg_data_t *data = get_entity_link(callee);
ir_graph *irg = get_entity_irg(callee);
int i, n_callees;
ir_node *post_block, *pre_block, *except_block, * proj, *jmp, *call_begin;
ir_node ** in;
- entity * caller;
- entity ** callees;
+ ir_entity * caller;
+ ir_entity ** callees;
ir_graph ** irgs;
irg_data_t ** data;
in = NEW_ARR_F(ir_node *, n_callees);
caller = get_irg_entity(current_ir_graph); /* entity des aktuellen ir_graph */
- callees = NEW_ARR_F(entity *, n_callees); /* aufgerufene Methoden: entity */
+ callees = NEW_ARR_F(ir_entity *, n_callees); /* aufgerufene Methoden: entity */
irgs = NEW_ARR_F(ir_graph *, n_callees); /* aufgerufene Methoden: ir_graph */
data = NEW_ARR_F(irg_data_t *, n_callees); /* aufgerufene Methoden: irg_data_t */
set_interprocedural_view(1);
for (i = 0; i < n_callees; ++i) {
- entity * callee = get_Call_callee(call, i);
+ ir_entity * callee = get_Call_callee(call, i);
if (data[i]) { /* explicit */
if (data[i]->except) {
in[i] = new_r_Proj(get_entity_irg(callee), get_nodes_block(data[i]->except),
}
-void cg_construct(int arr_len, entity ** free_methods_arr) {
+void cg_construct(int arr_len, ir_entity ** free_methods_arr) {
int i;
if (get_irp_ip_view_state() == ip_view_valid) return;
/* prepare irgs */
for (i = get_irp_n_irgs() - 1; i >= 0; --i) {
ir_graph * irg = get_irp_irg(i);
- entity * ent = get_irg_entity(irg);
+ ir_entity * ent = get_irg_entity(irg);
irg_data_t * data = get_entity_link(ent);
if (data->count) {
prepare_irg(irg, data);
* are external visible. These methods get an 'Unknown'
* caller.
* @arg arr_len The number of free methods. */
-void cg_construct(int arr_len, entity *free_methods_arr[]);
+void cg_construct(int arr_len, ir_entity *free_methods_arr[]);
/** Deconstruction of the interprocedural view. Reduces memory consumption of
static void make_entity_to_description(type_or_ent *tore, void *env) {
if (get_kind(tore) == k_entity) {
- entity *ent = (entity *)tore;
+ ir_entity *ent = (ir_entity *)tore;
if ((is_Method_type(get_entity_type(ent))) &&
(get_entity_peculiarity(ent) != peculiarity_description) &&
(get_entity_visibility(ent) != visibility_external_allocated) ) {
- entity *impl = get_SymConst_entity(get_atomic_ent_value(ent));
+ ir_entity *impl = get_SymConst_entity(get_atomic_ent_value(ent));
if (get_entity_link(impl) != env) {
set_entity_peculiarity(ent, peculiarity_description);
}
}
/* garbage collect methods: mark and remove */
-void gc_irgs(int n_keep, entity ** keep_arr) {
+void gc_irgs(int n_keep, ir_entity ** keep_arr) {
void * MARK = &MARK; /* @@@ gefaehrlich!!! Aber wir markieren hoechstens zu viele ... */
int i;
/* Mark entities that are alive. */
if (n_keep > 0) {
- entity ** marked = NEW_ARR_F(entity *, n_keep);
+ ir_entity ** marked = NEW_ARR_F(ir_entity *, n_keep);
for (i = 0; i < n_keep; ++i) {
marked[i] = keep_arr[i];
set_entity_link(marked[i], MARK);
assert(get_irn_op(node) == op_Call);
for (i = get_Call_n_callees(node) - 1; i >= 0; --i) {
- entity * ent = get_Call_callee(node, i);
+ ir_entity * ent = get_Call_callee(node, i);
if (get_entity_irg(ent) && get_entity_link(ent) != MARK) {
set_entity_link(ent, MARK);
- ARR_APP1(entity *, marked, ent);
+ ARR_APP1(ir_entity *, marked, ent);
if (get_opt_dead_method_elimination_verbose() && get_firm_verbosity() > 2) {
printf("dead method elimination: method %s can be called from Call %ld: kept alive.\n",
get_entity_ld_name(ent), get_irn_node_nr(node));
type_walk(make_entity_to_description, NULL, MARK);
for (i = get_irp_n_irgs() - 1; i >= 0; --i) {
ir_graph * irg = get_irp_irg(i);
- entity * ent = get_irg_entity(irg);
+ ir_entity * ent = get_irg_entity(irg);
/* Removing any graph invalidates all interprocedural loop trees. */
if (get_irg_loopinfo_state(irg) == loopinfo_ip_consistent ||
get_irg_loopinfo_state(irg) == loopinfo_ip_inconsistent) {
* ueberschrieben.
*
* Frees all interprocedural loop information. */
-void gc_irgs(int n_keep, entity *keep_arr[]);
+void gc_irgs(int n_keep, ir_entity *keep_arr[]);
#endif /* _FIRM_IR_ICGOPT_H_ */
* prints the edge from a type T to an entity E with additional info fmt, ...
* to the file F
*/
-static void print_type_ent_edge(FILE *F, ir_type *T, entity *E, const char *fmt, ...)
+static void print_type_ent_edge(FILE *F, ir_type *T, ir_entity *E, const char *fmt, ...)
{
va_list ap;
* prints the edge from an entity E to an entity T with additional info fmt, ...
* to the file F
*/
-static void print_ent_ent_edge(FILE *F, entity *E, entity *T, int backedge, const char *fmt, ...)
+static void print_ent_ent_edge(FILE *F, ir_entity *E, ir_entity *T, int backedge, const char *fmt, ...)
{
va_list ap;
* prints the edge from an entity E to a type T with additional info fmt, ...
* to the file F
*/
-static void print_ent_type_edge(FILE *F, entity *E, ir_type *T, const char *fmt, ...)
+static void print_ent_type_edge(FILE *F, ir_entity *E, ir_type *T, const char *fmt, ...)
{
va_list ap;
* prints the edge from a node N to an entity E with additional info fmt, ...
* to the file F
*/
-static void print_node_ent_edge(FILE *F, const ir_node *N, entity *E, const char *fmt, ...)
+static void print_node_ent_edge(FILE *F, const ir_node *N, ir_entity *E, const char *fmt, ...)
{
va_list ap;
* prints the edge from an entity E to a node N with additional info fmt, ...
* to the file F
*/
-static void print_ent_node_edge(FILE *F, entity *E, const ir_node *N, const char *fmt, ...)
+static void print_ent_node_edge(FILE *F, ir_entity *E, const ir_node *N, const char *fmt, ...)
{
va_list ap;
* If the entity has a ld_name, returns it if the dump_ld_name is set,
* else returns the name of the entity.
*/
-static const char *_get_ent_dump_name(entity *ent, int dump_ld_name) {
+static const char *_get_ent_dump_name(ir_entity *ent, int dump_ld_name) {
if (!ent)
return "<NULL entity>";
if (dump_ld_name) {
* If the entity has a ld_name, returns it if the option dump_ld_name is set,
* else returns the name of the entity.
*/
-const char *get_ent_dump_name(entity *ent) {
+const char *get_ent_dump_name(ir_entity *ent) {
return _get_ent_dump_name(ent, dump_ld_name);
}
}
case iro_CallBegin: {
ir_node *addr = get_CallBegin_ptr(n);
- entity *ent = NULL;
+ ir_entity *ent = NULL;
if (get_irn_op(addr) == op_Sel)
ent = get_Sel_entity(addr);
else if ((get_irn_op(addr) == op_SymConst) && (get_SymConst_kind(addr) == symconst_addr_ent))
* If interprocedural view edges can point to nodes out of this graph.
*/
static void dump_graph_from_list(FILE *F, ir_graph *irg) {
- entity *ent = get_irg_entity(irg);
+ ir_entity *ent = get_irg_entity(irg);
fprintf(F, "graph: { title: \"");
PRINT_IRGID(irg);
#define X(a) case a: fprintf(F, #a); break
-void dump_entity_node(FILE *F, entity *ent, int color)
+void dump_entity_node(FILE *F, ir_entity *ent, int color)
{
fprintf (F, "node: {title: \"");
PRINT_ENTID(ent); fprintf(F, "\"");
switch (get_kind(tore)) {
case k_entity:
{
- entity *ent = (entity *)tore;
+ ir_entity *ent = (ir_entity *)tore;
ir_node *value;
/* The node */
dump_entity_node(F, ent, 0);
/* dump this type or entity */
switch (get_kind(tore)) {
case k_entity: {
- entity *ent = (entity *)tore;
+ ir_entity *ent = (ir_entity *)tore;
if (get_entity_owner(ent) == get_glob_type()) break;
if (!is_Method_type(get_entity_type(ent))) break; /* GL */
if (env->dump_ent && is_Class_type(get_entity_owner(ent))) {
FILE *F;
int i;
char *suffix1;
- entity *ent;
+ ir_entity *ent;
if (!is_filtered_dump_name(get_entity_ident(get_irg_entity(irg))))
return;
return base_color + n_colors - color;
}
-static int get_entity_color(entity *ent) {
+static int get_entity_color(ir_entity *ent) {
ir_graph *irg = get_entity_irg(ent);
assert(irg);
for (i = get_irp_n_irgs() - 1; i >= 0; --i) {
ir_graph *irg = get_irp_irg(i);
- entity *ent = get_irg_entity(irg);
+ ir_entity *ent = get_irg_entity(irg);
int j, n_callees = get_irg_n_callees(irg);
/* Do not dump runtime system. */
dump_entity_node(F, ent, get_entity_color(ent));
for (j = 0; j < n_callees; ++j) {
- entity *c = get_irg_entity(get_irg_callee(irg, j));
+ ir_entity *c = get_irg_entity(get_irg_callee(irg, j));
//if (id_is_prefix(prefix, get_entity_ld_ident(c))) continue;
int be = is_irg_callee_backedge(irg, j);
char *attr;
/** Write the entity and all its attributes to the passed file.
* */
-void dump_entity_to_file (FILE *F, entity *ent, unsigned verbosity);
+void dump_entity_to_file (FILE *F, ir_entity *ent, unsigned verbosity);
/** Write the entity and all its attributes to the stdout.
*
* Calls dump_entity_to_file(). */
-void dump_entity (entity *ent);
+void dump_entity (ir_entity *ent);
/** Write the type and all its attributes to the file passed.
* */
void vcg_close (FILE *F);
-const char *get_ent_dump_name(entity *ent);
+const char *get_ent_dump_name(ir_entity *ent);
const char *get_type_name_ex(ir_type *tp, int *bad);
const char *get_mode_name_ex(ir_mode *mode, int *bad);
/**
fprintf(F, " allocated on: the %s\n", (get_Free_where(n) == stack_alloc) ? "stack" : "heap");
} break;
case iro_Sel: {
- entity *ent = get_Sel_entity(n);
+ ir_entity *ent = get_Sel_entity(n);
if (ent) {
fprintf(F, " Selecting entity %s (%ld)\n", get_entity_name(ent), get_entity_nr(ent));
fprintf(F, " of type %s\n", get_type_name_ex(get_entity_type(ent), &bad));
fprintf(F, "\n");
}
-void dump_entity_to_file_prefix (FILE *F, entity *ent, char *prefix, unsigned verbosity) {
+void dump_entity_to_file_prefix (FILE *F, ir_entity *ent, char *prefix, unsigned verbosity) {
int i, j;
ir_type *owner, *type;
if (get_entity_n_overwrites(ent) > 0) {
fprintf(F, "%s overwrites:\n", prefix);
for (i = 0; i < get_entity_n_overwrites(ent); ++i) {
- entity *ov = get_entity_overwrites(ent, i);
+ ir_entity *ov = get_entity_overwrites(ent, i);
fprintf(F, "%s %d: %s of class %s\n", prefix, i, get_entity_name(ov),
get_type_name(get_entity_owner(ov)));
}
if (get_entity_n_overwrittenby(ent) > 0) {
fprintf(F, "%s overwritten by:\n", prefix);
for (i = 0; i < get_entity_n_overwrittenby(ent); ++i) {
- entity *ov = get_entity_overwrittenby(ent, i);
+ ir_entity *ov = get_entity_overwrittenby(ent, i);
fprintf(F, "%s %d: %s of class %s\n", prefix, i, get_entity_name(ov),
get_type_name(get_entity_owner(ov)));
}
}
if (get_irp_inh_transitive_closure_state() != inh_transitive_closure_none) {
- entity *ov;
+ ir_entity *ov;
fprintf(F, "%s transitive overwrites:\n", prefix);
for (ov = get_entity_trans_overwrites_first(ent);
ov;
compute_compound_ent_array_indices(ent);
for (i = 0; i < get_compound_ent_n_values(ent); ++i) {
compound_graph_path *path = get_compound_ent_value_path(ent, i);
- entity *ent0 = get_compound_graph_path_node(path, 0);
+ ir_entity *ent0 = get_compound_graph_path_node(path, 0);
fprintf(F, "\n%s %3d:%d ", prefix, get_entity_offset(ent0), get_entity_offset_bits_remainder(ent0));
if (get_type_state(type) == layout_fixed)
fprintf(F, "(%3d:%d) ", get_compound_ent_value_offset_bytes(ent, i), get_compound_ent_value_offset_bit_remainder(ent, i));
fprintf(F, "%s", get_entity_name(ent));
for (j = 0; j < get_compound_graph_path_length(path); ++j) {
- entity *node = get_compound_graph_path_node(path, j);
+ ir_entity *node = get_compound_graph_path_node(path, j);
fprintf(F, ".%s", get_entity_name(node));
if (is_Array_type(get_entity_owner(node)))
fprintf(F, "[%d]", get_compound_graph_path_array_index(path, j));
}
-void dump_entity_to_file (FILE *F, entity *ent, unsigned verbosity) {
+void dump_entity_to_file (FILE *F, ir_entity *ent, unsigned verbosity) {
dump_entity_to_file_prefix (F, ent, "", verbosity);
fprintf(F, "\n");
}
-void dump_entity (entity *ent) {
+void dump_entity (ir_entity *ent) {
dump_entity_to_file(stdout, ent, dump_verbosity_max);
}
-void dump_entitycsv_to_file_prefix (FILE *F, entity *ent, char *prefix, unsigned verbosity,
+void dump_entitycsv_to_file_prefix (FILE *F, ir_entity *ent, char *prefix, unsigned verbosity,
int *max_disp, int disp[], const char *comma) {
#if 0 /* Outputs loop depth of all occurrences. */
fprintf(F, "\n");
for (i = 0; i < get_class_n_members(tp); ++i) {
- entity *mem = get_class_member(tp, i);
+ ir_entity *mem = get_class_member(tp, i);
if (((verbosity & dump_verbosity_methods) && is_Method_type(get_entity_type(mem))) ||
((verbosity & dump_verbosity_fields) && !is_Method_type(get_entity_type(mem))) ) {
if (!((verbosity & dump_verbosity_nostatic) && (get_entity_allocation(mem) == allocation_static))) {
}
for (i = 0; i < get_class_n_members(tp); ++i) {
- entity *mem = get_class_member(tp, i);
+ ir_entity *mem = get_class_member(tp, i);
if (((verbosity & dump_verbosity_methods) && is_Method_type(get_entity_type(mem))) ||
((verbosity & dump_verbosity_fields) && !is_Method_type(get_entity_type(mem))) ) {
if (!((verbosity & dump_verbosity_nostatic) && (get_entity_allocation(mem) == allocation_static))) {
fprintf(F, "\n members: \n");
}
for (i = 0; i < get_class_n_members(tp); ++i) {
- entity *mem = get_class_member(tp, i);
+ ir_entity *mem = get_class_member(tp, i);
if (((verbosity & dump_verbosity_methods) && is_Method_type(get_entity_type(mem))) ||
((verbosity & dump_verbosity_fields) && !is_Method_type(get_entity_type(mem))) ) {
if (!((verbosity & dump_verbosity_nostatic) && (get_entity_allocation(mem) == allocation_static))) {
case tpo_struct:
if (verbosity & dump_verbosity_fields) fprintf(F, "\n members: ");
for (i = 0; i < get_compound_n_members(tp); ++i) {
- entity *mem = get_compound_member(tp, i);
+ ir_entity *mem = get_compound_member(tp, i);
if (verbosity & dump_verbosity_fields) {
dump_entity_to_file_prefix(F, mem, " ", verbosity);
}
}
for (i = 0; i < n_mems; ++i) {
- entity *e = get_class_member(g, i);
+ ir_entity *e = get_class_member(g, i);
dump_entity_to_file(F, e, verbosity);
if (CSV) {
/* copy the entities. */
called_frame = get_irg_frame_type(called_graph);
for (i = 0; i < get_class_n_members(called_frame); i++) {
- entity *new_ent, *old_ent;
+ ir_entity *new_ent, *old_ent;
old_ent = get_class_member(called_frame, i);
new_ent = copy_entity_own(old_ent, get_cur_frame_type());
set_entity_link(old_ent, new_ent);
ir_node *symc = get_Call_ptr(call);
if (is_SymConst(symc) && get_SymConst_kind(symc) == symconst_addr_ent) {
- entity *ent = get_SymConst_entity(symc);
+ ir_entity *ent = get_SymConst_entity(symc);
if (get_entity_additional_properties(ent) & mtp_property_runtime)
return;
and optimization.
*/
ir_graph *
-new_r_ir_graph (entity *ent, int n_loc)
+new_r_ir_graph (ir_entity *ent, int n_loc)
{
ir_graph *res;
ir_node *first_block;
ir_graph *
-new_ir_graph(entity *ent, int n_loc)
+new_ir_graph(ir_entity *ent, int n_loc)
{
ir_graph *res = new_r_ir_graph(ent, n_loc);
add_irp_irg(res); /* remember this graph global. */
_set_irg_current_block(irg, node);
}
-entity *
+ir_entity *
(get_irg_entity)(const ir_graph *irg) {
return _get_irg_entity(irg);
}
void
-(set_irg_entity)(ir_graph *irg, entity *ent) {
+(set_irg_entity)(ir_graph *irg, ir_entity *ent) {
_set_irg_entity(irg, ent);
}
*
* @see new_pseudo_ir_graph()
*/
-ir_graph *new_ir_graph (entity *ent, int n_loc);
+ir_graph *new_ir_graph (ir_entity *ent, int n_loc);
/** Frees the passed irgraph.
* Deallocates all nodes in this graph and the ir_graph structure.
/* #define get_irg_entity get_irg_ent */
/* #define set_irg_entity set_irg_ent */
-entity *get_irg_entity (const ir_graph *irg);
-void set_irg_entity (ir_graph *irg, entity *ent);
+ir_entity *get_irg_entity (const ir_graph *irg);
+void set_irg_entity (ir_graph *irg, ir_entity *ent);
ir_type *get_irg_frame_type (ir_graph *irg);
void set_irg_frame_type (ir_graph *irg, ir_type *ftp);
/** ir_graph holds all information for a procedure */
struct ir_graph {
- firm_kind kind; /**< always set to k_ir_graph*/
+ firm_kind kind; /**< always set to k_ir_graph*/
/* -- Basics of the representation -- */
- entity *ent; /**< The entity of this procedure, i.e.,
- the type of the procedure and the
- class it belongs to. */
+ ir_entity *ent; /**< The entity of this procedure, i.e.,
+ the type of the procedure and the
+ class it belongs to. */
ir_type *frame_type; /**< A class type representing the stack frame.
Can include "inner" methods. */
ir_node *anchors[anchor_max]; /**< anchor nodes */
void firm_init_irgraph(void);
/* Internal constructor that does not add to irp_irgs or the like. */
-ir_graph *new_r_ir_graph (entity *ent, int n_loc);
+ir_graph *new_r_ir_graph (ir_entity *ent, int n_loc);
/** Make a rudimentary ir graph for the constant code.
Must look like a correct irg, spare everything else. */
irg->current_block = node;
}
-static INLINE entity *
+static INLINE ir_entity *
_get_irg_entity(const ir_graph *irg) {
assert(irg && irg->ent);
return irg->ent;
}
static INLINE void
-_set_irg_entity(ir_graph *irg, entity *ent) {
+_set_irg_entity(ir_graph *irg, ir_entity *ent) {
irg->ent = ent;
}
if (is_Call(node)) {
int i;
for (i = get_Call_n_callees(node) - 1; i >= 0; --i) {
- entity * ent = get_Call_callee(node, i);
+ ir_entity * ent = get_Call_callee(node, i);
ir_graph * irg = get_entity_irg(ent);
if (irg && !eset_contains(irg_set, irg)) {
eset_insert(irg_set, irg);
/**
* Walk to all constant expressions in this entity.
*/
-static void walk_entity(entity *ent, void *env)
+static void walk_entity(ir_entity *ent, void *env)
{
walk_env *my_env = (walk_env *)env;
/** This hook is called, after a new graph was created and before the first block
* on this graph is build. */
- void (*_hook_new_graph)(void *context, ir_graph *irg, entity *ent);
+ void (*_hook_new_graph)(void *context, ir_graph *irg, ir_entity *ent);
/** This hook is called before a graph is freed. */
void (*_hook_free_graph)(void *context, ir_graph *irg);
void (*_hook_new_mode)(void *context, const ir_mode *tmpl, ir_mode *mode);
/** This hook is called after a new entity was created. */
- void (*_hook_new_entity)(void *context, entity *ent);
+ void (*_hook_new_entity)(void *context, ir_entity *ent);
/** This hook is called after a new type was created. */
void (*_hook_new_type)(void *context, ir_type *tp);
/* Only to access SymConst of kind symconst_addr_ent. Else assertion: */
-entity *get_SymConst_entity (ir_node *node) {
+ir_entity *get_SymConst_entity (ir_node *node) {
assert(node->op == op_SymConst && SYMCONST_HAS_ENT(get_SymConst_kind(node)));
return node->attr.symc.sym.entity_p;
}
-void set_SymConst_entity (ir_node *node, entity *ent) {
+void set_SymConst_entity (ir_node *node, ir_entity *ent) {
assert(node->op == op_SymConst && SYMCONST_HAS_ENT(get_SymConst_kind(node)));
node->attr.symc.sym.entity_p = ent;
}
set_irn_n(node, pos + SEL_INDEX_OFFSET, index);
}
-entity *
+ir_entity *
get_Sel_entity (ir_node *node) {
assert(node->op == op_Sel);
return node->attr.sel.ent;
}
void
-set_Sel_entity (ir_node *node, entity *ent) {
+set_Sel_entity (ir_node *node, ir_entity *ent) {
assert(node->op == op_Sel);
node->attr.sel.ent = ent;
}
return ARR_LEN(node->attr.call.callee_arr);
}
-entity * get_Call_callee(ir_node * node, int pos) {
+ir_entity * get_Call_callee(ir_node * node, int pos) {
assert(pos >= 0 && pos < get_Call_n_callees(node));
return node->attr.call.callee_arr[pos];
}
-void set_Call_callee_arr(ir_node * node, const int n, entity ** arr) {
+void set_Call_callee_arr(ir_node * node, const int n, ir_entity ** arr) {
assert(node->op == op_Call);
if (node->attr.call.callee_arr == NULL || get_Call_n_callees(node) != n) {
- node->attr.call.callee_arr = NEW_ARR_D(entity *, current_ir_graph->obst, n);
+ node->attr.call.callee_arr = NEW_ARR_D(ir_entity *, current_ir_graph->obst, n);
}
- memcpy(node->attr.call.callee_arr, arr, n * sizeof(entity *));
+ memcpy(node->attr.call.callee_arr, arr, n * sizeof(ir_entity *));
}
void remove_Call_callee_arr(ir_node * node) {
}
/* Return the entity attribute of a node n (SymConst, Sel) or NULL. */
-entity *(get_irn_entity_attr)(ir_node *node) {
+ir_entity *(get_irn_entity_attr)(ir_node *node) {
return _get_irn_entity_attr(node);
}
}
/** Return the attribute entity of a SymConst node if exists */
-static entity *get_SymConst_attr_entity(ir_node *self) {
+static ir_entity *get_SymConst_attr_entity(ir_node *self) {
symconst_kind kind = get_SymConst_kind(self);
if (SYMCONST_HAS_ENT(kind))
return get_SymConst_entity(self);
}
/** the get_entity_attr operation must be always implemented */
-static entity *get_Null_ent(ir_node *n) {
+static ir_entity *get_Null_ent(ir_node *n) {
return NULL;
}
typedef union symconst_symbol {
ir_type *type_p; /**< the type of a symconst */
ident *ident_p; /**< the ident of a symconst */
- entity *entity_p; /**< the entity of a symconst */
+ ir_entity *entity_p; /**< the entity of a symconst */
ir_enum_const *enum_p; /**< the enumeration constant of a symconst */
} symconst_symbol;
void set_SymConst_name(ir_node *node, ident *name);
/** Only to access SymConst of kind addr_ent. Else assertion: */
-entity *get_SymConst_entity(ir_node *node);
-void set_SymConst_entity(ir_node *node, entity *ent);
+ir_entity *get_SymConst_entity(ir_node *node);
+void set_SymConst_entity(ir_node *node, ir_entity *ent);
/** Only to access SymConst of kind symconst_enum_const. Else assertion: */
ir_enum_const *get_SymConst_enum(ir_node *node);
ir_type *get_SymConst_value_type(ir_node *node);
void set_SymConst_value_type(ir_node *node, ir_type *tp);
-ir_node *get_Sel_mem(ir_node *node);
-void set_Sel_mem(ir_node *node, ir_node *mem);
-ir_node *get_Sel_ptr(ir_node *node); /* ptr to the object to select from */
-void set_Sel_ptr(ir_node *node, ir_node *ptr);
-ir_node **get_Sel_index_arr(ir_node *node);
-int get_Sel_n_indexs(ir_node *node);
-ir_node *get_Sel_index(ir_node *node, int pos);
-void set_Sel_index(ir_node *node, int pos, ir_node *index);
-entity *get_Sel_entity(ir_node *node); /* entity to select */
-void set_Sel_entity (ir_node *node, entity *ent);
+ir_node *get_Sel_mem(ir_node *node);
+void set_Sel_mem(ir_node *node, ir_node *mem);
+ir_node *get_Sel_ptr(ir_node *node); /* ptr to the object to select from */
+void set_Sel_ptr(ir_node *node, ir_node *ptr);
+ir_node **get_Sel_index_arr(ir_node *node);
+int get_Sel_n_indexs(ir_node *node);
+ir_node *get_Sel_index(ir_node *node, int pos);
+void set_Sel_index(ir_node *node, int pos, ir_node *index);
+ir_entity *get_Sel_entity(ir_node *node); /* entity to select */
+void set_Sel_entity (ir_node *node, ir_entity *ent);
/**
* Projection numbers for result of Call node: use for Proj nodes!
*
* @param node A Call node.
*/
-int Call_has_callees(ir_node *node);
-int get_Call_n_callees(ir_node *node);
-entity *get_Call_callee(ir_node *node, int pos);
+int Call_has_callees(ir_node *node);
+int get_Call_n_callees(ir_node *node);
+ir_entity *get_Call_callee(ir_node *node, int pos);
/** Set the full callee array.
*
* The passed array is copied. Assumes current_ir_graph set properly! */
-void set_Call_callee_arr(ir_node *node, const int n, entity **arr);
+void set_Call_callee_arr(ir_node *node, const int n, ir_entity **arr);
void remove_Call_callee_arr(ir_node *node);
ir_node *get_CallBegin_ptr(ir_node *node);
ir_type *get_irn_type_attr(ir_node *n);
/** Return the entity attribute of a node n (SymConst, Sel) or NULL. */
-entity *get_irn_entity_attr(ir_node *n);
+ir_entity *get_irn_entity_attr(ir_node *n);
/** Returns non-zero for constant-like nodes. */
int is_irn_constlike(const ir_node *node);
/** Sel attributes. */
typedef struct {
- entity *ent; /**< entity to select */
+ ir_entity *ent; /**< entity to select */
} sel_attr;
/** Exception attributes. */
typedef struct {
except_attr exc; /**< the exception attribute. MUST be the first one. */
ir_type *cld_tp; /**< type of called procedure */
- entity ** callee_arr; /**< result of callee analysis */
+ ir_entity ** callee_arr; /**< result of callee analysis */
} call_attr;
/** Alloc attributes. */
return _get_irn_op(node)->ops.get_type_attr(node);
}
-static INLINE entity *_get_irn_entity_attr(ir_node *node) {
+static INLINE ir_entity *_get_irn_entity_attr(ir_node *node) {
return _get_irn_op(node)->ops.get_entity_attr(node);
}
* accessed from an ir_graph.
* Return the entity attribute of the node self.
*/
-typedef entity *(*get_entity_attr_func)(ir_node *self);
+typedef ir_entity *(*get_entity_attr_func)(ir_node *self);
/**
* The verify_node operation.
* Return the value of a 'sizeof' or 'alignof' SymConst.
*/
static tarval *computed_value_SymConst(ir_node *n) {
- ir_type *type;
- entity *ent;
+ ir_type *type;
+ ir_entity *ent;
switch (get_SymConst_kind(n)) {
case symconst_type_size:
fprintf(stderr, "\nFIRM: irn_vrfy_irg() <of CONST_CODE_IRG> failed\n");
}
else {
- entity *ent = get_irg_entity(irg);
+ ir_entity *ent = get_irg_entity(irg);
if (ent) {
ir_type *ent_type = get_entity_owner(ent);
/**
* Prints a failure message for a proj
*/
-static void show_proj_failure_ent(ir_node *n, entity *ent)
+static void show_proj_failure_ent(ir_node *n, ir_entity *ent)
{
ir_node *op = get_Proj_pred(n);
int proj = get_Proj_proj(n);
*/
static void show_return_modes(ir_graph *irg, ir_node *n, ir_type *mt, int i)
{
- entity *ent = get_irg_entity(irg);
+ ir_entity *ent = get_irg_entity(irg);
show_entity_failure(n);
fprintf(stderr, " Return node %ld in entity \"%s\" mode %s different from type mode %s\n",
*/
static void show_return_nres(ir_graph *irg, ir_node *n, ir_type *mt)
{
- entity *ent = get_irg_entity(irg);
+ ir_entity *ent = get_irg_entity(irg);
show_entity_failure(n);
fprintf(stderr, " Return node %ld in entity \"%s\" has %d results different from type %d\n",
}
/** If the address is Sel or SymConst, return the entity. */
-static entity *get_ptr_entity(ir_node *ptr) {
+static ir_entity *get_ptr_entity(ir_node *ptr) {
if (get_irn_op(ptr) == op_Sel) {
return get_Sel_entity(ptr);
} else if ((get_irn_op(ptr) == op_SymConst) && (get_SymConst_kind(ptr) == symconst_addr_ent)) {
if (proj == pn_Load_res) {
ir_node *ptr = get_Load_ptr(n);
- entity *ent = get_ptr_entity(ptr);
+ ir_entity *ent = get_ptr_entity(ptr);
if (vrfy_entities && ent && get_irg_phase_state(current_ir_graph) == phase_high) {
/* do NOT check this for lowered phases, see comment on Store */
ir_mode *mymode = get_irn_mode(n);
if (get_SymConst_kind(n) == symconst_addr_ent) {
- entity *ent = get_SymConst_entity(n);
+ ir_entity *ent = get_SymConst_entity(n);
if (is_Method_type(get_entity_type(ent)) &&
get_irn_irg(n) != get_const_code_irg()) {
#if 1
ir_mode *mymode = get_irn_mode(n);
ir_mode *op1mode = get_irn_mode(get_Sel_mem(n));
ir_mode *op2mode = get_irn_mode(get_Sel_ptr(n));
- entity *ent;
+ ir_entity *ent;
ASSERT_AND_RET_DBG(
/* Sel: BB x M x ref x int^n --> ref */
* mode_T
*
{
- entity *ent = hunt_for_entity (get_Load_ptr (n), n);
+ ir_entity *ent = hunt_for_entity (get_Load_ptr (n), n);
assert ((NULL != ent) || (mymode != mode_T));
}
*/
* verify a Store node
*/
static int verify_node_Store(ir_node *n, ir_graph *irg) {
- entity *target;
+ ir_entity *target;
ir_mode *mymode = get_irn_mode(n);
ir_mode *op1mode = get_irn_mode(get_Store_mem(n));
current_ir_graph = rem;
if (get_node_verification_mode() == FIRM_VERIFICATION_REPORT && ! res) {
- entity *ent = get_irg_entity(current_ir_graph);
+ ir_entity *ent = get_irg_entity(current_ir_graph);
if (ent)
fprintf(stderr, "irg_verify: Verifying graph %s failed\n", get_entity_name(ent));
* optimized. Pseudo graphs are kept in a separate graph list in irprog.
*/
ir_graph *
-new_pseudo_ir_graph(entity *ent, int n_loc) {
+new_pseudo_ir_graph(ir_entity *ent, int n_loc) {
ir_graph *res = new_r_ir_graph (ent, n_loc);
add_irp_pseudo_irg(res); /* remember this graph global. */
return res;
* The pseudo representation can only be used for analyses. It may not be
* optimized. Pseudo graphs are kept in a separate graph list in irprog.
*/
-ir_graph *new_pseudo_ir_graph(entity *ent, int n_loc);
+ir_graph *new_pseudo_ir_graph(ir_entity *ent, int n_loc);
/** Returns non-zero ir ir_graph is pseudo graph.
* Is irg a pseudo graph for analysis? */
*/
static int is_compound_address(ir_type *ft, ir_node *adr)
{
- entity *ent;
+ ir_entity *ent;
if (! is_Sel(adr))
return 0;
/** A pair for the copy-return-optimization. */
typedef struct cr_pair {
- entity *ent; /**< the entity than can be removed from the frame */
+ ir_entity *ent; /**< the entity than can be removed from the frame */
ir_node *arg; /**< the argument that replaces the entities address */
} cr_pair;
int i;
if (is_Sel(n)) {
- entity *ent = get_Sel_entity(n);
+ ir_entity *ent = get_Sel_entity(n);
for (i = ARR_LEN(arr) - 1; i >= 0; --i) {
if (ent == arr[i].ent) {
*/
static ir_node *get_dummy_sel(ir_graph *irg, ir_node *block, ir_type *tp, wlk_env *env)
{
- entity *ent;
+ ir_entity *ent;
pmap_entry *e;
/* use a map the check if we already create such an entity */
static void add_hidden_param(ir_graph *irg, int n_com, ir_node **ins, cl_entry *entry, wlk_env *env)
{
ir_node *p, *n, *src, *mem;
- entity *ent;
+ ir_entity *ent;
ir_type *owner;
int idx, n_args;
*/
static void transform_irg(const lower_params_t *lp, ir_graph *irg)
{
- entity *ent = get_irg_entity(irg);
+ ir_entity *ent = get_irg_entity(irg);
ir_type *mtp, *lowered_mtp, *tp, *ft;
int i, j, k, n_ress = 0, n_ret_com = 0, n_cr_opt;
ir_node **new_in, *ret, *endbl, *bl, *mem, *copy;
/* fix method entities */
if (is_entity(tore)) {
- entity *ent = (entity *)tore;
+ ir_entity *ent = (ir_entity *)tore;
tp = get_entity_type(ent);
if (must_be_lowered(lp, tp)) {
const ir_op *op; /**< the op */
const ir_mode *imode; /**< the input mode */
const ir_mode *omode; /**< the output mode */
- entity *ent; /**< the associated entity of this (op, imode, omode) triple */
+ ir_entity *ent; /**< the associated entity of this (op, imode, omode) triple */
} op_mode_entry_t;
/**
ir_mode *imode, ir_mode *omode,
ir_node *block, lower_env_t *env) {
symconst_symbol sym;
- entity *ent;
+ ir_entity *ent;
op_mode_entry_t key, *entry;
key.op = op;
* Translate a Return.
*/
static void lower_Return(ir_node *node, ir_mode *mode, lower_env_t *env) {
- ir_graph *irg = current_ir_graph;
- entity *ent = get_irg_entity(irg);
- ir_type *mtp = get_entity_type(ent);
- ir_node **in;
- int i, j, n, idx;
- int need_conv = 0;
+ ir_graph *irg = current_ir_graph;
+ ir_entity *ent = get_irg_entity(irg);
+ ir_type *mtp = get_entity_type(ent);
+ ir_node **in;
+ int i, j, n, idx;
+ int need_conv = 0;
/* check if this return must be lowered */
for (i = 0, n = get_Return_n_ress(node); i < n; ++i) {
* Translate the parameters.
*/
static void lower_Start(ir_node *node, ir_mode *mode, lower_env_t *env) {
- ir_graph *irg = current_ir_graph;
- entity *ent = get_irg_entity(irg);
- ir_type *tp = get_entity_type(ent);
- ir_type *mtp;
- long *new_projs;
- int i, j, n_params, rem;
- ir_node *proj, *args;
+ ir_graph *irg = current_ir_graph;
+ ir_entity *ent = get_irg_entity(irg);
+ ir_type *tp = get_entity_type(ent);
+ ir_type *mtp;
+ long *new_projs;
+ int i, j, n_params, rem;
+ ir_node *proj, *args;
if (is_lowered_type(tp)) {
mtp = get_associated_type(tp);
} /* lower_dw_ops */
/* Default implementation. */
-entity *def_create_intrinsic_fkt(ir_type *method, const ir_op *op,
- const ir_mode *imode, const ir_mode *omode,
- void *context)
+ir_entity *def_create_intrinsic_fkt(ir_type *method, const ir_op *op,
+ const ir_mode *imode, const ir_mode *omode,
+ void *context)
{
char buf[64];
ident *id;
- entity *ent;
+ ir_entity *ent;
if (imode == omode) {
snprintf(buf, sizeof(buf), "__l%s%s", get_op_name(op), get_mode_name(imode));
* @param omode the output mode of the emulated opcode
* @param context the context parameter
*/
-typedef entity *(create_intrinsic_fkt)(ir_type *method, const ir_op *op,
- const ir_mode *imode, const ir_mode *omode,
- void *context);
+typedef ir_entity *(create_intrinsic_fkt)(ir_type *method, const ir_op *op,
+ const ir_mode *imode, const ir_mode *omode,
+ void *context);
/**
* The lowering parameter description.
/**
* Default implementation. Context is unused.
*/
-entity *def_create_intrinsic_fkt(ir_type *method, const ir_op *op,
- const ir_mode *imode, const ir_mode *omode,
- void *context);
+ir_entity *def_create_intrinsic_fkt(ir_type *method, const ir_op *op,
+ const ir_mode *imode, const ir_mode *omode,
+ void *context);
#endif /* _FIRM_LOWER_DW_H */
ir_node *symconst;
pmap_entry *p;
const i_call_record *r;
- entity *ent;
+ ir_entity *ent;
symconst = get_Call_ptr(node);
if (get_irn_op(symconst) != op_SymConst ||
*/
typedef struct _i_call_record {
enum ikind kind; /**< must be INTRINSIC_CALL */
- entity *i_ent; /**< the entity representing an intrinsic call */
+ ir_entity *i_ent; /**< the entity representing an intrinsic call */
i_mapper_func i_mapper; /**< the mapper function to call */
void *ctx; /**< mapper context */
void *link; /**< used in the construction algorithm, must be NULL */
* A runtime routine description.
*/
typedef struct _runtime_rt {
- entity *ent; /**< The entity representing the runtime routine. */
- ir_mode *mode; /**< The operation mode of the mapped instruction. */
- long mem_proj_nr; /**< if >= 0, create a memory ProjM() */
- long exc_proj_nr; /**< if >= 0, create a exception ProjX() */
- long exc_mem_proj_nr; /**< if >= 0, create a exception memory ProjM() */
- long res_proj_nr; /**< if >= 0, first result projection number */
+ ir_entity *ent; /**< The entity representing the runtime routine. */
+ ir_mode *mode; /**< The operation mode of the mapped instruction. */
+ long mem_proj_nr; /**< if >= 0, create a memory ProjM() */
+ long exc_proj_nr; /**< if >= 0, create a exception ProjX() */
+ long exc_mem_proj_nr; /**< if >= 0, create a exception memory ProjM() */
+ long res_proj_nr; /**< if >= 0, first result projection number */
} runtime_rt;
/**
};
/** remove tarval representing an entity that is about to be destroyed */
-void free_tarval_entity(entity *ent);
+void free_tarval_entity(ir_entity *ent);
/* inline functions */
/*