Skip to content

Commit

Permalink
Pass function calls from each cfg object
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcere committed Nov 13, 2024
1 parent 53c9451 commit 7bdb65b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/cfg_methods/sub_block_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@ def split_blocks_cfg(cfg: CFG) -> None:
Splits the blocks in the cfg
"""
for object_id, cfg_object in cfg.objectCFG.items():
modify_block_list_split(cfg_object.blocks)
function_names = list(cfg_object.functions.keys())
modify_block_list_split(cfg_object.blocks, function_names)

# We also consider the information per function
for function_name, cfg_function in cfg_object.functions.items():
modify_block_list_split(cfg_function.blocks)
modify_block_list_split(cfg_function.blocks, function_names)

sub_object = cfg.get_subobject()

if sub_object is not None:
split_blocks_cfg(sub_object)


def modify_block_list_split(block_list: CFGBlockList) -> None:
def modify_block_list_split(block_list: CFGBlockList, function_calls: List[function_name_T]) -> None:
"""
Modifies a CFGBlockList by splitting blocks when function calls and split instructions are found
"""
Expand All @@ -46,7 +47,7 @@ def modify_block_list_split(block_list: CFGBlockList) -> None:
instr = current_block.get_instructions()[instr_idx]

is_split_instr = instr.get_op_name() in constants.split_block
is_function_call = instr.get_op_name() in cfg_block.function_calls
is_function_call = instr.get_op_name() in function_calls

if is_split_instr or is_function_call:
# Sub blocks contain a split instruction or a function call as the last instruction
Expand Down

0 comments on commit 7bdb65b

Please sign in to comment.