update_mir_test_checks: Add "mir" to some states and regex names
For tests that do lowering we need to support IR as input, so here we
clarify some names to avoid ambiguity in upcoming commits.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321039 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/update_mir_test_checks.py b/utils/update_mir_test_checks.py
index 2934f09..f0b2812 100755
--- a/utils/update_mir_test_checks.py
+++ b/utils/update_mir_test_checks.py
@@ -33,14 +33,14 @@
CHECK_PREFIX_RE = re.compile('--?check-prefix(?:es)?[= ](\S+)')
CHECK_RE = re.compile(r'^\s*[;#]\s*([^:]+?)(?:-NEXT|-NOT|-DAG|-LABEL)?:')
-FUNC_NAME_RE = re.compile(r' *name: *(?P<func>[A-Za-z0-9_.-]+)')
-BODY_BEGIN_RE = re.compile(r' *body: *\|')
-BASIC_BLOCK_RE = re.compile(r' *bb\.[0-9]+.*:$')
+MIR_FUNC_NAME_RE = re.compile(r' *name: *(?P<func>[A-Za-z0-9_.-]+)')
+MIR_BODY_BEGIN_RE = re.compile(r' *body: *\|')
+MIR_BASIC_BLOCK_RE = re.compile(r' *bb\.[0-9]+.*:$')
VREG_RE = re.compile(r'(%[0-9]+)(?::[a-z0-9_]+)?(?:\([<>a-z0-9 ]+\))?')
VREG_DEF_RE = re.compile(
r'^ *(?P<vregs>{0}(?:, {0})*) '
r'= (?P<opcode>[A-Zt][A-Za-z0-9_]+)'.format(VREG_RE.pattern))
-PREFIX_DATA_RE = re.compile(r'^ *(;|bb.[0-9].*: *$|[a-z]+:( |$)|$)')
+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)
MIR_FUNC_RE = re.compile(
@@ -164,13 +164,13 @@
cur_func = None
bbs = 0
for line in lines:
- m = FUNC_NAME_RE.match(line)
+ m = MIR_FUNC_NAME_RE.match(line)
if m:
if bbs == 1:
result.append(cur_func)
cur_func = m.group('func')
bbs = 0
- m = BASIC_BLOCK_RE.match(line)
+ m = MIR_BASIC_BLOCK_RE.match(line)
if m:
bbs += 1
if bbs == 1:
@@ -354,39 +354,39 @@
state = 'document'
output_lines.append(input_line)
elif state == 'document':
- m = FUNC_NAME_RE.match(input_line)
+ m = MIR_FUNC_NAME_RE.match(input_line)
if m:
- state = 'function metadata'
+ state = 'mir function metadata'
func_name = m.group('func')
if input_line.strip() == '...':
state = 'toplevel'
func_name = None
if should_add_line_to_output(input_line, prefix_set):
output_lines.append(input_line)
- elif state == 'function metadata':
+ elif state == 'mir function metadata':
if should_add_line_to_output(input_line, prefix_set):
output_lines.append(input_line)
- m = BODY_BEGIN_RE.match(input_line)
+ m = MIR_BODY_BEGIN_RE.match(input_line)
if m:
if func_name in simple_functions:
# If there's only one block, put the checks inside it
- state = 'function prefix'
+ state = 'mir function prefix'
continue
- state = 'function body'
+ 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)
- elif state == 'function prefix':
- m = PREFIX_DATA_RE.match(input_line)
+ elif state == 'mir function prefix':
+ m = MIR_PREFIX_DATA_RE.match(input_line)
if not m:
- state = 'function body'
+ 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)
if should_add_line_to_output(input_line, prefix_set):
output_lines.append(input_line)
- elif state == 'function body':
+ elif state == 'mir function body':
if input_line.strip() == '...':
state = 'toplevel'
func_name = None