1 from __future__
import print_function
7 if sys
.version_info
[0] > 2:
9 expandtabs
= str.expandtabs
13 # RegEx: this is where the magic happens.
17 ASM_FUNCTION_X86_RE
= re
.compile(
18 r
'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*(@"?(?P=func)"?| -- Begin function (?P=func))\n(?:\s*\.?Lfunc_begin[^:\n]*:\n)?'
19 r
'(?:\.L[^$]+\$local:\n)?' # drop .L<func>$local:
20 r
'(?:[ \t]+.cfi_startproc\n|.seh_proc[^\n]+\n)?' # drop optional cfi
21 r
'(?P<body>^##?[ \t]+[^:]+:.*?)\s*'
22 r
'^\s*(?:[^:\n]+?:\s*\n\s*\.size|\.cfi_endproc|\.globl|\.comm|\.(?:sub)?section|#+ -- End function)',
25 ASM_FUNCTION_ARM_RE
= re
.compile(
26 r
'^(?P<func>[0-9a-zA-Z_$]+):\n' # f: (name of function)
27 r
'(?:\.L(?P=func)\$local:\n)?' # drop .L<func>$local:
28 r
'\s+\.fnstart\n' # .fnstart
29 r
'(?P<body>.*?)' # (body of the function)
30 r
'^.Lfunc_end[0-9]+:', # .Lfunc_end0: or # -- End function
33 ASM_FUNCTION_AARCH64_RE
= re
.compile(
34 r
'^_?(?P<func>[^:]+):[ \t]*\/\/[ \t]*@"?(?P=func)"?( (Function|Tail Call))?\n'
35 r
'(?:[ \t]+.cfi_startproc\n)?' # drop optional cfi noise
37 # This list is incomplete
38 r
'^\s*(\.Lfunc_end[0-9]+|// -- End function)',
41 ASM_FUNCTION_AMDGPU_RE
= re
.compile(
42 r
'^_?(?P<func>[^:]+):[ \t]*;+[ \t]*@"?(?P=func)"?\n[^:]*?'
43 r
'(?P<body>.*?)\n' # (body of the function)
44 # This list is incomplete
45 r
'^\s*(\.Lfunc_end[0-9]+:\n|\.section)',
48 ASM_FUNCTION_HEXAGON_RE
= re
.compile(
49 r
'^_?(?P<func>[^:]+):[ \t]*//[ \t]*@"?(?P=func)"?\n[^:]*?'
50 r
'(?P<body>.*?)\n' # (body of the function)
51 # This list is incomplete
52 r
'.Lfunc_end[0-9]+:\n',
55 ASM_FUNCTION_M68K_RE
= re
.compile(
56 r
'^_?(?P<func>[^:]+):[ \t]*;[ \t]*@"?(?P=func)"?\n'
57 r
'(?P<body>.*?)\s*' # (body of the function)
58 r
'.Lfunc_end[0-9]+:\n',
61 ASM_FUNCTION_MIPS_RE
= re
.compile(
62 r
'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@"?(?P=func)"?\n[^:]*?' # f: (name of func)
63 r
'(?:\s*\.?Ltmp[^:\n]*:\n)?[^:]*?' # optional .Ltmp<N> for EH
64 r
'(?:^[ \t]+\.(frame|f?mask|set).*?\n)+' # Mips+LLVM standard asm prologue
65 r
'(?P<body>.*?)\n' # (body of the function)
66 # Mips+LLVM standard asm epilogue
67 r
'(?:(^[ \t]+\.set[^\n]*?\n)*^[ \t]+\.end.*?\n)'
68 r
'(\$|\.L)func_end[0-9]+:\n', # $func_end0: (mips32 - O32) or
69 # .Lfunc_end0: (mips64 - NewABI)
72 ASM_FUNCTION_MSP430_RE
= re
.compile(
73 r
'^_?(?P<func>[^:]+):[ \t]*;+[ \t]*@"?(?P=func)"?\n[^:]*?'
75 r
'(\$|\.L)func_end[0-9]+:\n', # $func_end0:
78 ASM_FUNCTION_AVR_RE
= re
.compile(
79 r
'^_?(?P<func>[^:]+):[ \t]*;+[ \t]*@"?(?P=func)"?\n[^:]*?'
81 r
'.Lfunc_end[0-9]+:\n',
84 ASM_FUNCTION_PPC_RE
= re
.compile(
85 r
'#[ \-\t]*Begin function (?P<func>[^.:]+)\n'
87 r
'^[_.]?(?P=func):(?:[ \t]*#+[ \t]*@"?(?P=func)"?)?\n'
90 # This list is incomplete
91 r
'(?:^[ \t]*(?:\.(?:long|quad|v?byte)[ \t]+[^\n]+)\n)*'
92 r
'(?:\.Lfunc_end|L\.\.(?P=func))[0-9]+:\n',
95 ASM_FUNCTION_RISCV_RE
= re
.compile(
96 r
'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@"?(?P=func)"?\n'
97 r
'(?:\s*\.?L(?P=func)\$local:\n)?' # optional .L<func>$local: due to -fno-semantic-interposition
98 r
'(?:\s*\.?Lfunc_begin[^:\n]*:\n)?[^:]*?'
99 r
'(?P<body>^##?[ \t]+[^:]+:.*?)\s*'
100 r
'.Lfunc_end[0-9]+:\n',
103 ASM_FUNCTION_LANAI_RE
= re
.compile(
104 r
'^_?(?P<func>[^:]+):[ \t]*!+[ \t]*@"?(?P=func)"?\n'
105 r
'(?:[ \t]+.cfi_startproc\n)?' # drop optional cfi noise
107 r
'.Lfunc_end[0-9]+:\n',
110 ASM_FUNCTION_SPARC_RE
= re
.compile(
111 r
'^_?(?P<func>[^:]+):[ \t]*!+[ \t]*@"?(?P=func)"?\n'
113 r
'.Lfunc_end[0-9]+:\n',
116 ASM_FUNCTION_SYSTEMZ_RE
= re
.compile(
117 r
'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@"?(?P=func)"?\n'
118 r
'[ \t]+.cfi_startproc\n'
120 r
'.Lfunc_end[0-9]+:\n',
123 ASM_FUNCTION_AARCH64_DARWIN_RE
= re
.compile(
124 r
'^_(?P<func>[^:]+):[ \t]*;[ \t]@"?(?P=func)"?\n'
125 r
'([ \t]*.cfi_startproc\n[\s]*)?'
127 r
'([ \t]*.cfi_endproc\n[\s]*)?'
128 r
'^[ \t]*;[ \t]--[ \t]End[ \t]function',
131 ASM_FUNCTION_ARM_DARWIN_RE
= re
.compile(
132 r
'@[ \t]--[ \t]Begin[ \t]function[ \t](?P<func>[^ \t]+?)\n'
133 r
'^[ \t]*\.globl[ \t]*_(?P=func)[ \t]*'
134 r
'(?P<directives>.*?)'
135 r
'^_(?P=func):\n[ \t]*'
137 r
'^[ \t]*@[ \t]--[ \t]End[ \t]function',
138 flags
=(re
.M | re
.S
))
140 ASM_FUNCTION_ARM_MACHO_RE
= re
.compile(
141 r
'^_(?P<func>[^:]+):[ \t]*\n'
142 r
'([ \t]*.cfi_startproc\n[ \t]*)?'
144 r
'[ \t]*\.cfi_endproc\n',
147 ASM_FUNCTION_THUMBS_DARWIN_RE
= re
.compile(
148 r
'^_(?P<func>[^:]+):\n'
150 r
'[ \t]*\.data_region\n',
153 ASM_FUNCTION_THUMB_DARWIN_RE
= re
.compile(
154 r
'^_(?P<func>[^:]+):\n'
156 r
'^[ \t]*@[ \t]--[ \t]End[ \t]function',
159 ASM_FUNCTION_ARM_IOS_RE
= re
.compile(
160 r
'^_(?P<func>[^:]+):\n'
162 r
'^[ \t]*@[ \t]--[ \t]End[ \t]function',
165 ASM_FUNCTION_WASM32_RE
= re
.compile(
166 r
'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@"?(?P=func)"?\n'
168 r
'^\s*(\.Lfunc_end[0-9]+:\n|end_function)',
171 ASM_FUNCTION_VE_RE
= re
.compile(
172 r
'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@(?P=func)\n'
173 r
'(?P<body>^##?[ \t]+[^:]+:.*?)\s*'
174 r
'.Lfunc_end[0-9]+:\n',
177 ASM_FUNCTION_CSKY_RE
= re
.compile(
178 r
'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@(?P=func)\n(?:\s*\.?Lfunc_begin[^:\n]*:\n)?[^:]*?'
179 r
'(?P<body>^##?[ \t]+[^:]+:.*?)\s*'
180 r
'.Lfunc_end[0-9]+:\n',
183 ASM_FUNCTION_NVPTX_RE
= re
.compile(
184 # function attributes and retval
185 # .visible .func (.param .align 16 .b8 func_retval0[32])
186 #r'^(\.visible\s+)?\.func\s+(\([^\)]*\)\s*)?'
187 r
'^(\.(func|visible|weak|entry|noreturn|extern)\s+)+(\([^\)]*\)\s*)?'
190 r
'(?P<func>[^\(\n]+)'
192 # function name separator (opening brace)
193 r
'(?P<func_name_separator>\()'
195 # function parameters
197 # .param .align 16 .b8 callee_St8x4_param_0[32]
198 # ) // -- Begin function callee_St8x4
199 r
'[^\)]*\)(\s*//[^\n]*)?\n'
204 # function body end marker
205 r
'\s*// -- End function',
208 ASM_FUNCTION_LOONGARCH_RE
= re
.compile(
209 r
'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@"?(?P=func)"?\n'
210 r
'(?:\s*\.?Lfunc_begin[^:\n]*:\n)?[^:]*?'
211 r
'(?P<body>^##?[ \t]+[^:]+:.*?)\s*'
212 r
'.Lfunc_end[0-9]+:\n',
215 SCRUB_X86_SHUFFLES_RE
= (
217 r
'^(\s*\w+) [^#\n]+#+ ((?:[xyz]mm\d+|mem)( \{%k\d+\}( \{z\})?)? = .*)$',
220 SCRUB_X86_SHUFFLES_NO_MEM_RE
= (
222 r
'^(\s*\w+) [^#\n]+#+ ((?:[xyz]mm\d+|mem)( \{%k\d+\}( \{z\})?)? = (?!.*(?:mem)).*)$',
225 SCRUB_X86_SPILL_RELOAD_RE
= (
227 r
'-?\d+\(%([er])[sb]p\)(.*(?:Spill|Reload))$',
229 SCRUB_X86_SP_RE
= re
.compile(r
'\d+\(%(esp|rsp)\)')
230 SCRUB_X86_RIP_RE
= re
.compile(r
'[.\w]+\(%rip\)')
231 SCRUB_X86_LCP_RE
= re
.compile(r
'\.?LCPI[0-9]+_[0-9]+')
232 SCRUB_X86_RET_RE
= re
.compile(r
'ret[l|q]')
234 def scrub_asm_x86(asm
, args
):
235 # Scrub runs of whitespace out of the assembly, but leave the leading
236 # whitespace in place.
237 asm
= common
.SCRUB_WHITESPACE_RE
.sub(r
' ', asm
)
238 # Expand the tabs used for indentation.
239 asm
= string
.expandtabs(asm
, 2)
241 # Detect shuffle asm comments and hide the operands in favor of the comments.
242 if getattr(args
, 'no_x86_scrub_mem_shuffle', True):
243 asm
= SCRUB_X86_SHUFFLES_NO_MEM_RE
.sub(r
'\1 {{.*#+}} \2', asm
)
245 asm
= SCRUB_X86_SHUFFLES_RE
.sub(r
'\1 {{.*#+}} \2', asm
)
247 # Detect stack spills and reloads and hide their exact offset and whether
248 # they used the stack pointer or frame pointer.
249 asm
= SCRUB_X86_SPILL_RELOAD_RE
.sub(r
'{{[-0-9]+}}(%\1{{[sb]}}p)\2', asm
)
250 if getattr(args
, 'x86_scrub_sp', True):
251 # Generically match the stack offset of a memory operand.
252 asm
= SCRUB_X86_SP_RE
.sub(r
'{{[0-9]+}}(%\1)', asm
)
253 if getattr(args
, 'x86_scrub_rip', False):
254 # Generically match a RIP-relative memory operand.
255 asm
= SCRUB_X86_RIP_RE
.sub(r
'{{.*}}(%rip)', asm
)
256 # Generically match a LCP symbol.
257 asm
= SCRUB_X86_LCP_RE
.sub(r
'{{\.?LCPI[0-9]+_[0-9]+}}', asm
)
258 if getattr(args
, 'extra_scrub', False):
259 # Avoid generating different checks for 32- and 64-bit because of 'retl' vs 'retq'.
260 asm
= SCRUB_X86_RET_RE
.sub(r
'ret{{[l|q]}}', asm
)
261 # Strip kill operands inserted into the asm.
262 asm
= common
.SCRUB_KILL_COMMENT_RE
.sub('', asm
)
263 # Strip trailing whitespace.
264 asm
= common
.SCRUB_TRAILING_WHITESPACE_RE
.sub(r
'', asm
)
267 def scrub_asm_amdgpu(asm
, args
):
268 # Scrub runs of whitespace out of the assembly, but leave the leading
269 # whitespace in place.
270 asm
= common
.SCRUB_WHITESPACE_RE
.sub(r
' ', asm
)
271 # Expand the tabs used for indentation.
272 asm
= string
.expandtabs(asm
, 2)
273 # Strip trailing whitespace.
274 asm
= common
.SCRUB_TRAILING_WHITESPACE_RE
.sub(r
'', asm
)
277 def scrub_asm_arm_eabi(asm
, args
):
278 # Scrub runs of whitespace out of the assembly, but leave the leading
279 # whitespace in place.
280 asm
= common
.SCRUB_WHITESPACE_RE
.sub(r
' ', asm
)
281 # Expand the tabs used for indentation.
282 asm
= string
.expandtabs(asm
, 2)
283 # Strip kill operands inserted into the asm.
284 asm
= common
.SCRUB_KILL_COMMENT_RE
.sub('', asm
)
285 # Strip trailing whitespace.
286 asm
= common
.SCRUB_TRAILING_WHITESPACE_RE
.sub(r
'', asm
)
289 def scrub_asm_hexagon(asm
, args
):
290 # Scrub runs of whitespace out of the assembly, but leave the leading
291 # whitespace in place.
292 asm
= common
.SCRUB_WHITESPACE_RE
.sub(r
' ', asm
)
293 # Expand the tabs used for indentation.
294 asm
= string
.expandtabs(asm
, 2)
295 # Strip trailing whitespace.
296 asm
= common
.SCRUB_TRAILING_WHITESPACE_RE
.sub(r
'', asm
)
299 def scrub_asm_powerpc(asm
, args
):
300 # Scrub runs of whitespace out of the assembly, but leave the leading
301 # whitespace in place.
302 asm
= common
.SCRUB_WHITESPACE_RE
.sub(r
' ', asm
)
303 # Expand the tabs used for indentation.
304 asm
= string
.expandtabs(asm
, 2)
305 # Strip unimportant comments, but leave the token '#' in place.
306 asm
= common
.SCRUB_LOOP_COMMENT_RE
.sub(r
'#', asm
)
307 # Strip trailing whitespace.
308 asm
= common
.SCRUB_TRAILING_WHITESPACE_RE
.sub(r
'', asm
)
309 # Strip the tailing token '#', except the line only has token '#'.
310 asm
= common
.SCRUB_TAILING_COMMENT_TOKEN_RE
.sub(r
'', asm
)
313 def scrub_asm_m68k(asm
, args
):
314 # Scrub runs of whitespace out of the assembly, but leave the leading
315 # whitespace in place.
316 asm
= common
.SCRUB_WHITESPACE_RE
.sub(r
' ', asm
)
317 # Expand the tabs used for indentation.
318 asm
= string
.expandtabs(asm
, 2)
319 # Strip trailing whitespace.
320 asm
= common
.SCRUB_TRAILING_WHITESPACE_RE
.sub(r
'', asm
)
323 def scrub_asm_mips(asm
, args
):
324 # Scrub runs of whitespace out of the assembly, but leave the leading
325 # whitespace in place.
326 asm
= common
.SCRUB_WHITESPACE_RE
.sub(r
' ', asm
)
327 # Expand the tabs used for indentation.
328 asm
= string
.expandtabs(asm
, 2)
329 # Strip trailing whitespace.
330 asm
= common
.SCRUB_TRAILING_WHITESPACE_RE
.sub(r
'', asm
)
333 def scrub_asm_msp430(asm
, args
):
334 # Scrub runs of whitespace out of the assembly, but leave the leading
335 # whitespace in place.
336 asm
= common
.SCRUB_WHITESPACE_RE
.sub(r
' ', asm
)
337 # Expand the tabs used for indentation.
338 asm
= string
.expandtabs(asm
, 2)
339 # Strip trailing whitespace.
340 asm
= common
.SCRUB_TRAILING_WHITESPACE_RE
.sub(r
'', asm
)
343 def scrub_asm_avr(asm
, args
):
344 # Scrub runs of whitespace out of the assembly, but leave the leading
345 # whitespace in place.
346 asm
= common
.SCRUB_WHITESPACE_RE
.sub(r
' ', asm
)
347 # Expand the tabs used for indentation.
348 asm
= string
.expandtabs(asm
, 2)
349 # Strip trailing whitespace.
350 asm
= common
.SCRUB_TRAILING_WHITESPACE_RE
.sub(r
'', asm
)
353 def scrub_asm_riscv(asm
, args
):
354 # Scrub runs of whitespace out of the assembly, but leave the leading
355 # whitespace in place.
356 asm
= common
.SCRUB_WHITESPACE_RE
.sub(r
' ', asm
)
357 # Expand the tabs used for indentation.
358 asm
= string
.expandtabs(asm
, 2)
359 # Strip trailing whitespace.
360 asm
= common
.SCRUB_TRAILING_WHITESPACE_RE
.sub(r
'', asm
)
363 def scrub_asm_lanai(asm
, args
):
364 # Scrub runs of whitespace out of the assembly, but leave the leading
365 # whitespace in place.
366 asm
= common
.SCRUB_WHITESPACE_RE
.sub(r
' ', asm
)
367 # Expand the tabs used for indentation.
368 asm
= string
.expandtabs(asm
, 2)
369 # Strip trailing whitespace.
370 asm
= common
.SCRUB_TRAILING_WHITESPACE_RE
.sub(r
'', asm
)
373 def scrub_asm_sparc(asm
, args
):
374 # Scrub runs of whitespace out of the assembly, but leave the leading
375 # whitespace in place.
376 asm
= common
.SCRUB_WHITESPACE_RE
.sub(r
' ', asm
)
377 # Expand the tabs used for indentation.
378 asm
= string
.expandtabs(asm
, 2)
379 # Strip trailing whitespace.
380 asm
= common
.SCRUB_TRAILING_WHITESPACE_RE
.sub(r
'', asm
)
383 def scrub_asm_systemz(asm
, args
):
384 # Scrub runs of whitespace out of the assembly, but leave the leading
385 # whitespace in place.
386 asm
= common
.SCRUB_WHITESPACE_RE
.sub(r
' ', asm
)
387 # Expand the tabs used for indentation.
388 asm
= string
.expandtabs(asm
, 2)
389 # Strip trailing whitespace.
390 asm
= common
.SCRUB_TRAILING_WHITESPACE_RE
.sub(r
'', asm
)
393 def scrub_asm_wasm32(asm
, args
):
394 # Scrub runs of whitespace out of the assembly, but leave the leading
395 # whitespace in place.
396 asm
= common
.SCRUB_WHITESPACE_RE
.sub(r
' ', asm
)
397 # Expand the tabs used for indentation.
398 asm
= string
.expandtabs(asm
, 2)
399 # Strip trailing whitespace.
400 asm
= common
.SCRUB_TRAILING_WHITESPACE_RE
.sub(r
'', asm
)
403 def scrub_asm_ve(asm
, args
):
404 # Scrub runs of whitespace out of the assembly, but leave the leading
405 # whitespace in place.
406 asm
= common
.SCRUB_WHITESPACE_RE
.sub(r
' ', asm
)
407 # Expand the tabs used for indentation.
408 asm
= string
.expandtabs(asm
, 2)
409 # Strip trailing whitespace.
410 asm
= common
.SCRUB_TRAILING_WHITESPACE_RE
.sub(r
'', asm
)
413 def scrub_asm_csky(asm
, args
):
414 # Scrub runs of whitespace out of the assembly, but leave the leading
415 # whitespace in place.
416 asm
= common
.SCRUB_WHITESPACE_RE
.sub(r
' ', asm
)
417 # Expand the tabs used for indentation.
418 asm
= string
.expandtabs(asm
, 2)
419 # Strip kill operands inserted into the asm.
420 asm
= common
.SCRUB_KILL_COMMENT_RE
.sub('', asm
)
421 # Strip trailing whitespace.
422 asm
= common
.SCRUB_TRAILING_WHITESPACE_RE
.sub(r
'', asm
)
425 def scrub_asm_nvptx(asm
, args
):
426 # Scrub runs of whitespace out of the assembly, but leave the leading
427 # whitespace in place.
428 asm
= common
.SCRUB_WHITESPACE_RE
.sub(r
' ', asm
)
429 # Expand the tabs used for indentation.
430 asm
= string
.expandtabs(asm
, 2)
431 # Strip trailing whitespace.
432 asm
= common
.SCRUB_TRAILING_WHITESPACE_RE
.sub(r
'', asm
)
435 def scrub_asm_loongarch(asm
, args
):
436 # Scrub runs of whitespace out of the assembly, but leave the leading
437 # whitespace in place.
438 asm
= common
.SCRUB_WHITESPACE_RE
.sub(r
' ', asm
)
439 # Expand the tabs used for indentation.
440 asm
= string
.expandtabs(asm
, 2)
441 # Strip trailing whitespace.
442 asm
= common
.SCRUB_TRAILING_WHITESPACE_RE
.sub(r
'', asm
)
445 # Returns a tuple of a scrub function and a function regex. Scrub function is
446 # used to alter function body in some way, for example, remove trailing spaces.
447 # Function regex is used to match function name, body, etc. in raw llc output.
448 def get_run_handler(triple
):
450 'i686': (scrub_asm_x86
, ASM_FUNCTION_X86_RE
),
451 'x86': (scrub_asm_x86
, ASM_FUNCTION_X86_RE
),
452 'i386': (scrub_asm_x86
, ASM_FUNCTION_X86_RE
),
453 'arm64_32-apple-ios': (scrub_asm_arm_eabi
, ASM_FUNCTION_AARCH64_DARWIN_RE
),
454 'arm64_32-apple-watchos2.0.0': (scrub_asm_arm_eabi
, ASM_FUNCTION_AARCH64_DARWIN_RE
),
455 'aarch64': (scrub_asm_arm_eabi
, ASM_FUNCTION_AARCH64_RE
),
456 'aarch64-apple-darwin': (scrub_asm_arm_eabi
, ASM_FUNCTION_AARCH64_DARWIN_RE
),
457 'aarch64-apple-ios': (scrub_asm_arm_eabi
, ASM_FUNCTION_AARCH64_DARWIN_RE
),
458 'hexagon': (scrub_asm_hexagon
, ASM_FUNCTION_HEXAGON_RE
),
459 'r600': (scrub_asm_amdgpu
, ASM_FUNCTION_AMDGPU_RE
),
460 'amdgcn': (scrub_asm_amdgpu
, ASM_FUNCTION_AMDGPU_RE
),
461 'arm': (scrub_asm_arm_eabi
, ASM_FUNCTION_ARM_RE
),
462 'arm64': (scrub_asm_arm_eabi
, ASM_FUNCTION_AARCH64_RE
),
463 'arm64e': (scrub_asm_arm_eabi
, ASM_FUNCTION_AARCH64_DARWIN_RE
),
464 'arm64-apple-ios': (scrub_asm_arm_eabi
, ASM_FUNCTION_AARCH64_DARWIN_RE
),
465 'armv7-apple-ios' : (scrub_asm_arm_eabi
, ASM_FUNCTION_ARM_IOS_RE
),
466 'armv7-apple-darwin': (scrub_asm_arm_eabi
, ASM_FUNCTION_ARM_DARWIN_RE
),
467 'thumb': (scrub_asm_arm_eabi
, ASM_FUNCTION_ARM_RE
),
468 'thumb-macho': (scrub_asm_arm_eabi
, ASM_FUNCTION_ARM_MACHO_RE
),
469 'thumbv5-macho': (scrub_asm_arm_eabi
, ASM_FUNCTION_ARM_MACHO_RE
),
470 'thumbv7s-apple-darwin' : (scrub_asm_arm_eabi
, ASM_FUNCTION_THUMBS_DARWIN_RE
),
471 'thumbv7-apple-darwin' : (scrub_asm_arm_eabi
, ASM_FUNCTION_THUMB_DARWIN_RE
),
472 'thumbv7-apple-ios' : (scrub_asm_arm_eabi
, ASM_FUNCTION_ARM_IOS_RE
),
473 'm68k': (scrub_asm_m68k
, ASM_FUNCTION_M68K_RE
),
474 'mips': (scrub_asm_mips
, ASM_FUNCTION_MIPS_RE
),
475 'msp430': (scrub_asm_msp430
, ASM_FUNCTION_MSP430_RE
),
476 'avr': (scrub_asm_avr
, ASM_FUNCTION_AVR_RE
),
477 'ppc32': (scrub_asm_powerpc
, ASM_FUNCTION_PPC_RE
),
478 'powerpc': (scrub_asm_powerpc
, ASM_FUNCTION_PPC_RE
),
479 'riscv32': (scrub_asm_riscv
, ASM_FUNCTION_RISCV_RE
),
480 'riscv64': (scrub_asm_riscv
, ASM_FUNCTION_RISCV_RE
),
481 'lanai': (scrub_asm_lanai
, ASM_FUNCTION_LANAI_RE
),
482 'sparc': (scrub_asm_sparc
, ASM_FUNCTION_SPARC_RE
),
483 's390x': (scrub_asm_systemz
, ASM_FUNCTION_SYSTEMZ_RE
),
484 'wasm32': (scrub_asm_wasm32
, ASM_FUNCTION_WASM32_RE
),
485 've': (scrub_asm_ve
, ASM_FUNCTION_VE_RE
),
486 'csky': (scrub_asm_csky
, ASM_FUNCTION_CSKY_RE
),
487 'nvptx': (scrub_asm_nvptx
, ASM_FUNCTION_NVPTX_RE
),
488 'loongarch32': (scrub_asm_loongarch
, ASM_FUNCTION_LOONGARCH_RE
),
489 'loongarch64': (scrub_asm_loongarch
, ASM_FUNCTION_LOONGARCH_RE
)
493 for prefix
, s
in target_handlers
.items():
494 if triple
.startswith(prefix
) and len(prefix
) > len(best_prefix
):
499 raise KeyError('Triple %r is not supported' % (triple
))
503 ##### Generator of assembly CHECK lines
505 def add_checks(output_lines
, comment_marker
, prefix_list
, func_dict
,
506 func_name
, global_vars_seen_dict
, is_filtered
):
507 # Label format is based on ASM string.
508 check_label_format
= '{} %s-LABEL: %s%s%s'.format(comment_marker
)
509 return common
.add_checks(output_lines
, comment_marker
, prefix_list
, func_dict
,
510 func_name
, check_label_format
, True, False,
511 global_vars_seen_dict
, is_filtered
=is_filtered
)