projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
use tv_t.h instead of tv.h
[libfirm]
/
ir
/
ir
/
irprog.c
diff --git
a/ir/ir/irprog.c
b/ir/ir/irprog.c
index
1e58c68
..
b30dac8
100644
(file)
--- a/
ir/ir/irprog.c
+++ b/
ir/ir/irprog.c
@@
-11,10
+11,12
@@
*/
#ifdef HAVE_CONFIG_H
*/
#ifdef HAVE_CONFIG_H
-# include
<config.h>
+# include
"config.h"
#endif
#endif
+#ifdef HAVE_STRING_H
# include <string.h>
# include <string.h>
+#endif
# include "irprog_t.h"
# include "irgraph_t.h"
# include "irprog_t.h"
# include "irgraph_t.h"
@@
-28,14
+30,14
@@
/* A variable from where everything in the ir can be accessed. */
ir_prog *irp;
/* A variable from where everything in the ir can be accessed. */
ir_prog *irp;
-ir_prog *get_irp() { return irp; }
+ir_prog *get_irp(
void
) { return irp; }
/* initializes ir_prog. Calles the constructor for an ir_prog. */
void init_irprog(void) {
new_ir_prog ();
}
/* initializes ir_prog. Calles the constructor for an ir_prog. */
void init_irprog(void) {
new_ir_prog ();
}
-
INLINE
void remove_irp_type_from_list (type *typ) {
+void remove_irp_type_from_list (type *typ) {
int i;
assert(typ);
#if 0
int i;
assert(typ);
#if 0
@@
-45,7
+47,7
@@
INLINE void remove_irp_type_from_list (type *typ) {
#endif
if (irp->types[i] == typ) {
for(; i < (ARR_LEN (irp->types)) - 1; i++) {
#endif
if (irp->types[i] == typ) {
for(; i < (ARR_LEN (irp->types)) - 1; i++) {
- irp->types[i] = irp->types[i+1];
+
irp->types[i] = irp->types[i+1];
}
ARR_SETLEN(type*, irp->types, (ARR_LEN(irp->types)) - 1);
break;
}
ARR_SETLEN(type*, irp->types, (ARR_LEN(irp->types)) - 1);
break;
@@
-58,10
+60,10
@@
INLINE void remove_irp_type_from_list (type *typ) {
ir_prog *new_ir_prog (void) {
ir_prog *res;
ir_prog *new_ir_prog (void) {
ir_prog *res;
- res =
(ir_prog *) malloc (sizeof(ir_prog
));
- memset(res, 0, sizeof(res));
+ res =
xmalloc (sizeof(*res
));
+ memset(res, 0, sizeof(
*
res));
irp = res;
irp = res;
- /* res->obst =
(struct obstack *) xmalloc (sizeof (struct obstack
)); */
+ /* res->obst =
xmalloc (sizeof(*res->obst
)); */
res->graphs = NEW_ARR_F (ir_graph *, 0);
res->pseudo_graphs = NEW_ARR_F (ir_graph *, 0);
res->types = NEW_ARR_F (type *, 0);
res->graphs = NEW_ARR_F (ir_graph *, 0);
res->pseudo_graphs = NEW_ARR_F (ir_graph *, 0);
res->types = NEW_ARR_F (type *, 0);
@@
-78,15
+80,17
@@
ir_prog *new_ir_prog (void) {
res->const_code_irg = new_const_code_irg();
res->const_code_irg = new_const_code_irg();
- res->outs_state = outs_none;
- res->ip_outedges = NULL;
+ res->outs_state = outs_none;
+ res->ip_outedges = NULL;
+ res->trouts_state = outs_none;
+ res->class_cast_state = ir_class_casts_transitive;
return res;
}
/* frees all memory used by irp. Types in type list, irgs in irg
list and entities in global type must be freed by hand before. */
return res;
}
/* frees all memory used by irp. Types in type list, irgs in irg
list and entities in global type must be freed by hand before. */
-void free_ir_prog() {
+void free_ir_prog(
void
) {
free_type(irp->glob_type);
/* @@@ * free_ir_graph(irp->const_code_irg); * ?? End has no in?? */
DEL_ARR_F(irp->graphs);
free_type(irp->glob_type);
/* @@@ * free_ir_graph(irp->const_code_irg); * ?? End has no in?? */
DEL_ARR_F(irp->graphs);
@@
-100,7
+104,7
@@
void free_ir_prog() {
/* Access the main routine of the compiled program. */
/* Access the main routine of the compiled program. */
-ir_graph *get_irp_main_irg() {
+ir_graph *get_irp_main_irg(
void
) {
assert (irp);
return irp->main_irg;
}
assert (irp);
return irp->main_irg;
}
@@
-122,15
+126,14
@@
void add_irp_irg(ir_graph *irg) {
}
/* Removes irg from the list or irgs, shrinks the list by one. */
}
/* Removes irg from the list or irgs, shrinks the list by one. */
-void remove_irp_irg(ir_graph *irg){
+void remove_irp_irg
_from_list
(ir_graph *irg){
int i, found = false;
assert(irg);
int i, found = false;
assert(irg);
- free_ir_graph(irg);
for (i = 0; i < (ARR_LEN (irp->graphs)); i++) {
if (irp->graphs[i] == irg) {
found = true;
for(; i < (ARR_LEN (irp->graphs)) - 1; i++) {
for (i = 0; i < (ARR_LEN (irp->graphs)); i++) {
if (irp->graphs[i] == irg) {
found = true;
for(; i < (ARR_LEN (irp->graphs)) - 1; i++) {
- irp->graphs[i] = irp->graphs[i+1];
+
irp->graphs[i] = irp->graphs[i+1];
}
ARR_SETLEN(ir_graph*, irp->graphs, (ARR_LEN(irp->graphs)) - 1);
break;
}
ARR_SETLEN(ir_graph*, irp->graphs, (ARR_LEN(irp->graphs)) - 1);
break;
@@
-139,16
+142,23
@@
void remove_irp_irg(ir_graph *irg){
if (!found) {
for (i = 0; i < (ARR_LEN (irp->pseudo_graphs)); i++) {
if (irp->pseudo_graphs[i] == irg) {
if (!found) {
for (i = 0; i < (ARR_LEN (irp->pseudo_graphs)); i++) {
if (irp->pseudo_graphs[i] == irg) {
- for(; i < (ARR_LEN (irp->pseudo_graphs)) - 1; i++) {
- irp->pseudo_graphs[i] = irp->pseudo_graphs[i+1];
- }
- ARR_SETLEN(ir_graph*, irp->pseudo_graphs, (ARR_LEN(irp->pseudo_graphs)) - 1);
- break;
+
for(; i < (ARR_LEN (irp->pseudo_graphs)) - 1; i++) {
+
irp->pseudo_graphs[i] = irp->pseudo_graphs[i+1];
+
}
+
ARR_SETLEN(ir_graph*, irp->pseudo_graphs, (ARR_LEN(irp->pseudo_graphs)) - 1);
+
break;
}
}
}
}
}
}
}
}
+/* Removes irg from the list or irgs, shrinks the list by one. */
+void remove_irp_irg(ir_graph *irg){
+ assert(irg);
+ free_ir_graph(irg);
+ remove_irp_irg_from_list(irg);
+}
+
int (get_irp_n_irgs)(void) {
return __get_irp_n_irgs();
}
int (get_irp_n_irgs)(void) {
return __get_irp_n_irgs();
}
@@
-235,6
+245,13
@@
ir_graph *(get_const_code_irg)(void)
return __get_const_code_irg();
}
return __get_const_code_irg();
}
+irg_phase_state get_irp_phase_state(void) {
+ return irp->phase_state;
+}
+void set_irp_phase_state(irg_phase_state s) {
+ irp->phase_state = s;
+}
+
irg_outs_state get_irp_ip_outs_state() {
return irp->outs_state;
}
irg_outs_state get_irp_ip_outs_state() {
return irp->outs_state;
}
@@
-245,12
+262,12
@@
void set_irp_ip_outs_inconsistent() {
void set_irp_ip_outedges(ir_node ** ip_outedges)
{
void set_irp_ip_outedges(ir_node ** ip_outedges)
{
- irp
->
ip_outedges = ip_outedges;
+ irp
->
ip_outedges = ip_outedges;
}
ir_node** get_irp_ip_outedges(void)
{
}
ir_node** get_irp_ip_outedges(void)
{
- return
(irp -> ip_outedges)
;
+ return
irp->ip_outedges
;
}
}