projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- Implement all the state switching stuff needed for efficient fpu mode
[libfirm]
/
ir
/
common
/
firm_common.c
diff --git
a/ir/common/firm_common.c
b/ir/common/firm_common.c
index
bcd54f6
..
66069a3
100644
(file)
--- a/
ir/common/firm_common.c
+++ b/
ir/common/firm_common.c
@@
-3,30
+3,33
@@
* File name: ir/common/firm_common.c
* Purpose:
* Author: Martin Trapp, Christian Schaefer
* File name: ir/common/firm_common.c
* Purpose:
* Author: Martin Trapp, Christian Schaefer
- * Modified by: Goetz Lindenmaier
+ * Modified by: Goetz Lindenmaier
, Michael Beck
* Created:
* CVS-ID: $Id$
* Created:
* CVS-ID: $Id$
- * Copyright: (c) 1998-200
3
Universität Karlsruhe
+ * Copyright: (c) 1998-200
6
Universität Karlsruhe
* Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
*/
* Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
*/
-
-
#ifdef HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
-# include
<config.h>
+# include
"config.h"
#endif
#include "firm_common_t.h"
#include "irgraph.h"
#endif
#include "firm_common_t.h"
#include "irgraph.h"
+#include "irloop.h"
+#include "tv.h"
-/* returns the kind of the thing */
-firm_kind
-get_kind (const void *firm_thing) {
- assert (firm_thing);
- return *(firm_kind *)firm_thing;
-}
+/**
+ * Ideally, this macro would check if size bytes could be read at
+ * pointer p. No generic solution.
+ */
+#define POINTER_READ(p, size) (p)
+/* returns the kind of the thing */
+firm_kind get_kind(const void *firm_thing) {
+ return POINTER_READ(firm_thing, sizeof(firm_kind)) ? *(firm_kind *)firm_thing : k_BAD;
+} /* get_kind */
-const char
*
print_firm_kind(void *firm_thing) {
+const char
*
print_firm_kind(void *firm_thing) {
if (! firm_thing)
return "(NULL)";
if (! firm_thing)
return "(NULL)";
@@
-40,23
+43,23
@@
const char* print_firm_kind(void *firm_thing) {
case k_tarval : return "k_tarval";
case k_ir_loop : return "k_ir_loop";
case k_ir_compound_graph_path : return "k_ir_compound_graph_path";
case k_tarval : return "k_tarval";
case k_ir_loop : return "k_ir_loop";
case k_ir_compound_graph_path : return "k_ir_compound_graph_path";
+ case k_ir_extblk : return "k_ir_extblk";
+ case k_ir_prog : return "k_ir_prog";
default: return "";
}
default: return "";
}
-}
+}
/* print_firm_kind */
/*
* identify a firm thing
*/
void firm_identify_thing(void *X)
{
/*
* identify a firm thing
*/
void firm_identify_thing(void *X)
{
- firm_kind *p = X;
-
- if (! p) {
+ if (! X) {
printf("(NULL)\n");
return;
}
printf("(NULL)\n");
return;
}
- switch (
*p
) {
+ switch (
get_kind(X)
) {
case k_BAD:
printf("BAD: (%p)\n", X);
break;
case k_BAD:
printf("BAD: (%p)\n", X);
break;
@@
-67,13
+70,16
@@
void firm_identify_thing(void *X)
printf("type: %s %s: %ld (%p)\n", get_type_tpop_name(X), get_type_name(X), get_type_nr(X), X);
break;
case k_ir_graph:
printf("type: %s %s: %ld (%p)\n", get_type_tpop_name(X), get_type_name(X), get_type_nr(X), X);
break;
case k_ir_graph:
- printf("graph: %s: %ld (%p)\n", get_entity_name(get_irg_ent(X)), get_irg_graph_nr(X), X);
+ printf("graph: %s: %ld (%p)\n", get_entity_name(get_irg_ent
ity
(X)), get_irg_graph_nr(X), X);
break;
case k_ir_node:
printf("irnode: %s%s %ld (%p)\n", get_irn_opname(X), get_mode_name(get_irn_mode(X)), get_irn_node_nr(X), X);
break;
case k_ir_mode:
break;
case k_ir_node:
printf("irnode: %s%s %ld (%p)\n", get_irn_opname(X), get_mode_name(get_irn_mode(X)), get_irn_node_nr(X), X);
break;
case k_ir_mode:
- printf("mode %s: (%p)\n", get_mode_name(X),X);
+ printf("mode %s: (%p)\n", get_mode_name(X), X);
+ break;
+ case k_ir_op:
+ printf("op %s: (%p)\n", get_op_name(X), X);
break;
case k_tarval:
printf("tarval : "); tarval_printf(X); printf(" (%p)\n", X);
break;
case k_tarval:
printf("tarval : "); tarval_printf(X); printf(" (%p)\n", X);
@@
-81,9
+87,16
@@
void firm_identify_thing(void *X)
case k_ir_loop:
printf("loop: with depth %d: (%p)\n", get_loop_depth(X), X);
break;
case k_ir_loop:
printf("loop: with depth %d: (%p)\n", get_loop_depth(X), X);
break;
- case k_ir_op:
case k_ir_compound_graph_path:
case k_ir_compound_graph_path:
+ printf("compound_graph_path: (%p)\n", X);
+ break;
+ case k_ir_extblk:
+ printf("extended block: (%p)\n", X);
+ break;
+ case k_ir_prog:
+ printf("irp: (%p)\n", X);
+ break;
default:
printf("Cannot identify thing at (%p).\n", X);
}
default:
printf("Cannot identify thing at (%p).\n", X);
}
-}
+}
/* firm_identify_thing */