summaryrefslogtreecommitdiffstats
path: root/llvm/utils/update_mir_test_checks.py
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/utils/update_mir_test_checks.py')
-rwxr-xr-xllvm/utils/update_mir_test_checks.py33
1 files changed, 9 insertions, 24 deletions
diff --git a/llvm/utils/update_mir_test_checks.py b/llvm/utils/update_mir_test_checks.py
index 0e3b36deabc..8b1665cb15e 100755
--- a/llvm/utils/update_mir_test_checks.py
+++ b/llvm/utils/update_mir_test_checks.py
@@ -41,7 +41,6 @@ VREG_DEF_RE = re.compile(
r'^ *(?P<vregs>{0}(?:, {0})*) '
r'= (?P<opcode>[A-Zt][A-Za-z0-9_]+)'.format(VREG_RE.pattern))
MIR_PREFIX_DATA_RE = re.compile(r'^ *(;|bb.[0-9].*: *$|[a-z]+:( |$)|$)')
-VREG_CLASS_RE = re.compile(r'^ *- *{ id: ([0-9]+), class: ([a-z0-9_]+)', re.M)
IR_FUNC_NAME_RE = re.compile(
r'^\s*define\s+(?:internal\s+)?[^@]*@(?P<func>[A-Za-z0-9_.]+)\s*\(')
@@ -51,7 +50,6 @@ MIR_FUNC_RE = re.compile(
r'^---$'
r'\n'
r'^ *name: *(?P<func>[A-Za-z0-9_.-]+)$'
- r'(?:.*?(?P<vregs>^ *registers: *(?:\n *- {[^\n]+$)*))?'
r'.*?'
r'^ *body: *\|\n'
r'(?P<body>.*?)\n'
@@ -196,11 +194,10 @@ def build_function_body_dictionary(test, raw_tool_output, triple, prefixes,
warn('Found conflicting asm for prefix: {}'.format(prefix),
test_file=test)
func_dict[prefix][func] = body
- func_dict[prefix]['{}:vregs'.format(func)] = m.group('vregs')
def add_checks_for_function(test, output_lines, run_list, func_dict, func_name,
- add_vreg_checks, single_bb, verbose=False):
+ single_bb, verbose=False):
printed_prefixes = set()
for run in run_list:
for prefix in run.prefixes:
@@ -213,17 +210,14 @@ def add_checks_for_function(test, output_lines, run_list, func_dict, func_name,
# output_lines.append('')
printed_prefixes.add(prefix)
log('Adding {} lines for {}'.format(prefix, func_name), verbose)
- vregs = None
- if add_vreg_checks:
- vregs = func_dict[prefix]['{}:vregs'.format(func_name)]
add_check_lines(test, output_lines, prefix, func_name, single_bb,
- func_dict[prefix][func_name].splitlines(), vregs)
+ func_dict[prefix][func_name].splitlines())
break
return output_lines
def add_check_lines(test, output_lines, prefix, func_name, single_bb,
- func_body, vreg_data):
+ func_body):
if single_bb:
# Don't bother checking the basic block label for a single BB
func_body.pop(0)
@@ -240,12 +234,6 @@ def add_check_lines(test, output_lines, prefix, func_name, single_bb,
output_lines.append('{}-LABEL: name: {}'.format(check, func_name))
- if vreg_data:
- output_lines.append('{}: registers:'.format(check))
- for m in VREG_CLASS_RE.finditer(vreg_data):
- output_lines.append('{}-NEXT: id: {}, class: {}'.format(
- check, m.group(1), m.group(2)))
-
vreg_map = {}
for func_line in func_body:
if not func_line.strip():
@@ -304,8 +292,7 @@ def should_add_line_to_output(input_line, prefix_set):
return True
-def update_test_file(llc, test, remove_common_prefixes=False,
- add_vreg_checks=False, verbose=False):
+def update_test_file(llc, test, remove_common_prefixes=False, verbose=False):
log('Scanning for RUN lines in test file: {}'.format(test), verbose)
with open(test) as fd:
input_lines = [l.rstrip() for l in fd]
@@ -384,15 +371,15 @@ def update_test_file(llc, test, remove_common_prefixes=False,
continue
state = 'mir function body'
add_checks_for_function(test, output_lines, run_list,
- func_dict, func_name, add_vreg_checks,
- single_bb=False, verbose=verbose)
+ func_dict, func_name, single_bb=False,
+ verbose=verbose)
elif state == 'mir function prefix':
m = MIR_PREFIX_DATA_RE.match(input_line)
if not m:
state = 'mir function body'
add_checks_for_function(test, output_lines, run_list,
- func_dict, func_name, add_vreg_checks,
- single_bb=True, verbose=verbose)
+ func_dict, func_name, single_bb=True,
+ verbose=verbose)
if should_add_line_to_output(input_line, prefix_set):
output_lines.append(input_line)
@@ -436,15 +423,13 @@ def main():
parser.add_argument('--remove-common-prefixes', action='store_true',
help='Remove existing check lines whose prefixes are '
'shared between multiple commands')
- parser.add_argument('--add-vreg-checks', action='store_true',
- help='Add checks for the "registers:" block')
parser.add_argument('tests', nargs='+')
args = parser.parse_args()
for test in args.tests:
try:
update_test_file(args.llc, test, args.remove_common_prefixes,
- args.add_vreg_checks, verbose=args.verbose)
+ verbose=args.verbose)
except Exception:
warn('Error processing file', test_file=test)
raise
OpenPOWER on IntegriCloud