summaryrefslogtreecommitdiff
path: root/include/llvm/TableGen
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2011-10-19 13:04:13 +0000
committerDavid Greene <greened@obbligato.org>2011-10-19 13:04:13 +0000
commite338565757bfcfe9d762751c976684f66954fb45 (patch)
tree53efedeb81f0056894aa09af2c241dd0cf291d19 /include/llvm/TableGen
parent22dde7e655b76f75bf11e86129410a7dcbfac3ba (diff)
downloadllvm-e338565757bfcfe9d762751c976684f66954fb45.tar.gz
llvm-e338565757bfcfe9d762751c976684f66954fb45.tar.bz2
llvm-e338565757bfcfe9d762751c976684f66954fb45.tar.xz
Add NAME Member
Add a Value named "NAME" to each Record. This will be set to the def or defm name when instantiating multiclasses. This will replace the #NAME# processing hack once paste functionality is in place. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142518 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/TableGen')
-rw-r--r--include/llvm/TableGen/Record.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/llvm/TableGen/Record.h b/include/llvm/TableGen/Record.h
index f7a48c4dfb..0cf1725a98 100644
--- a/include/llvm/TableGen/Record.h
+++ b/include/llvm/TableGen/Record.h
@@ -1473,6 +1473,13 @@ public:
void addValue(const RecordVal &RV) {
assert(getValue(RV.getName()) == 0 && "Value already added!");
Values.push_back(RV);
+ if (Values.size() > 1)
+ // Keep NAME at the end of the list. It makes record dumps a
+ // bit prettier and allows TableGen tests to be written more
+ // naturally. Tests can use CHECK-NEXT to look for Record
+ // fields they expect to see after a def. They can't do that if
+ // NAME is the first Record field.
+ std::swap(Values[Values.size() - 2], Values[Values.size() - 1]);
}
void removeValue(Init *Name) {