Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
64d13bb5
Commit
64d13bb5
authored
Oct 27, 2008
by
Michael Beck
Browse files
- add functions for global (ir_prog) resource management
[r23235]
parent
cab1ee7a
Changes
4
Hide whitespace changes
Inline
Side-by-side
include/libfirm/irprog.h
View file @
64d13bb5
...
...
@@ -93,6 +93,16 @@ typedef struct ir_prog ir_prog;
*/
extern
ir_prog
*
irp
;
#ifndef NDEBUG
void
irp_reserve_resources
(
ir_prog
*
irp
,
ir_resources_t
resources
);
void
irp_free_resources
(
ir_prog
*
irp
,
ir_resources_t
resources
);
ir_resources_t
irp_resources_reserved
(
const
ir_prog
*
irp
);
#else
void
irp_reserve_resources
(
irp
,
resources
)
void
irp_free_resources
(
irp
,
resources
)
ir_resources_t
irp_resources_reserved
(
irp
)
0
#endif
/**
* Returns the access points from where everything in the ir can be accessed.
*
...
...
ir/ir/irgraph.c
View file @
64d13bb5
...
...
@@ -1050,20 +1050,17 @@ void *get_irg_loc_description(ir_graph *irg, int n) {
}
#ifndef NDEBUG
void
ir_reserve_resources
(
ir_graph
*
irg
,
ir_resources_t
resources
)
{
void
ir_reserve_resources
(
ir_graph
*
irg
,
ir_resources_t
resources
)
{
assert
((
irg
->
reserved_resources
&
resources
)
==
0
);
irg
->
reserved_resources
|=
resources
;
}
void
ir_free_resources
(
ir_graph
*
irg
,
ir_resources_t
resources
)
{
void
ir_free_resources
(
ir_graph
*
irg
,
ir_resources_t
resources
)
{
assert
((
irg
->
reserved_resources
&
resources
)
==
resources
);
irg
->
reserved_resources
&=
~
resources
;
}
ir_resources_t
ir_resources_reserved
(
const
ir_graph
*
irg
)
{
ir_resources_t
ir_resources_reserved
(
const
ir_graph
*
irg
)
{
return
irg
->
reserved_resources
;
}
#endif
/* NDEBUG */
...
...
ir/ir/irprog.c
View file @
64d13bb5
...
...
@@ -65,7 +65,10 @@ static ir_prog *new_incomplete_ir_prog(void)
res
->
max_irg_idx
=
0
;
#ifdef DEBUG_libfirm
res
->
max_node_nr
=
0
;
res
->
max_node_nr
=
0
;
#endif
#ifndef NDEBUG
res
->
reserved_resources
=
0
;
#endif
return
res
;
...
...
@@ -430,3 +433,19 @@ ident *get_irp_asm(int pos) {
assert
(
pos
<=
0
&&
pos
<
get_irp_n_asms
());
return
irp
->
global_asms
[
pos
];
}
#ifndef NDEBUG
void
irp_reserve_resources
(
ir_prog
*
irp
,
ir_resources_t
resources
)
{
assert
((
irp
->
reserved_resources
&
resources
)
==
0
);
irp
->
reserved_resources
|=
resources
;
}
void
irp_free_resources
(
ir_prog
*
irp
,
ir_resources_t
resources
)
{
assert
((
irp
->
reserved_resources
&
resources
)
==
resources
);
irp
->
reserved_resources
&=
~
resources
;
}
ir_resources_t
irp_resources_reserved
(
const
ir_prog
*
irp
)
{
return
irp
->
reserved_resources
;
}
#endif
ir/ir/irtypes.h
View file @
64d13bb5
...
...
@@ -509,7 +509,7 @@ struct ir_graph {
#endif
#ifndef NDEBUG
ir_resources_t
reserved_resources
;
/**< Bitset for tracking used resources. */
ir_resources_t
reserved_resources
;
/**< Bitset for tracking used
local
resources. */
#endif
};
...
...
@@ -565,6 +565,9 @@ struct ir_prog {
#ifdef DEBUG_libfirm
long
max_node_nr
;
/**< to generate unique numbers for nodes. */
#endif
#ifndef NDEBUG
ir_resources_t
reserved_resources
;
/**< Bitset for tracking used global resources. */
#endif
};
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment