diff options
author | Fangrui Song <maskray@google.com> | 2018-02-10 05:01:33 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2018-02-10 05:01:33 +0000 |
commit | 4f0f426d1fffc145f8defce6c7a85d17f4428908 (patch) | |
tree | 10ba329b16698b53e586d16f4e2ebe95ca9d7445 /llvm/utils/update_llc_test_checks.py | |
parent | 3da72051149e61f14cc1639b953049630f0c2a59 (diff) | |
download | bcm5719-llvm-4f0f426d1fffc145f8defce6c7a85d17f4428908.tar.gz bcm5719-llvm-4f0f426d1fffc145f8defce6c7a85d17f4428908.zip |
[utils] Refactor utils/update_{,llc_}test_checks.py to share more code
Summary:
This revision refactors 1. parser 2. CHECK line adder of utils/update_{,llc_}test_checks.py
so that thir functionality can be re-used by other utility scripts (e.g. D42712)
Reviewers: asb, craig.topper, RKSimon, echristo
Subscribers: llvm-commits, spatel
Differential Revision: https://reviews.llvm.org/D42805
llvm-svn: 324803
Diffstat (limited to 'llvm/utils/update_llc_test_checks.py')
-rwxr-xr-x | llvm/utils/update_llc_test_checks.py | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/llvm/utils/update_llc_test_checks.py b/llvm/utils/update_llc_test_checks.py index b8248270b1e..dd7a1d27005 100755 --- a/llvm/utils/update_llc_test_checks.py +++ b/llvm/utils/update_llc_test_checks.py @@ -19,30 +19,6 @@ from UpdateTestChecks import asm, common ADVERT = '; NOTE: Assertions have been autogenerated by ' -def add_checks(output_lines, run_list, func_dict, func_name): - printed_prefixes = [] - for p in run_list: - checkprefixes = p[0] - for checkprefix in checkprefixes: - if checkprefix in printed_prefixes: - break - if not func_dict[checkprefix][func_name]: - continue - # Add some space between different check prefixes. - if len(printed_prefixes) != 0: - output_lines.append(';') - printed_prefixes.append(checkprefix) - output_lines.append('; %s-LABEL: %s:' % (checkprefix, func_name)) - func_body = func_dict[checkprefix][func_name].splitlines() - output_lines.append('; %s: %s' % (checkprefix, func_body[0])) - for func_line in func_body[1:]: - output_lines.append('; %s-NEXT: %s' % (checkprefix, func_line)) - # Add space between different check prefixes and the first line of code. - # output_lines.append(';') - break - return output_lines - - def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('-v', '--verbose', action='store_true', @@ -156,7 +132,7 @@ def main(): continue # Print out the various check lines here. - output_lines = add_checks(output_lines, run_list, func_dict, func_name) + asm.add_asm_checks(output_lines, ';', run_list, func_dict, func_name) is_in_function_start = False if is_in_function: |