diff options
| author | Arthur Eubanks <aeubanks@google.com> | 2024-06-27 16:32:27 -0700 |
|---|---|---|
| committer | shawbyoung <shawbyoung@gmail.com> | 2024-06-27 16:32:27 -0700 |
| commit | f5c7df12cacdb84552b36a7ac598a8db41acc680 (patch) | |
| tree | 3b33e941b9bfb88c40c64fd18ee32a633423cbed /llvm/utils/TableGen/Common/CodeGenRegisters.cpp | |
| parent | 608880c3a7a59c86db82728067e553a8d4665a45 (diff) | |
| parent | 804415825b97e974c96a92580bcbeaf4c7ff0a04 (diff) | |
[𝘀𝗽𝗿] changes introduced through rebaseusers/shawbyoung/spr/main.boltnfc-refactoring-callgraph
Created using spr 1.3.4
[skip ci]
Diffstat (limited to 'llvm/utils/TableGen/Common/CodeGenRegisters.cpp')
| -rw-r--r-- | llvm/utils/TableGen/Common/CodeGenRegisters.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/utils/TableGen/Common/CodeGenRegisters.cpp b/llvm/utils/TableGen/Common/CodeGenRegisters.cpp index 3c868b1e8f4f..b5a6c1395c60 100644 --- a/llvm/utils/TableGen/Common/CodeGenRegisters.cpp +++ b/llvm/utils/TableGen/Common/CodeGenRegisters.cpp @@ -22,6 +22,7 @@ #include "llvm/ADT/SmallSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" +#include "llvm/ADT/StringSet.h" #include "llvm/ADT/Twine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" @@ -618,6 +619,9 @@ struct TupleExpander : SetTheory::Expander { // the synthesized definitions for their lifetime. std::vector<std::unique_ptr<Record>> &SynthDefs; + // Track all synthesized tuple names in order to detect duplicate definitions. + llvm::StringSet<> TupleNames; + TupleExpander(std::vector<std::unique_ptr<Record>> &SynthDefs) : SynthDefs(SynthDefs) {} @@ -684,6 +688,12 @@ struct TupleExpander : SetTheory::Expander { Record *NewReg = SynthDefs.back().get(); Elts.insert(NewReg); + // Detect duplicates among synthesized registers. + const auto Res = TupleNames.insert(NewReg->getName()); + if (!Res.second) + PrintFatalError(Def->getLoc(), + "Register tuple redefines register '" + Name + "'."); + // Copy Proto super-classes. ArrayRef<std::pair<Record *, SMRange>> Supers = Proto->getSuperClasses(); for (const auto &SuperPair : Supers) |
