llvm.org GIT mirror llvm / 5dae52e
[NFC] Improve triple match of scripts that update tests Summary: The prior behavior of the triple matcher would stop in the first matched triple. It was not possible to create specific matches for sub-sets of a triple (e.g aarch64-apple-darwin would never be used after aarch64 was matched). This patch: 1) Allows that specialized triples take priority, considering that the string lenght of the triple indentifies how specialized a triple is. If two triples of same lenght match, the one matched first prevails, preserving the old behavior. 2) Remove 20 duplicated triples of arm, thumb, aarch64 options with same arguments, matching the common prefix (aarch64, arm, thumb) of them. 3) Creates three new function matching regexes and five triple options for arm64-apple-ios, (arm|thumb)-apple-ios and thumb(v5)?-macho Reviewers: lebedev.ri, RKSimon, MaskRay, gbedwell Reviewed By: MaskRay Subscribers: javed.absar, kristof.beyls, llvm-commits, carwil Tags: #llvm Differential Revision: https://reviews.llvm.org/D63145 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363656 91177308-0d34-0410-b5e6-96231b3b80d8 Diogo N. Sampaio 27 days ago
1 changed file(s) with 40 addition(s) and 29 deletion(s). Raw diff Collapse all Expand all
9494 r'(?P.*?)\n'
9595 r'.Lfunc_end[0-9]+:\n',
9696 flags=(re.M | re.S))
97
98 ASM_FUNCTION_AARCH64_DARWIN_RE = re.compile(
99 r'^_(?P[^:]+):[ \t]*;[ \t]@(?P=func)\n'
100 r'([ \t]*.cfi_startproc\n[\s]*)?'
101 r'(?P.*?)'
102 r'([ \t]*.cfi_endproc\n[\s]*)?'
103 r'^[ \t]*;[ \t]--[ \t]End[ \t]function',
104 flags=(re.M | re.S))
105
106 ASM_FUNCTION_ARM_MACHO_RE = re.compile(
107 r'^_(?P[^:]+):[ \t]*\n'
108 r'([ \t]*.cfi_startproc\n[ \t]*)?'
109 r'(?P.*?)\n'
110 r'[ \t]*\.cfi_endproc\n',
111 flags=(re.M | re.S))
112
113 ASM_FUNCTION_ARM_IOS_RE = re.compile(
114 r'^_(?P[^:]+):[ \t]*\n'
115 r'^Lfunc_begin(?P[0-9][1-9]*):\n'
116 r'(?P.*?)'
117 r'^Lfunc_end(?P=id):\n'
118 r'^[ \t]*@[ \t]--[ \t]End[ \t]function',
119 flags=(re.M | re.S))
97120
98121 ASM_FUNCTION_WASM32_RE = re.compile(
99122 r'^_?(?P[^:]+):[ \t]*#+[ \t]*@(?P=func)\n'
269292 'i686': (scrub_asm_x86, ASM_FUNCTION_X86_RE),
270293 'x86': (scrub_asm_x86, ASM_FUNCTION_X86_RE),
271294 'i386': (scrub_asm_x86, ASM_FUNCTION_X86_RE),
272 'arm64-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_AARCH64_RE),
273295 'aarch64': (scrub_asm_arm_eabi, ASM_FUNCTION_AARCH64_RE),
296 'aarch64-apple-darwin': (scrub_asm_arm_eabi, ASM_FUNCTION_AARCH64_DARWIN_RE),
274297 'hexagon': (scrub_asm_hexagon, ASM_FUNCTION_HEXAGON_RE),
275298 'r600': (scrub_asm_amdgpu, ASM_FUNCTION_AMDGPU_RE),
276299 'amdgcn': (scrub_asm_amdgpu, ASM_FUNCTION_AMDGPU_RE),
277 'arm-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
278 'thumb-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
279 'thumbv6': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
280 'thumbv6-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
281 'thumbv6t2': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
282 'thumbv6t2-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
283 'thumbv6m': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
284 'thumbv6m-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
285 'thumbv7': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
286 'thumbv7-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
287 'thumbv7m': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
288 'thumbv7m-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
289 'thumbv8-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
290 'thumbv8m.base': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
291 'thumbv8m.main': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
292 'armv6': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
293 'armv7': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
294 'armv7-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
295 'armeb-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
296 'armv7eb-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
297 'armv7eb': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
298 'armv8a': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
300 'arm': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
301 'arm64': (scrub_asm_arm_eabi, ASM_FUNCTION_AARCH64_RE),
302 'arm64-apple-ios': (scrub_asm_arm_eabi, ASM_FUNCTION_AARCH64_DARWIN_RE),
303 'armv7-apple-ios' : (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_IOS_RE),
304 'thumb': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
305 'thumb-macho': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_MACHO_RE),
306 'thumbv5-macho': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_MACHO_RE),
307 'thumbv7-apple-ios' : (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_IOS_RE),
299308 'mips': (scrub_asm_mips, ASM_FUNCTION_MIPS_RE),
300309 'ppc32': (scrub_asm_powerpc, ASM_FUNCTION_PPC_RE),
301310 'powerpc64': (scrub_asm_powerpc, ASM_FUNCTION_PPC_RE),
308317 's390x': (scrub_asm_systemz, ASM_FUNCTION_SYSTEMZ_RE),
309318 'wasm32': (scrub_asm_wasm32, ASM_FUNCTION_WASM32_RE),
310319 }
311 handlers = None
320 handler = None
321 best_prefix = ''
312322 for prefix, s in target_handlers.items():
313 if triple.startswith(prefix):
314 handlers = s
315 break
316 else:
323 if triple.startswith(prefix) and len(prefix) > len(best_prefix):
324 handler = s
325 best_prefix = prefix
326
327 if handler is None:
317328 raise KeyError('Triple %r is not supported' % (triple))
318329
319 scrubber, function_re = handlers
330 scrubber, function_re = handler
320331 common.build_function_body_dictionary(
321332 function_re, scrubber, [args], raw_tool_output, prefixes,
322333 func_dict, args.verbose)