|
26 | 26 | import subprocess
|
27 | 27 | import sys
|
28 | 28 |
|
29 |
| -RUN_LINE_RE = re.compile('^\s*[;#]\s*RUN:\s*(.*)$') |
30 |
| -TRIPLE_ARG_RE = re.compile(r'-mtriple[= ]([^ ]+)') |
31 |
| -MARCH_ARG_RE = re.compile(r'-march[= ]([^ ]+)') |
32 |
| -TRIPLE_IR_RE = re.compile(r'^\s*target\s+triple\s*=\s*"([^"]+)"$') |
33 |
| -CHECK_PREFIX_RE = re.compile('--?check-prefix(?:es)?[= ](\S+)') |
34 |
| -CHECK_RE = re.compile(r'^\s*[;#]\s*([^:]+?)(?:-NEXT|-NOT|-DAG|-LABEL)?:') |
| 29 | +from UpdateTestChecks import common |
35 | 30 |
|
36 | 31 | MIR_FUNC_NAME_RE = re.compile(r' *name: *(?P<func>[A-Za-z0-9_.-]+)')
|
37 | 32 | MIR_BODY_BEGIN_RE = re.compile(r' *body: *\|')
|
|
56 | 51 | r'^\.\.\.$',
|
57 | 52 | flags=(re.M | re.S))
|
58 | 53 |
|
| 54 | + |
59 | 55 | class LLC:
|
60 | 56 | def __init__(self, bin):
|
61 | 57 | self.bin = bin
|
@@ -94,15 +90,15 @@ def warn(msg, test_file=None):
|
94 | 90 |
|
95 | 91 | def find_triple_in_ir(lines, verbose=False):
|
96 | 92 | for l in lines:
|
97 |
| - m = TRIPLE_IR_RE.match(l) |
| 93 | + m = common.TRIPLE_IR_RE.match(l) |
98 | 94 | if m:
|
99 | 95 | return m.group(1)
|
100 | 96 | return None
|
101 | 97 |
|
102 | 98 |
|
103 | 99 | def find_run_lines(test, lines, verbose=False):
|
104 | 100 | raw_lines = [m.group(1)
|
105 |
| - for m in [RUN_LINE_RE.match(l) for l in lines] if m] |
| 101 | + for m in [common.RUN_LINE_RE.match(l) for l in lines] if m] |
106 | 102 | run_lines = [raw_lines[0]] if len(raw_lines) > 0 else []
|
107 | 103 | for l in raw_lines[1:]:
|
108 | 104 | if run_lines[-1].endswith("\\"):
|
@@ -133,19 +129,21 @@ def build_run_list(test, run_lines, verbose=False):
|
133 | 129 | continue
|
134 | 130 |
|
135 | 131 | triple = None
|
136 |
| - m = TRIPLE_ARG_RE.search(llc_cmd) |
| 132 | + m = common.TRIPLE_ARG_RE.search(llc_cmd) |
137 | 133 | if m:
|
138 | 134 | triple = m.group(1)
|
139 | 135 | # If we find -march but not -mtriple, use that.
|
140 |
| - m = MARCH_ARG_RE.search(llc_cmd) |
| 136 | + m = common.MARCH_ARG_RE.search(llc_cmd) |
141 | 137 | if m and not triple:
|
142 | 138 | triple = '{}--'.format(m.group(1))
|
143 | 139 |
|
144 | 140 | cmd_args = llc_cmd[len('llc'):].strip()
|
145 | 141 | cmd_args = cmd_args.replace('< %s', '').replace('%s', '').strip()
|
146 | 142 |
|
147 |
| - check_prefixes = [item for m in CHECK_PREFIX_RE.finditer(filecheck_cmd) |
148 |
| - for item in m.group(1).split(',')] |
| 143 | + check_prefixes = [ |
| 144 | + item |
| 145 | + for m in common.CHECK_PREFIX_RE.finditer(filecheck_cmd) |
| 146 | + for item in m.group(1).split(',')] |
149 | 147 | if not check_prefixes:
|
150 | 148 | check_prefixes = ['CHECK']
|
151 | 149 | all_prefixes += check_prefixes
|
@@ -286,7 +284,7 @@ def mangle_vreg(opcode, current_names):
|
286 | 284 |
|
287 | 285 | def should_add_line_to_output(input_line, prefix_set):
|
288 | 286 | # Skip any check lines that we're handling.
|
289 |
| - m = CHECK_RE.match(input_line) |
| 287 | + m = common.CHECK_RE.match(input_line) |
290 | 288 | if m and m.group(1) in prefix_set:
|
291 | 289 | return False
|
292 | 290 | return True
|
|
0 commit comments