aboutsummaryrefslogtreecommitdiff
path: root/llvm/utils/UpdateTestChecks/asm.py
diff options
context:
space:
mode:
authorJessica Clarke <jrtc27@jrtc27.com>2025-05-18 20:09:43 +0100
committerGitHub <noreply@github.com>2025-05-18 20:09:43 +0100
commit1b41599cf8972abbf0d2ee7595dba78a4b158af0 (patch)
treedc73a47a91632a5cd504ee4b9e8781753cb59675 /llvm/utils/UpdateTestChecks/asm.py
parent5fa985e751c8f890fff31e190473aeeb6f7a9fc5 (diff)
downloadllvm-1b41599cf8972abbf0d2ee7595dba78a4b158af0.zip
llvm-1b41599cf8972abbf0d2ee7595dba78a4b158af0.tar.gz
llvm-1b41599cf8972abbf0d2ee7595dba78a4b158af0.tar.bz2
[MC][AArch64][ARM][X86] Push target-dependent assembler flags into targets (#139844)
The .syntax unified directive and .codeX/.code X directives are, other than some simple common printing code, exclusively implemented in the targets themselves. Thus, remove the corresponding MCAF_* flags and reimplement the directives solely within the targets. This avoids exposing all targets to all other targets' flags. Since MCAF_SubsectionsViaSymbols is all that remains, convert it to its own function like other directives, simplifying its implementation. Note that, on X86, we now always need a target streamer when parsing assembly, as it's now used for directives that aren't COFF-specific. It still does not however need to do anything when producing a non-COFF object file, so this commit does not introduce any new target streamers. There is some churn in test output, and corresponding UTC regex changes, due to comments no longer being flushed by these various directives (and EmitEOL is not exposed outside MCAsmStreamer.cpp so we couldn't do so even if we wanted to), but that was a bit odd to be doing anyway. This is motivated by Morello LLVM, which adds yet another assembler flag to distinguish A64 and C64 instruction sets, but did not update every switch and so emits warnings during the build. Rather than fix those warnings it seems better to instead make the problem not exist in the first place via this change.
Diffstat (limited to 'llvm/utils/UpdateTestChecks/asm.py')
-rw-r--r--llvm/utils/UpdateTestChecks/asm.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/llvm/utils/UpdateTestChecks/asm.py b/llvm/utils/UpdateTestChecks/asm.py
index 7d4fb7d..da7e7ec 100644
--- a/llvm/utils/UpdateTestChecks/asm.py
+++ b/llvm/utils/UpdateTestChecks/asm.py
@@ -32,7 +32,7 @@ ASM_FUNCTION_X86_RE = re.compile(
)
ASM_FUNCTION_ARM_RE = re.compile(
- r"^(?P<func>[0-9a-zA-Z_$]+):\n" # f: (name of function)
+ r'^(?P<func>[0-9a-zA-Z_$]+):[ \t]*@+[ \t]*@"?(?P=func)"?\n' # f: (name of function)
r"(?:\.L(?P=func)\$local:\n)?" # drop .L<func>$local:
r"(?:\s*\.type\s+\.L(?P=func)\$local,@function\n)?" # drop .type .L<func>$local
r"\s+\.fnstart\n" # .fnstart
@@ -175,7 +175,7 @@ ASM_FUNCTION_ARM_DARWIN_RE = re.compile(
)
ASM_FUNCTION_ARM_MACHO_RE = re.compile(
- r"^_(?P<func>[^:]+):[ \t]*\n"
+ r'^_(?P<func>[^:]+):[ \t]*@[ \t]@"?(?P=func)"?\n'
r"([ \t]*.cfi_startproc\n[ \t]*)?"
r"(?P<body>.*?)\n"
r"[ \t]*\.cfi_endproc\n",
@@ -183,17 +183,23 @@ ASM_FUNCTION_ARM_MACHO_RE = re.compile(
)
ASM_FUNCTION_THUMBS_DARWIN_RE = re.compile(
- r"^_(?P<func>[^:]+):\n" r"(?P<body>.*?)\n" r"[ \t]*\.data_region\n",
+ r'^_(?P<func>[^:]+):[ \t]*@[ \t]@"?(?P=func)"?\n'
+ r"(?P<body>.*?)\n"
+ r"[ \t]*\.data_region\n",
flags=(re.M | re.S),
)
ASM_FUNCTION_THUMB_DARWIN_RE = re.compile(
- r"^_(?P<func>[^:]+):\n" r"(?P<body>.*?)\n" r"^[ \t]*@[ \t]--[ \t]End[ \t]function",
+ r'^_(?P<func>[^:]+):[ \t]*@[ \t]@"?(?P=func)"?\n'
+ r"(?P<body>.*?)\n"
+ r"^[ \t]*@[ \t]--[ \t]End[ \t]function",
flags=(re.M | re.S),
)
ASM_FUNCTION_ARM_IOS_RE = re.compile(
- r"^_(?P<func>[^:]+):\n" r"(?P<body>.*?)" r"^[ \t]*@[ \t]--[ \t]End[ \t]function",
+ r'^_(?P<func>[^:]+):[ \t]*@[ \t]@"?(?P=func)"?\n'
+ r"(?P<body>.*?)"
+ r"^[ \t]*@[ \t]--[ \t]End[ \t]function",
flags=(re.M | re.S),
)