[PATCH] D92722: [TableGen] [CodeGenTarget] Cache the target's instruction namespace
Paul C. Anagnostopoulos via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 6 08:09:25 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0b3e393d6c8b: [TableGen] [CodeGenTarget] Cache the target's instruction namespace. (authored by Paul-C-Anagnostopoulos).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92722/new/
https://reviews.llvm.org/D92722
Files:
llvm/utils/TableGen/CodeGenTarget.cpp
llvm/utils/TableGen/CodeGenTarget.h
Index: llvm/utils/TableGen/CodeGenTarget.h
===================================================================
--- llvm/utils/TableGen/CodeGenTarget.h
+++ llvm/utils/TableGen/CodeGenTarget.h
@@ -60,6 +60,7 @@
mutable std::unique_ptr<CodeGenSchedModels> SchedModels;
+ mutable StringRef InstNamespace;
mutable std::vector<const CodeGenInstruction*> InstrsByEnum;
mutable unsigned NumPseudoInstructions = 0;
public:
Index: llvm/utils/TableGen/CodeGenTarget.cpp
===================================================================
--- llvm/utils/TableGen/CodeGenTarget.cpp
+++ llvm/utils/TableGen/CodeGenTarget.cpp
@@ -264,15 +264,20 @@
return TargetRec->getName();
}
+/// getInstNamespace - Find and return the target machine's instruction
+/// namespace. The namespace is cached because it is requested multiple times.
StringRef CodeGenTarget::getInstNamespace() const {
- for (const CodeGenInstruction *Inst : getInstructionsByEnumValue()) {
- // Make sure not to pick up "TargetOpcode" by accidentally getting
- // the namespace off the PHI instruction or something.
- if (Inst->Namespace != "TargetOpcode")
- return Inst->Namespace;
+ if (InstNamespace.empty()) {
+ for (const CodeGenInstruction *Inst : getInstructionsByEnumValue()) {
+ // We are not interested in the "TargetOpcode" namespace.
+ if (Inst->Namespace != "TargetOpcode") {
+ InstNamespace = Inst->Namespace;
+ break;
+ }
+ }
}
- return "";
+ return InstNamespace;
}
StringRef CodeGenTarget::getRegNamespace() const {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92722.309771.patch
Type: text/x-patch
Size: 1568 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201206/b17319a0/attachment.bin>
More information about the llvm-commits
mailing list