[llvm] r321039 - update_mir_test_checks: Add "mir" to some states and regex names
Justin Bogner via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 18 15:31:55 PST 2017
Author: bogner
Date: Mon Dec 18 15:31:55 2017
New Revision: 321039
URL: http://llvm.org/viewvc/llvm-project?rev=321039&view=rev
Log:
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.
Modified:
llvm/trunk/utils/update_mir_test_checks.py
Modified: llvm/trunk/utils/update_mir_test_checks.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/update_mir_test_checks.py?rev=321039&r1=321038&r2=321039&view=diff
==============================================================================
--- llvm/trunk/utils/update_mir_test_checks.py (original)
+++ llvm/trunk/utils/update_mir_test_checks.py Mon Dec 18 15:31:55 2017
@@ -33,14 +33,14 @@ TRIPLE_IR_RE = re.compile(r'^\s*target\s
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 @@ def find_functions_with_one_bb(lines, ve
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 @@ def update_test_file(llc, test, remove_c
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
More information about the llvm-commits
mailing list