41
41
r'^ *(?P<vregs>{0}(?:, {0})*) '
42
42
r'= (?P<opcode>[A-Zt][A-Za-z0-9_]+)' .format (VREG_RE .pattern ))
43
43
MIR_PREFIX_DATA_RE = re .compile (r'^ *(;|bb.[0-9].*: *$|[a-z]+:( |$)|$)' )
44
- VREG_CLASS_RE = re .compile (r'^ *- *{ id: ([0-9]+), class: ([a-z0-9_]+)' , re .M )
45
44
46
45
IR_FUNC_NAME_RE = re .compile (
47
46
r'^\s*define\s+(?:internal\s+)?[^@]*@(?P<func>[A-Za-z0-9_.]+)\s*\(' )
51
50
r'^---$'
52
51
r'\n'
53
52
r'^ *name: *(?P<func>[A-Za-z0-9_.-]+)$'
54
- r'(?:.*?(?P<vregs>^ *registers: *(?:\n *- {[^\n]+$)*))?'
55
53
r'.*?'
56
54
r'^ *body: *\|\n'
57
55
r'(?P<body>.*?)\n'
@@ -196,11 +194,10 @@ def build_function_body_dictionary(test, raw_tool_output, triple, prefixes,
196
194
warn ('Found conflicting asm for prefix: {}' .format (prefix ),
197
195
test_file = test )
198
196
func_dict [prefix ][func ] = body
199
- func_dict [prefix ]['{}:vregs' .format (func )] = m .group ('vregs' )
200
197
201
198
202
199
def add_checks_for_function (test , output_lines , run_list , func_dict , func_name ,
203
- add_vreg_checks , single_bb , verbose = False ):
200
+ single_bb , verbose = False ):
204
201
printed_prefixes = set ()
205
202
for run in run_list :
206
203
for prefix in run .prefixes :
@@ -213,17 +210,14 @@ def add_checks_for_function(test, output_lines, run_list, func_dict, func_name,
213
210
# output_lines.append('')
214
211
printed_prefixes .add (prefix )
215
212
log ('Adding {} lines for {}' .format (prefix , func_name ), verbose )
216
- vregs = None
217
- if add_vreg_checks :
218
- vregs = func_dict [prefix ]['{}:vregs' .format (func_name )]
219
213
add_check_lines (test , output_lines , prefix , func_name , single_bb ,
220
- func_dict [prefix ][func_name ].splitlines (), vregs )
214
+ func_dict [prefix ][func_name ].splitlines ())
221
215
break
222
216
return output_lines
223
217
224
218
225
219
def add_check_lines (test , output_lines , prefix , func_name , single_bb ,
226
- func_body , vreg_data ):
220
+ func_body ):
227
221
if single_bb :
228
222
# Don't bother checking the basic block label for a single BB
229
223
func_body .pop (0 )
@@ -240,12 +234,6 @@ def add_check_lines(test, output_lines, prefix, func_name, single_bb,
240
234
241
235
output_lines .append ('{}-LABEL: name: {}' .format (check , func_name ))
242
236
243
- if vreg_data :
244
- output_lines .append ('{}: registers:' .format (check ))
245
- for m in VREG_CLASS_RE .finditer (vreg_data ):
246
- output_lines .append ('{}-NEXT: id: {}, class: {}' .format (
247
- check , m .group (1 ), m .group (2 )))
248
-
249
237
vreg_map = {}
250
238
for func_line in func_body :
251
239
if not func_line .strip ():
@@ -304,8 +292,7 @@ def should_add_line_to_output(input_line, prefix_set):
304
292
return True
305
293
306
294
307
- def update_test_file (llc , test , remove_common_prefixes = False ,
308
- add_vreg_checks = False , verbose = False ):
295
+ def update_test_file (llc , test , remove_common_prefixes = False , verbose = False ):
309
296
log ('Scanning for RUN lines in test file: {}' .format (test ), verbose )
310
297
with open (test ) as fd :
311
298
input_lines = [l .rstrip () for l in fd ]
@@ -384,15 +371,15 @@ def update_test_file(llc, test, remove_common_prefixes=False,
384
371
continue
385
372
state = 'mir function body'
386
373
add_checks_for_function (test , output_lines , run_list ,
387
- func_dict , func_name , add_vreg_checks ,
388
- single_bb = False , verbose = verbose )
374
+ func_dict , func_name , single_bb = False ,
375
+ verbose = verbose )
389
376
elif state == 'mir function prefix' :
390
377
m = MIR_PREFIX_DATA_RE .match (input_line )
391
378
if not m :
392
379
state = 'mir function body'
393
380
add_checks_for_function (test , output_lines , run_list ,
394
- func_dict , func_name , add_vreg_checks ,
395
- single_bb = True , verbose = verbose )
381
+ func_dict , func_name , single_bb = True ,
382
+ verbose = verbose )
396
383
397
384
if should_add_line_to_output (input_line , prefix_set ):
398
385
output_lines .append (input_line )
@@ -436,15 +423,13 @@ def main():
436
423
parser .add_argument ('--remove-common-prefixes' , action = 'store_true' ,
437
424
help = 'Remove existing check lines whose prefixes are '
438
425
'shared between multiple commands' )
439
- parser .add_argument ('--add-vreg-checks' , action = 'store_true' ,
440
- help = 'Add checks for the "registers:" block' )
441
426
parser .add_argument ('tests' , nargs = '+' )
442
427
args = parser .parse_args ()
443
428
444
429
for test in args .tests :
445
430
try :
446
431
update_test_file (args .llc , test , args .remove_common_prefixes ,
447
- args . add_vreg_checks , verbose = args .verbose )
432
+ verbose = args .verbose )
448
433
except Exception :
449
434
warn ('Error processing file' , test_file = test )
450
435
raise
0 commit comments