/*
- * Project: libFIRM
- * File name: ir/ana/trouts.c
- * Purpose: Reverse edges that reference types/entities.
- * Author: Goetz Lindenmaier
- * Modified by:
- * Created: 29.10.2004
- * CVS-ID: $Id$
- * Copyright: (c) 2004 Universität Karlsruhe
- * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
+ * Copyright (C) 1995-2007 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 Reverse edges that reference types/entities.
+ * @author Goetz Lindenmaier
+ * @date 29.10.2004
+ * @version $Id$
+ */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "irnode.h"
#include "trouts.h"
#include "array.h"
#include "irprog_t.h"
#include "irgwalk.h"
+#include "irnode.h"
/*------------------------------------------------------------------*/
* Return a flexible array containing all IR-nodes
* that access a given entity.
*/
-static ir_node **get_entity_access_array(entity *ent) {
+static ir_node **get_entity_access_array(ir_entity *ent) {
ir_node **res;
if (!entity_access_map) entity_access_map = pmap_create();
return res;
}
-void set_entity_access_array(entity *ent, ir_node **accs) {
+void set_entity_access_array(ir_entity *ent, ir_node **accs) {
ir_node **old = pmap_get(entity_access_map, (void *)ent);
if (old != accs)
pmap_insert(entity_access_map, (void *)ent, (void *)accs);
* Return a flexible array containing all IR-nodes
* that reference a given entity.
*/
-static ir_node **get_entity_reference_array(entity *ent) {
+static ir_node **get_entity_reference_array(ir_entity *ent) {
ir_node **res;
if (!entity_reference_map) entity_reference_map = pmap_create();
return res;
}
-void set_entity_reference_array(entity *ent, ir_node **refs) {
+void set_entity_reference_array(ir_entity *ent, ir_node **refs) {
ir_node **old = pmap_get(entity_reference_map, (void *)ent);
if (old != refs)
pmap_insert(entity_reference_map, (void *)ent, (void *)refs);
/* Access routines for entities */
/**------------------------------------------------------------------*/
-int get_entity_n_accesses(entity *ent) {
+int get_entity_n_accesses(ir_entity *ent) {
ir_node ** accs;
assert(ent && is_entity(ent));
return ARR_LEN(accs);
}
-ir_node *get_entity_access(entity *ent, int pos) {
+ir_node *get_entity_access(ir_entity *ent, int pos) {
ir_node ** accs;
assert(0 <= pos && pos < get_entity_n_accesses(ent));
return accs[pos];
}
-void add_entity_access(entity *ent, ir_node *n) {
+void add_entity_access(ir_entity *ent, ir_node *n) {
ir_node ** accs;
assert(ent && is_entity(ent));
set_entity_access_array(ent, accs);
}
-void set_entity_access(entity *ent, int pos, ir_node *n) {
+void set_entity_access(ir_entity *ent, int pos, ir_node *n) {
ir_node ** accs;
assert(0 <= pos && pos < get_entity_n_accesses(ent));
/**------------------------------------------------------------------*/
-int get_entity_n_references(entity *ent) {
+int get_entity_n_references(ir_entity *ent) {
ir_node ** refs;
assert(ent && is_entity(ent));
return ARR_LEN(refs);
}
-ir_node *get_entity_reference(entity *ent, int pos) {
+ir_node *get_entity_reference(ir_entity *ent, int pos) {
ir_node ** refs;
assert(0 <= pos && pos < get_entity_n_references(ent));
return refs[pos];
}
-void add_entity_reference(entity *ent, ir_node *n) {
+void add_entity_reference(ir_entity *ent, ir_node *n) {
ir_node ** refs;
assert(ent && is_entity(ent));
set_entity_reference_array(ent, refs);
}
-void set_entity_reference(entity *ent, int pos, ir_node *n) {
+void set_entity_reference(ir_entity *ent, int pos, ir_node *n) {
ir_node ** refs;
assert(0 <= pos && pos < get_entity_n_references(ent));
/** The number of entities that can be accessed by this Sel node. */
static int get_Sel_n_accessed_entities(ir_node *sel) {
- return 1;
+ (void) sel;
+ return 1;
}
/** The entity that cat be accessed by this Sel node. */
-static entity *get_Sel_accessed_entity(ir_node *sel) {
+static ir_entity *get_Sel_accessed_entity(ir_node *sel) {
return get_Sel_entity(sel);
}
/** An addr node is a SymConst or a Sel.
If Sel follow to outermost of compound. */
-static entity *get_addr_entity(ir_node *addr, int pos) {
- entity *ent;
+static ir_entity *get_addr_entity(ir_node *addr, int pos) {
+ ir_entity *ent;
switch (get_irn_opcode(addr)) {
case iro_Sel:
int i, n_ents;
ir_node *addr;
+ (void) env;
if (get_irn_op(n) == op_Alloc) {
add_type_alloc(get_Alloc_type(n), n);
return;
n_ents = get_addr_n_entities(addr); /* == 1 */
for (i = 0; i < n_ents; ++i) {
- entity *ent = get_addr_entity(addr, i);
+ ir_entity *ent = get_addr_entity(addr, i);
if (ent)
add_entity_access(ent, n);
//else