@@ -87,13 +87,14 @@ def __call__(self, args, ir):
8787
8888
8989class Run :
90- def __init__ (self , prefixes , cmd_args , triple ):
90+ def __init__ (self , prefixes , cmd_args , preprocess_cmd , triple ):
9191 self .prefixes = prefixes
9292 self .cmd_args = cmd_args
93+ self .preprocess_cmd = preprocess_cmd
9394 self .triple = triple
9495
9596 def __getitem__ (self , index ):
96- return [self .prefixes , self .cmd_args , self .triple ][index ]
97+ return [self .prefixes , self .cmd_args , self .preprocess_cmd , self . triple ][index ]
9798
9899
99100def log (msg , verbose = True ):
@@ -117,9 +118,14 @@ def build_run_list(test, run_lines, verbose=False):
117118 common .warn ("Skipping unparsable RUN line: " + l )
118119 continue
119120
120- commands = [cmd .strip () for cmd in l .split ("|" , 1 )]
121- llc_cmd = commands [0 ]
122- filecheck_cmd = commands [1 ] if len (commands ) > 1 else ""
121+ commands = [cmd .strip () for cmd in l .split ("|" )]
122+ assert len (commands ) >= 2
123+ preprocess_cmd = None
124+ if len (commands ) > 2 :
125+ preprocess_cmd = " | " .join (commands [:- 2 ])
126+
127+ llc_cmd = commands [- 2 ]
128+ filecheck_cmd = commands [- 1 ]
123129 common .verify_filecheck_prefixes (filecheck_cmd )
124130
125131 if not llc_cmd .startswith ("llc " ):
@@ -145,7 +151,7 @@ def build_run_list(test, run_lines, verbose=False):
145151 check_prefixes = common .get_check_prefixes (filecheck_cmd )
146152 all_prefixes += check_prefixes
147153
148- run_list .append (Run (check_prefixes , cmd_args , triple ))
154+ run_list .append (Run (check_prefixes , cmd_args , preprocess_cmd , triple ))
149155
150156 # Sort prefixes that are shared between run lines before unshared prefixes.
151157 # This causes us to prefer printing shared prefixes.
@@ -358,11 +364,21 @@ def update_test_file(args, test, autogenerated_note):
358364 for run in run_list :
359365 for prefix in run .prefixes :
360366 func_dict .update ({prefix : dict ()})
361- for prefixes , llc_args , triple_in_cmd in run_list :
367+ for prefixes , llc_args , preprocess_cmd , triple_in_cmd in run_list :
362368 log ("Extracted LLC cmd: llc {}" .format (llc_args ), args .verbose )
363369 log ("Extracted FileCheck prefixes: {}" .format (prefixes ), args .verbose )
364370
365- raw_tool_output = args .llc_binary (llc_args , test )
371+ if test .endswith (".mir" ):
372+ llc_args += " -x mir"
373+
374+ #raw_tool_output = args.llc_binary(llc_args, test)
375+ raw_tool_output = common .invoke_tool (
376+ "llc" ,
377+ llc_args ,
378+ test ,
379+ preprocess_cmd ,
380+ verbose = args .verbose
381+ )
366382 if not triple_in_cmd and not triple_in_ir :
367383 common .warn ("No triple found: skipping file" , test_file = test )
368384 return
0 commit comments