[llvm] 6025ee7 - [CSKY] Add python script of CSKY asm update test check
Zi Xuan Wu via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 4 23:59:56 PST 2022
Author: Zi Xuan Wu
Date: 2022-01-05T15:59:03+08:00
New Revision: 6025ee79ae9a9b90e53fc5ebd5d780da0cd45b4c
URL: https://github.com/llvm/llvm-project/commit/6025ee79ae9a9b90e53fc5ebd5d780da0cd45b4c
DIFF: https://github.com/llvm/llvm-project/commit/6025ee79ae9a9b90e53fc5ebd5d780da0cd45b4c.diff
LOG: [CSKY] Add python script of CSKY asm update test check
Added:
Modified:
llvm/utils/UpdateTestChecks/asm.py
Removed:
################################################################################
diff --git a/llvm/utils/UpdateTestChecks/asm.py b/llvm/utils/UpdateTestChecks/asm.py
index f876b6649df56..c24849bd99d41 100644
--- a/llvm/utils/UpdateTestChecks/asm.py
+++ b/llvm/utils/UpdateTestChecks/asm.py
@@ -172,6 +172,12 @@ class string:
r'.Lfunc_end[0-9]+:\n',
flags=(re.M | re.S))
+ASM_FUNCTION_CSKY_RE = re.compile(
+ r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@(?P=func)\n(?:\s*\.?Lfunc_begin[^:\n]*:\n)?[^:]*?'
+ r'(?P<body>^##?[ \t]+[^:]+:.*?)\s*'
+ r'.Lfunc_end[0-9]+:\n',
+ flags=(re.M | re.S))
+
SCRUB_X86_SHUFFLES_RE = (
re.compile(
r'^(\s*\w+) [^#\n]+#+ ((?:[xyz]mm\d+|mem)( \{%k\d+\}( \{z\})?)? = .*)$',
@@ -370,6 +376,18 @@ def scrub_asm_ve(asm, args):
asm = common.SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
return asm
+def scrub_asm_csky(asm, args):
+ # Scrub runs of whitespace out of the assembly, but leave the leading
+ # whitespace in place.
+ asm = common.SCRUB_WHITESPACE_RE.sub(r' ', asm)
+ # Expand the tabs used for indentation.
+ asm = string.expandtabs(asm, 2)
+ # Strip kill operands inserted into the asm.
+ asm = common.SCRUB_KILL_COMMENT_RE.sub('', asm)
+ # Strip trailing whitespace.
+ asm = common.SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
+ return asm
+
def get_triple_from_march(march):
triples = {
'amdgcn': 'amdgcn',
@@ -422,6 +440,7 @@ def get_run_handler(triple):
's390x': (scrub_asm_systemz, ASM_FUNCTION_SYSTEMZ_RE),
'wasm32': (scrub_asm_wasm32, ASM_FUNCTION_WASM32_RE),
've': (scrub_asm_ve, ASM_FUNCTION_VE_RE),
+ 'csky': (scrub_asm_csky, ASM_FUNCTION_CSKY_RE),
}
handler = None
best_prefix = ''
More information about the llvm-commits
mailing list