From: Arthur Huillet <arthur.huil...@free.fr> Those functions are to be used by the register allocator when resolving control flow.
Signed-off-by: Arthur Huillet <arthur.huil...@free.fr> --- include/jit/basic-block.h | 2 ++ jit/basic-block.c | 10 ++++++++++ 2 files changed, 12 insertions(+), 0 deletions(-) diff --git a/include/jit/basic-block.h b/include/jit/basic-block.h index 74ee47d..28ca6b2 100644 --- a/include/jit/basic-block.h +++ b/include/jit/basic-block.h @@ -70,6 +70,8 @@ void free_basic_block(struct basic_block *); struct basic_block *bb_split(struct basic_block *, unsigned long); void bb_add_stmt(struct basic_block *, struct statement *); void bb_add_insn(struct basic_block *, struct insn *); +struct insn *bb_first_insn(struct basic_block *); +struct insn *bb_last_insn(struct basic_block *); int bb_add_successor(struct basic_block *, struct basic_block *); int bb_add_mimic_stack_expr(struct basic_block *, struct expression *); struct statement *bb_remove_last_stmt(struct basic_block *bb); diff --git a/jit/basic-block.c b/jit/basic-block.c index bd1cbe1..0a13062 100644 --- a/jit/basic-block.c +++ b/jit/basic-block.c @@ -147,6 +147,16 @@ void bb_add_insn(struct basic_block *bb, struct insn *insn) list_add_tail(&insn->insn_list_node, &bb->insn_list); } +struct insn *bb_first_insn(struct basic_block *bb) +{ + return list_entry(bb->insn_list.next, struct insn, insn_list_node); +} + +struct insn *bb_last_insn(struct basic_block *bb) +{ + return list_entry(bb->insn_list.prev, struct insn, insn_list_node); +} + static int __bb_add_neighbor(void *new, void **array, unsigned long *nb) { unsigned long new_size; -- 1.6.3.3 ------------------------------------------------------------------------------ _______________________________________________ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel