Skip to content

Commit

Permalink
feat(execute): generate clang assembly for comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
SynodicMonth committed Aug 12, 2024
1 parent bf60bba commit 027c374
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions scripts/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,13 +319,27 @@ def dfs(curr_dir: str):
ast_path = os.path.join(output_dir, f"{basename}.ast")
ir_path = os.path.join(output_dir, f"{basename}.orzir")
asm_path = os.path.join(output_dir, f"{basename}.s")
clang_asm_path = os.path.join(output_dir, f"{basename}.clang.s")
out_path = os.path.join(output_dir, f"{basename}.out")
exec_path = os.path.join(output_dir, f"{basename}")
diff_path = os.path.join(output_dir, f"{basename}.diff")

log_path = os.path.join(output_dir, f"{basename}.log")
log_file = open(log_path, "w")

command = (
f"clang --target=riscv64 -march=rv64imafdc_zba_zbb -w -xc -O3 -S {testcase}.sy"
f" -o {clang_asm_path}"
)

exec_result = execute(command, exec_timeout)
log(log_file, command, exec_result)

if exec_result["returncode"] is None or exec_result["stderr"] != "":
result_md_table += f"| `{testcase}` | 😢 CE |\n"
print(f"\033[33m[ ERROR ] (clang CE)\033[0m {testcase}, see: ", log_path)
continue

command = (
f"{executable_path} -S "
f"-o {asm_path} "
Expand Down

0 comments on commit 027c374

Please sign in to comment.