From e338565757bfcfe9d762751c976684f66954fb45 Mon Sep 17 00:00:00 2001 From: David Greene Date: Wed, 19 Oct 2011 13:04:13 +0000 Subject: 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 --- include/llvm/TableGen/Record.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/llvm/TableGen') 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) { -- cgit v1.2.3