diff options
author | Justin Bogner <mail@justinbogner.com> | 2017-12-18 23:31:55 +0000 |
---|---|---|
committer | Justin Bogner <mail@justinbogner.com> | 2017-12-18 23:31:55 +0000 |
commit | 537c6eec368b505ff57db13a6b0d257019dbce93 (patch) | |
tree | b905610782485df86df6c63ba92cc2ac0f300d63 /utils | |
parent | 8f06a7d8919adcb99de6b06ae0adfbd5c3645d3c (diff) |
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
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/update_mir_test_checks.py | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/utils/update_mir_test_checks.py b/utils/update_mir_test_checks.py index 2934f09f6b3..f0b28124262 100755 --- a/utils/update_mir_test_checks.py +++ b/utils/update_mir_test_checks.py @@ -33,14 +33,14 @@ TRIPLE_IR_RE = re.compile(r'^\s*target\s+triple\s*=\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, verbose=False): 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_common_prefixes=False, 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 |