[all-commits] [llvm/llvm-project] f4de28: [StrTable] Switch intrinsics to StringTable and wo...
Chandler Carruth via All-commits
all-commits at lists.llvm.org
Tue Jan 28 00:17:26 PST 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: f4de28a63c81c909df28b6b065fad19e2189c54e
https://github.com/llvm/llvm-project/commit/f4de28a63c81c909df28b6b065fad19e2189c54e
Author: Chandler Carruth <chandlerc at gmail.com>
Date: 2025-01-28 (Tue, 28 Jan 2025)
Changed paths:
M clang/utils/TableGen/ClangDiagnosticsEmitter.cpp
M llvm/include/llvm/ADT/StringTable.h
M llvm/include/llvm/TableGen/StringToOffsetTable.h
M llvm/lib/IR/Intrinsics.cpp
M llvm/test/TableGen/MixedCasedMnemonic.td
M llvm/test/TableGen/SDNodeInfoEmitter/ambiguous-constraints.td
M llvm/test/TableGen/SDNodeInfoEmitter/basic.td
M llvm/test/TableGen/SDNodeInfoEmitter/namespace.td
M llvm/test/TableGen/SDNodeInfoEmitter/skipped-nodes.td
M llvm/utils/TableGen/Basic/IntrinsicEmitter.cpp
M llvm/utils/TableGen/OptionParserEmitter.cpp
M llvm/utils/TableGen/SDNodeInfoEmitter.cpp
Log Message:
-----------
[StrTable] Switch intrinsics to StringTable and work around MSVC (#123548)
Historically, the main example of *very* large string tables used the
`EmitCharArray` to work around MSVC limitations with string literals,
but that was switched (without removing the API) in order to consolidate
on a nicer emission primitive.
While this large string table in `IntrinsicsImpl.inc` seems to compile
correctly on MSVC without the work around in `EmitCharArray` (and that
this PR adds back to the nicer emission path), other users have
repeatedly hit this MSVC limitation as you can see in the discussion on
PR https://github.com/llvm/llvm-project/pull/120534. This PR teaches the
string offset table emission to look at
the size of the table and switch to the char array emission strategy
when the table becomes too large.
This work around does have the downside of making compile times worse
for large string tables, but that appears unavoidable until we can
identify known good MSVC versions and switch to requiring them for all
LLVM users. It also reduces searchability of the generated string table
-- I looked at emitting a comment with each string but it is tricky
because the escaping rules for an inline comment are different from
those of of a string literal, and there's no real way to turn the string
literal into a comment.
While improving the output in this way, also clean up the output to not
emit an extraneous empty string at the end of the string table, and
update the `StringTable` class to not look for that. It isn't actually
used by anything and is wasteful.
This PR also switches the `IntrinsicsImpl.inc` string tables over to the
new `StringTable` runtime abstraction. I didn't want to do this until
landing the MSVC workaround in case it caused even this example to start
hitting the MSVC bug, but I wanted to switch here so that I could
simplify the API for emitting the string table with the workaround
present. With the two different emission strategies, its important to
use a very exact syntax and that seems better encapsulated in the API.
Last but not least, the `SDNodeInfoEmitter` is updated, including its
tests to match the new output.
This PR should unblock landing
https://github.com/llvm/llvm-project/pull/120534 and letting us switch
all of
Clang's builtins to use string tables. That PR has all the details
motivating the overall effort.
Follow-up patches will try to consolidate the remaining users onto the
single interface, but those at least were easy to separate into
follow-ups and keep this PR somewhat smaller.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list