projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
convert bitfield initializer tarvals before using them
[libfirm]
/
ir
/
tr
/
type_identify.c
diff --git
a/ir/tr/type_identify.c
b/ir/tr/type_identify.c
index
5a74aa0
..
f026b13
100644
(file)
--- a/
ir/tr/type_identify.c
+++ b/
ir/tr/type_identify.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (C) 1995-200
7
University of Karlsruhe. All right reserved.
+ * Copyright (C) 1995-200
8
University of Karlsruhe. All right reserved.
*
* This file is part of libFirm.
*
*
* This file is part of libFirm.
*
@@
-17,30
+17,17
@@
* PURPOSE.
*/
* PURPOSE.
*/
-/*
- * Project: libFIRM
- * File name: ir/tr/type_identify.c
- * Purpose: Representation of types.
- * Author: Goetz Lindenmaier
- * Modified by:
- * Created:
- * CVS-ID: $Id$
- * Copyright: (c) 2001-2003 Universität Karlsruhe
- */
-
/**
/**
- * @file type_identify.c
- *
- * (C) 2004 by Universitaet Karlsruhe
- * Goetz Lindenmaier
- *
+ * @file type_identify.c
+ * @brief Representation of types.
+ * @author Goetz Lindenmaier
+ * @version $Id$
*/
*/
-
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
-#include "type
_identify_t
.h"
+#include "type
rep
.h"
#include <stdlib.h>
#include <stddef.h>
#include <stdlib.h>
#include <stddef.h>
@@
-49,10
+36,8
@@
#include "type_t.h"
#include "tpop_t.h"
#include "irprog_t.h"
#include "type_t.h"
#include "tpop_t.h"
#include "irprog_t.h"
-#include "typegmod.h"
#include "array.h"
#include "irprog_t.h"
#include "array.h"
#include "irprog_t.h"
-#include "mangle.h"
#include "pset.h"
#include "irtools.h"
#include "pset.h"
#include "irtools.h"
@@
-64,80
+49,76
@@
static hash_types_func_t *hash_types_func;
static compare_types_func_t *compare_types_func;
int compare_names (const void *tp1, const void *tp2) {
static compare_types_func_t *compare_types_func;
int compare_names (const void *tp1, const void *tp2) {
- ir_type *t1 = (ir_type *) tp1;
- ir_type *t2 = (ir_type *) tp2;
+
ir_type *t1 = (ir_type *) tp1;
+
ir_type *t2 = (ir_type *) tp2;
- return (t1 != t2 &&
- (t1->type_op != t2->type_op ||
-
t1->name != t2->name )
);
+
return (t1 != t2 &&
+
(t1->type_op != t2->type_op ||
+
t1->name != t2->name )
);
}
/* stuff for comparing two types. */
}
/* stuff for comparing two types. */
-int compare_strict
(const void *tp1, const void *tp2) {
-
ir_type *t1 = (ir_type *)
tp1;
-
ir_type *t2 = (ir_type *)
tp2;
- return t1 != t2;
+int compare_strict(const void *tp1, const void *tp2) {
+
const ir_type *t1 =
tp1;
+
const ir_type *t2 =
tp2;
+
return t1 != t2;
}
/* stuff to compute a hash value for a type. */
}
/* stuff to compute a hash value for a type. */
-int firm_hash_name
(ir_type *tp) {
- unsigned h = (unsigned)PTR_TO_INT(tp->type_op);
- h = 9*h + (unsigned)PTR_TO_INT(tp->name);
- return h;
+int firm_hash_name(ir_type *tp) {
+
unsigned h = (unsigned)PTR_TO_INT(tp->type_op);
+
h = 9*h + (unsigned)PTR_TO_INT(tp->name);
+
return h;
}
/* The function that hashes a type. */
ir_type *mature_type(ir_type *tp) {
}
/* The function that hashes a type. */
ir_type *mature_type(ir_type *tp) {
- ir_type *o;
-
- assert(type_table);
-
- o = pset_insert (type_table, tp, hash_types_func(tp) );
+ ir_type *o;
-
if (!o || o == tp) return tp
;
+
assert(type_table)
;
- exchange_types(tp, o);
+ o = pset_insert (type_table, tp, hash_types_func(tp) );
+ if (!o || o == tp) return tp;
+ exchange_types(tp, o);
- return o;
+
return o;
}
/* The function that hashes a type. */
ir_type *mature_type_free(ir_type *tp) {
}
/* The function that hashes a type. */
ir_type *mature_type_free(ir_type *tp) {
- ir_type *o;
+
ir_type *o;
- assert(type_table);
+
assert(type_table);
- o = pset_insert (type_table, tp, hash_types_func(tp) );
+ o = pset_insert (type_table, tp, hash_types_func(tp) );
+ if (!o || o == tp) return tp;
- if (!o || o == tp) return tp;
+ free_type_entities(tp);
+ free_type(tp);
- free_type_entities(tp);
- free_type(tp);
-
- return o;
+ return o;
}
/* The function that hashes a type. */
ir_type *mature_type_free_entities(ir_type *tp) {
}
/* The function that hashes a type. */
ir_type *mature_type_free_entities(ir_type *tp) {
- ir_type *o;
-
- assert(type_table);
+ ir_type *o;
-
o = pset_insert (type_table, tp, hash_types_func(tp)
);
+
assert(type_table
);
- if (!o || o == tp) return tp;
+ o = pset_insert (type_table, tp, hash_types_func(tp) );
+ if (!o || o == tp) return tp;
- free_type_entities(tp);
- exchange_types(tp, o);
+
free_type_entities(tp);
+
exchange_types(tp, o);
- return o;
+
return o;
}
/* initialize this module */
void init_type_identify(type_identify_if_t *ti_if) {
}
/* initialize this module */
void init_type_identify(type_identify_if_t *ti_if) {
- compare_types_func = ti_if && ti_if->cmp ? ti_if->cmp : compare_strict;
- hash_types_func = ti_if && ti_if->hash ? ti_if->hash : firm_hash_name;
+
compare_types_func = ti_if && ti_if->cmp ? ti_if->cmp : compare_strict;
+
hash_types_func = ti_if && ti_if->hash ? ti_if->hash : firm_hash_name;
- type_table = new_pset (compare_types_func, 8);
+
type_table = new_pset (compare_types_func, 8);
}
}