summaryrefslogtreecommitdiff
path: root/utils/TableGen/Record.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-03-25 18:52:01 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-03-25 18:52:01 +0000
commit70feca409e3a79c3d9295cbc81c257de6be8ef3e (patch)
treed727cf17e34cd493b02e9d588053137d768f01f1 /utils/TableGen/Record.cpp
parent7bf198fd607b356e767e0577cac81c3491c4bc90 (diff)
downloadllvm-70feca409e3a79c3d9295cbc81c257de6be8ef3e.tar.gz
llvm-70feca409e3a79c3d9295cbc81c257de6be8ef3e.tar.bz2
llvm-70feca409e3a79c3d9295cbc81c257de6be8ef3e.tar.xz
Teach TableGen to understand X.Y notation in the TSFlagsFields strings.
Remove much horribleness from X86InstrFormats as a result. Similar simplifications are probably possible for other targets. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99539 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/Record.cpp')
-rw-r--r--utils/TableGen/Record.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/utils/TableGen/Record.cpp b/utils/TableGen/Record.cpp
index 0e3593b6a1..55c998926c 100644
--- a/utils/TableGen/Record.cpp
+++ b/utils/TableGen/Record.cpp
@@ -1307,6 +1307,16 @@ void Record::resolveReferencesTo(const RecordVal *RV) {
}
}
+RecordVal *Record::getDottedValue(StringRef Name) {
+ size_t pos = Name.find('.');
+ if (pos == StringRef::npos)
+ return getValue(Name);
+ RecordVal *RV = getValue(Name.substr(0, pos));
+ if (!RV) return 0;
+ DefInit *DI = dynamic_cast<DefInit*>(RV->getValue());
+ if (!DI) return 0;
+ return DI->getDef()->getDottedValue(Name.substr(pos+1));
+}
void Record::dump() const { errs() << *this; }