-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[TableGen] Use llvm::interleaved (NFC) #137483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kazutakahirata
merged 1 commit into
llvm:main
from
kazutakahirata:cleanup_001_interleaved_TableGen
Apr 27, 2025
Merged
[TableGen] Use llvm::interleaved (NFC) #137483
kazutakahirata
merged 1 commit into
llvm:main
from
kazutakahirata:cleanup_001_interleaved_TableGen
Apr 27, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@llvm/pr-subscribers-tablegen Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/137483.diff 2 Files Affected:
diff --git a/llvm/utils/TableGen/CallingConvEmitter.cpp b/llvm/utils/TableGen/CallingConvEmitter.cpp
index c94d294db547a..d2700816b0ad0 100644
--- a/llvm/utils/TableGen/CallingConvEmitter.cpp
+++ b/llvm/utils/TableGen/CallingConvEmitter.cpp
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "Common/CodeGenTarget.h"
+#include "llvm/Support/InterleavedRange.h"
#include "llvm/TableGen/Error.h"
#include "llvm/TableGen/Record.h"
#include "llvm/TableGen/TGTimer.h"
@@ -395,22 +396,16 @@ void CallingConvEmitter::emitArgRegisterLists(raw_ostream &O) {
O << "\n#else\n\n";
- for (auto &Entry : AssignedRegsMap) {
- const std::string &RegName = Entry.first;
- std::set<std::string> &Registers = Entry.second;
-
+ for (const auto &[RegName, Registers] : AssignedRegsMap) {
if (RegName.empty())
continue;
- O << "const MCRegister " << Entry.first << "_ArgRegs[] = { ";
+ O << "const MCRegister " << RegName << "_ArgRegs[] = { ";
- if (Registers.empty()) {
+ if (Registers.empty())
O << "0";
- } else {
- ListSeparator LS;
- for (const std::string &Reg : Registers)
- O << LS << Reg;
- }
+ else
+ O << llvm::interleaved(Registers);
O << " };\n";
}
@@ -419,18 +414,9 @@ void CallingConvEmitter::emitArgRegisterLists(raw_ostream &O) {
return;
O << "\n// Registers used by Swift.\n";
- for (auto &Entry : AssignedSwiftRegsMap) {
- const std::string &RegName = Entry.first;
- std::set<std::string> &Registers = Entry.second;
-
- O << "const MCRegister " << RegName << "_Swift_ArgRegs[] = { ";
-
- ListSeparator LS;
- for (const std::string &Reg : Registers)
- O << LS << Reg;
-
- O << " };\n";
- }
+ for (const auto &[RegName, Registers] : AssignedSwiftRegsMap)
+ O << "const MCRegister " << RegName << "_Swift_ArgRegs[] = { "
+ << llvm::interleaved(Registers) << " };\n";
}
static TableGen::Emitter::OptClass<CallingConvEmitter>
diff --git a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
index 615c077fe4bdc..20b313d4428db 100644
--- a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
+++ b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
@@ -24,6 +24,7 @@
#include "llvm/ADT/Twine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/InterleavedRange.h"
#include "llvm/Support/TypeSize.h"
#include "llvm/TableGen/Error.h"
#include "llvm/TableGen/Record.h"
@@ -3217,13 +3218,8 @@ bool TreePattern::InferAllTypes(
void TreePattern::print(raw_ostream &OS) const {
OS << getRecord()->getName();
- if (!Args.empty()) {
- OS << "(";
- ListSeparator LS;
- for (const std::string &Arg : Args)
- OS << LS << Arg;
- OS << ")";
- }
+ if (!Args.empty())
+ OS << '(' << llvm::interleaved(Args) << ')';
OS << ": ";
if (Trees.size() > 1)
|
kuhar
reviewed
Apr 27, 2025
kuhar
approved these changes
Apr 27, 2025
jyli0116
pushed a commit
to jyli0116/llvm-project
that referenced
this pull request
Apr 28, 2025
IanWood1
pushed a commit
to IanWood1/llvm-project
that referenced
this pull request
May 6, 2025
IanWood1
pushed a commit
to IanWood1/llvm-project
that referenced
this pull request
May 6, 2025
IanWood1
pushed a commit
to IanWood1/llvm-project
that referenced
this pull request
May 6, 2025
Ankur-0429
pushed a commit
to Ankur-0429/llvm-project
that referenced
this pull request
May 9, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.