aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCContext.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2024-07-22 09:03:05 -0700
committerGitHub <noreply@github.com>2024-07-22 09:03:05 -0700
commit4010ddf780d90c42877c9ab8d28b7e084cfe197e (patch)
tree81bf3157a193a76699333e4ac4290f47d0a220a0 /llvm/lib/MC/MCContext.cpp
parentd7e185cca98411e82655feecc297906cb7ed0850 (diff)
downloadllvm-4010ddf780d90c42877c9ab8d28b7e084cfe197e.zip
llvm-4010ddf780d90c42877c9ab8d28b7e084cfe197e.tar.gz
llvm-4010ddf780d90c42877c9ab8d28b7e084cfe197e.tar.bz2
[MC,AArch64] Create mapping symbols with non-unique names
Add `createLocalSymbol` to create a local, non-temporary symbol. Different from `createRenamableSymbol`, the `Used` bit is ignored, therefore multiple local symbols might share the same name. Utilizing `createLocalSymbol` in AArch64 allows for efficient mapping symbol creation with non-unique names, saving .strtab space. The behavior matches GNU assembler. Pull Request: https://github.com/llvm/llvm-project/pull/99836
Diffstat (limited to 'llvm/lib/MC/MCContext.cpp')
-rw-r--r--llvm/lib/MC/MCContext.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp
index 44853f3..228c4fb 100644
--- a/llvm/lib/MC/MCContext.cpp
+++ b/llvm/lib/MC/MCContext.cpp
@@ -349,6 +349,11 @@ MCSymbol *MCContext::createNamedTempSymbol() {
return createNamedTempSymbol("tmp");
}
+MCSymbol *MCContext::createLocalSymbol(StringRef Name) {
+ MCSymbolTableEntry &NameEntry = getSymbolTableEntry(Name);
+ return createSymbolImpl(&NameEntry, /*IsTemporary=*/false);
+}
+
unsigned MCContext::NextInstance(unsigned LocalLabelVal) {
MCLabel *&Label = Instances[LocalLabelVal];
if (!Label)