#include <control_flow.hpp>
Definition at line 126 of file control_flow.hpp.
◆ ControlFlow()
| ControlFlow::ControlFlow |
( |
std::vector< std::vector< FuzzInstruction > > & |
instruction_blocks | ) |
|
|
inline |
◆ ~ControlFlow()
| ControlFlow::~ControlFlow |
( |
| ) |
|
|
inline |
◆ build_bytecode()
| std::vector< uint8_t > ControlFlow::build_bytecode |
( |
const ReturnOptions & |
return_options | ) |
|
build the bytecode, finalizing the current block with return
Definition at line 283 of file control_flow.cpp.
◆ dfs_traverse()
traverse the control flow graph using DFS
- Parameters
-
| start_block | the start block |
| reverse | whether to traverse in reverse order. If true, the traversal will go to the predecessors of the current block, otherwise to the successors. |
- Returns
- the list of blocks in the order of traversal
Definition at line 3 of file control_flow.cpp.
◆ get_non_terminated_blocks()
| std::vector< ProgramBlock * > ControlFlow::get_non_terminated_blocks |
( |
| ) |
|
|
private |
◆ get_reachable_blocks()
get the list of blocks which are can be reached from the given block without creating a loop in the graph Also filters out blocks with different caller
Definition at line 183 of file control_flow.cpp.
◆ process_cfg_instruction()
| void ControlFlow::process_cfg_instruction |
( |
CFGInstruction |
instruction | ) |
|
◆ process_finalize_with_return()
terminates the current block with Return and switches to the first non-terminated block
- Note
- if the current block has caller, it inserts INTERNALRETURN only and switches to the caller
- Parameters
-
| instruction | the instruction to process |
Definition at line 129 of file control_flow.cpp.
◆ process_insert_internal_call()
inserts INTERNALCALL instruction to the current block creates a new block and sets it as the current block
- Parameters
-
| instruction | the instruction to process |
Definition at line 157 of file control_flow.cpp.
◆ process_insert_simple_instruction_block()
add instructions to the current block from the instruction block at the given index taken modulo length of the instruction blocks vector
Definition at line 32 of file control_flow.cpp.
◆ process_jump_if_to_block()
| void ControlFlow::process_jump_if_to_block |
( |
JumpIfToBlock |
instruction | ) |
|
|
private |
terminates the current block with a jumpi and jump instructions to the blocks, which does not create a loop in the graph (defined by get_reachable_blocks) and switches the current block to the first block defined by get_non_terminated_blocks
- Parameters
-
| instruction | the instruction to process |
Definition at line 107 of file control_flow.cpp.
◆ process_jump_if_to_new_block()
terminates the current block with a jump if and creates two new blocks, sets the first as the then block and the second as the else block, changes the current block to the then block
- Parameters
-
| instruction | the instruction to process |
Definition at line 64 of file control_flow.cpp.
◆ process_jump_to_block()
| void ControlFlow::process_jump_to_block |
( |
JumpToBlock |
instruction | ) |
|
|
private |
terminates the current block with a jump to the block, which does not create a loop in the graph (defined by get_reachable_blocks) and switches the current block to the first block defined by get_non_terminated_blocks
- Parameters
-
| instruction | the instruction to process |
Definition at line 88 of file control_flow.cpp.
◆ process_jump_to_new_block()
| void ControlFlow::process_jump_to_new_block |
( |
JumpToNewBlock |
instruction | ) |
|
|
private |
terminates the current block with a jump and creates a new block
- Parameters
-
| instruction | the instruction to process |
Definition at line 46 of file control_flow.cpp.
◆ process_switch_to_non_terminated_block()
switches to the non-terminated block with the chosen index
- Parameters
-
| instruction | the instruction to process |
Definition at line 148 of file control_flow.cpp.
◆ current_block
◆ instruction_blocks
| std::vector<std::vector<FuzzInstruction> >* ControlFlow::instruction_blocks |
|
private |
◆ start_block
The documentation for this class was generated from the following files: