diff options
author | Fangrui Song <i@maskray.me> | 2024-07-22 09:03:05 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-22 09:03:05 -0700 |
commit | 4010ddf780d90c42877c9ab8d28b7e084cfe197e (patch) | |
tree | 81bf3157a193a76699333e4ac4290f47d0a220a0 /llvm/lib/MC/MCContext.cpp | |
parent | d7e185cca98411e82655feecc297906cb7ed0850 (diff) | |
download | llvm-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.cpp | 5 |
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) |