llvm.org GIT mirror llvm / a3ad9bd
[utils] Add RISC-V support to update_llc_test_checks.py This should be a trivial change, and I've started using it for generating all tests at https://github.com/lowrisc/riscv-llvm (i.e. it's been tested in action quite a lot). Note that the regex does not attempt to match .cfi_startproc, as I want to ensure compatibility with functions that have the nounwind attribute. Differential Revision: https://reviews.llvm.org/D39789 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317693 91177308-0d34-0410-b5e6-96231b3b80d8 Alex Bradbury 1 year, 11 months ago
1 changed file(s) with 18 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
5454 r'(?P.*?)\n'
5555 # This list is incomplete
5656 r'(?:^[ \t]*(?:\.long[ \t]+[^\n]+|\.quad[ \t]+[^\n]+)\n)*'
57 r'.Lfunc_end[0-9]+:\n',
58 flags=(re.M | re.S))
59
60 ASM_FUNCTION_RISCV_RE = re.compile(
61 r'^_?(?P[^:]+):[ \t]*#+[ \t]*@(?P=func)\n[^:]*?'
62 r'(?P^##?[ \t]+[^:]+:.*?)\s*'
5763 r'.Lfunc_end[0-9]+:\n',
5864 flags=(re.M | re.S))
5965
134140 asm = SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
135141 return asm
136142
143 def scrub_asm_riscv(asm):
144 # Scrub runs of whitespace out of the assembly, but leave the leading
145 # whitespace in place.
146 asm = SCRUB_WHITESPACE_RE.sub(r' ', asm)
147 # Expand the tabs used for indentation.
148 asm = string.expandtabs(asm, 2)
149 # Strip trailing whitespace.
150 asm = SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
151 return asm
152
137153 def scrub_asm_systemz(asm, args):
138154 # Scrub runs of whitespace out of the assembly, but leave the leading
139155 # whitespace in place.
160176 'armeb-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
161177 'powerpc64': (scrub_asm_powerpc64, ASM_FUNCTION_PPC_RE),
162178 'powerpc64le': (scrub_asm_powerpc64, ASM_FUNCTION_PPC_RE),
179 'riscv32': (scrub_asm_riscv, ASM_FUNCTION_RISCV_RE),
180 'riscv64': (scrub_asm_riscv, ASM_FUNCTION_RISCV_RE),
163181 's390x': (scrub_asm_systemz, ASM_FUNCTION_SYSTEMZ_RE),
164182 }
165183 handlers = None