[llvm-commits] CVS: llvm/utils/TableGen/CodeGenRegisters.h CodeGenTarget.h
Chris Lattner
lattner at cs.uiuc.edu
Sun Dec 4 18:35:20 PST 2005
Changes in directory llvm/utils/TableGen:
CodeGenRegisters.h updated: 1.9 -> 1.10
CodeGenTarget.h updated: 1.20 -> 1.21
---
Log message:
Add some methods
---
Diffs of the changes: (+22 -1)
CodeGenRegisters.h | 2 ++
CodeGenTarget.h | 21 ++++++++++++++++++++-
2 files changed, 22 insertions(+), 1 deletion(-)
Index: llvm/utils/TableGen/CodeGenRegisters.h
diff -u llvm/utils/TableGen/CodeGenRegisters.h:1.9 llvm/utils/TableGen/CodeGenRegisters.h:1.10
--- llvm/utils/TableGen/CodeGenRegisters.h:1.9 Wed Nov 30 22:51:06 2005
+++ llvm/utils/TableGen/CodeGenRegisters.h Sun Dec 4 20:35:08 2005
@@ -42,6 +42,8 @@
const std::string &getName() const;
+ unsigned getNumValueTypes() const { return VTs.size(); }
+
const MVT::ValueType getValueTypeNum(unsigned VTNum) const {
if (VTNum < VTs.size())
return VTs[VTNum];
Index: llvm/utils/TableGen/CodeGenTarget.h
diff -u llvm/utils/TableGen/CodeGenTarget.h:1.20 llvm/utils/TableGen/CodeGenTarget.h:1.21
--- llvm/utils/TableGen/CodeGenTarget.h:1.20 Wed Nov 30 18:06:14 2005
+++ llvm/utils/TableGen/CodeGenTarget.h Sun Dec 4 20:35:08 2005
@@ -90,7 +90,26 @@
assert(0 && "Didn't find the register class");
abort();
}
-
+
+ /// getRegisterClassForRegister - Find the register class that contains the
+ /// specified physical register. If there register exists in multiple
+ /// register classes or is not in a register class, return null.
+ const CodeGenRegisterClass *getRegisterClassForRegister(Record *R) const {
+ const std::vector<CodeGenRegisterClass> &RCs = getRegisterClasses();
+ const CodeGenRegisterClass *FoundRC = 0;
+ for (unsigned i = 0, e = RCs.size(); i != e; ++i) {
+ const CodeGenRegisterClass &RC = RegisterClasses[i];
+ for (unsigned ei = 0, ee = RC.Elements.size(); ei != ee; ++ei) {
+ if (R == RC.Elements[ei]) {
+ if (FoundRC) return 0; // In multiple RC's
+ FoundRC = &RC;
+ break;
+ }
+ }
+ }
+ return FoundRC;
+ }
+
const std::vector<MVT::ValueType> &getLegalValueTypes() const {
if (LegalValueTypes.empty()) ReadLegalValueTypes();
return LegalValueTypes;
More information about the llvm-commits
mailing list