Skip to content

Commit

Permalink
add func name to identify correct function to analyze
Browse files Browse the repository at this point in the history
  • Loading branch information
Abdalla committed Oct 25, 2024
1 parent 128f616 commit 15b6120
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def _run_inliner(self, input_file: str, additional_files: str):

input_files = [input_file] + additional_files
inlined_file = inliner.inline_functions(input_files, self.project_config.location_temp_dir,
f"{self.project_config.name_orig_no_extension}gt-inlined")
f"{self.project_config.name_orig_no_extension}gt-inlined", self.project_config.func)


if not inlined_file:
Expand Down
4 changes: 2 additions & 2 deletions src/inliner.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def generate_cfg(input_file):
print(f" Inlined bitcode: {inlined_bc}")
print("CFG files generated in the current directory.")

def inline_functions(bc_filepaths: list[str], output_file_folder: str, output_name: str) -> str:
def inline_functions(bc_filepaths: list[str], output_file_folder: str, output_name: str, analyzed_function: str) -> str:
output_file: str = os.path.join(output_file_folder, f"{output_name}.bc")

combined_bc = "combined.bc"
Expand All @@ -148,7 +148,7 @@ def inline_functions(bc_filepaths: list[str], output_file_folder: str, output_na
disassemble_bitcode(combined_bc, combined_ll)

# Step 4: Modify the LLVM IR file
modify_llvm_ir(combined_ll, combined_mod_ll, "test")
modify_llvm_ir(combined_ll, combined_mod_ll, analyzed_function)

# Step 5: Assemble the modified LLVM IR back to bitcode
assemble_bitcode(combined_mod_ll, combined_mod_bc)
Expand Down
4 changes: 2 additions & 2 deletions src/smt_solver/smt.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ def compile_and_run_cplusplus(modify_bit_code_cpp_file, modify_bit_code_exec_fil
if project_config.inlined :
compiled_additional_files = []
if additional_files:
compiled_additional_files = clang_helper.compile_list_to_llvm_for_analysis(additional_files, output_dir, "helper_smt", project_config.included, project_config.compile_flags)
compiled_additional_files = clang_helper.compile_list_to_llvm_for_analysis(additional_files, output_dir)
compiled_files = [compiled_file] + compiled_additional_files
input_bc_file = inliner.inline_functions(compiled_files, output_dir, f"{c_filename}_inlined")
input_bc_file = inliner.inline_functions(compiled_files, output_dir, f"{c_filename}_inlined", func_name)
else:
input_bc_file = compiled_file
# input_bc_file = clang_helper.unroll_loops(inlined_file, output_dir,
Expand Down

0 comments on commit 15b6120

Please sign in to comment.