07 May 2019 12:10:41 UTC
- Distribution: B-C
- Module version: 1.05
- Source (raw)
- Browse (raw)
- How to Contribute
- Clone repository
- Issues (76)
- Testers (91 / 247 / 0)
- KwaliteeBus factor: 1
- % Coverage
- License: perl_5
- Activity24 month
- Download (2.04MB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version
B::Bblock - Walk basic blocks
# External interface perl -MO=Bblock[,OPTIONS] foo.pl perl -MO=Bblock foo.pl prints the basic block for main_root perl -MO=Bblock,foo::mysub foo.pm prints the basic block for &pkg::mysub perl -MO=Bblock,mysub foo.pm prints the basic block for &main::mysub # Programmatic API use B::Bblock qw(find_leaders); my $leaders = find_leaders($root_op, $start_op);
This module is used by the B::CC backend. It walks "basic blocks". A basic block is a series of operations which is known to execute from start to finish, with no possibility of branching or halting.
The block is the list of ops from the every leader up to the next. The leaders are the separator of each basic block.
The module can be used either stand alone or from inside another program. Standalone it just prints the basic blocks ops in B::Concise. terse format to STDOUT. Without options it starts at the main_root.
Basic block leaders are:
Any COP (pp_nextstate) with a non-NULL label. [The op after a pp_enter] Omit [The op after a pp_entersub. Don't count this one.] The ops pointed at by nextop, redoop and lastop->op_next of a LOOP. The ops pointed at by op_next and op_other of a LOGOP, except for pp_entertry which has op_next and op_other->op_next The op pointed at by op_pmreplstart of a PMOP. The op pointed at by op_other->op_pmreplstart of pp_substcont? [The op after a pp_return] Omit
A comma-separated list of sub names to walk.
my $leaders = find_leaders($root_op, $start_op);
Given the root of the op tree and an op from which to start processing, it will return a hash ref representing all the ops which start a block.
The values of %$leaders are the op objects themselves. Keys are $$op addresses.
MICB at cpan.org(retired), Reini Urban