/home/travis/build/MoarVM/MoarVM/src/spesh/iterator.c
Line | Count | Source (jump to first uncovered line) |
1 | | #include "moar.h" |
2 | | |
3 | 11.1k | void MVM_spesh_iterator_init(MVMThreadContext *tc, MVMSpeshIterator *iterator, MVMSpeshGraph *graph) { |
4 | 11.1k | iterator->graph = graph; |
5 | 11.1k | iterator->bb = graph->entry; |
6 | 11.1k | if (graph->entry) |
7 | 11.1k | iterator->ins = graph->entry->first_ins; |
8 | 11.1k | } |
9 | | |
10 | 0 | void MVM_spesh_iterator_copy(MVMThreadContext *tc, MVMSpeshIterator *from, MVMSpeshIterator *to) { |
11 | 0 | memcpy(to, from, sizeof(MVMSpeshIterator)); |
12 | 0 | } |
13 | | |
14 | 1.70M | MVMSpeshIns * MVM_spesh_iterator_next_ins(MVMThreadContext *tc, MVMSpeshIterator *iterator) { |
15 | 1.70M | if (iterator->ins) |
16 | 1.70M | iterator->ins = iterator->ins->next; |
17 | 1.70M | return iterator->ins; |
18 | 1.70M | } |
19 | | |
20 | 307k | MVMSpeshBB * MVM_spesh_iterator_next_bb(MVMThreadContext *tc, MVMSpeshIterator *iterator) { |
21 | 307k | if (iterator->bb) |
22 | 307k | iterator->bb = iterator->bb->linear_next; |
23 | 307k | if (iterator->bb) |
24 | 296k | iterator->ins = iterator->bb->first_ins; |
25 | 307k | return iterator->bb; |
26 | 307k | } |
27 | | |
28 | 0 | void MVM_spesh_iterator_skip_phi(MVMThreadContext *tc, MVMSpeshIterator *iterator) { |
29 | 0 | while (iterator->ins && iterator->ins->info->opcode == MVM_SSA_PHI) { |
30 | 0 | iterator->ins = iterator->ins->next; |
31 | 0 | } |
32 | 0 | } |
33 | | |