diff options
| author | Theofilos Augoustis <theofilos.augoustis@gmail.com> | 2023-08-24 12:18:05 +0200 |
|---|---|---|
| committer | Theofilos Augoustis <theofilos.augoustis@gmail.com> | 2023-08-24 12:18:05 +0200 |
| commit | ed536f04a716d585ce54bab0413f57aba1284b91 (patch) | |
| tree | b3fd695e54304a3a2197d66edce02e349f289588 /compare.py | |
| parent | a31ca2cb14b1b46957608c45b296d8c56e32d417 (diff) | |
| download | focaccia-ed536f04a716d585ce54bab0413f57aba1284b91.tar.gz focaccia-ed536f04a716d585ce54bab0413f57aba1284b91.zip | |
Print statistics for unmatched reference basic blocks
Diffstat (limited to 'compare.py')
| -rwxr-xr-x | compare.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/compare.py b/compare.py index a104089..ffd1e93 100755 --- a/compare.py +++ b/compare.py @@ -41,6 +41,7 @@ class ContextBlock: def __init__(self): self.regs = {reg: None for reg in ContextBlock.regnames} self.has_backwards = False + self.matched = False def set_backwards(self): self.has_backwards = True @@ -195,6 +196,7 @@ def compare(txl: List[ContextBlock], native: List[ContextBlock], stats: bool = F reference = native[i] transformations = Transformations(previous_reference, reference) if verify(translation, reference, transformations.transformation, previous_translation) == 0: + reference.matched = True break i += 1 @@ -244,6 +246,8 @@ def compare(txl: List[ContextBlock], native: List[ContextBlock], stats: bool = F if translation.regs['PC'] not in unmatched_pcs: unmatched_pcs[translation.regs['PC']] = 0 unmatched_pcs[translation.regs['PC']] += 1 + else: + reference.matched = True if translation.has_backwards: next(native) @@ -258,6 +262,19 @@ def compare(txl: List[ContextBlock], native: List[ContextBlock], stats: bool = F for pc in unmatched_pcs: print(f'PC {hex(pc)} unmatched {unmatched_pcs[pc]} times') + + # NOTE: currently doesn't handle mismatched due backward branches + current = "" + unmatched_count = 0 + for ref in native: + ref_pc = ref.regs['PC'] + if ref_pc != current: + if unmatched_count: + print(f'Reference PC {hex(current)} unmatched {unmatched_count} times') + current = ref_pc + + if ref.matched == False: + unmatched_count += 1 return 0 def read_logs(txl_path, native_path, program): |