summaryrefslogtreecommitdiff
path: root/utils/TableGen/Record.h
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2011-07-29 19:07:16 +0000
committerDavid Greene <greened@obbligato.org>2011-07-29 19:07:16 +0000
commitaad4c9fc37b38cae21343173084c81d789535446 (patch)
treea89ed5dd8b537809a3353409ec6edda0ff0f5b26 /utils/TableGen/Record.h
parent637b4ffa01f42a6df598d4fc367d645a600128e1 (diff)
downloadllvm-aad4c9fc37b38cae21343173084c81d789535446.tar.gz
llvm-aad4c9fc37b38cae21343173084c81d789535446.tar.bz2
llvm-aad4c9fc37b38cae21343173084c81d789535446.tar.xz
[AVX] Make ListInits Unique
Ensure ListInits are unique and only created once. This will be important for AVX as lists will be used extensively to pass generic patterns, prefix information and other things to lower-level pattern-generation classes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136493 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/Record.h')
-rw-r--r--utils/TableGen/Record.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/utils/TableGen/Record.h b/utils/TableGen/Record.h
index e70cad1a32..cbde0e9bdb 100644
--- a/utils/TableGen/Record.h
+++ b/utils/TableGen/Record.h
@@ -1,3 +1,4 @@
+
//===- Record.h - Classes to represent Table Records ------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
@@ -801,15 +802,12 @@ public:
/// ListInit - [AL, AH, CL] - Represent a list of defs
///
-class ListInit : public TypedInit {
+class ListInit : public TypedInit, public FoldingSetNode {
std::vector<const Init*> Values;
public:
typedef std::vector<const Init*>::const_iterator const_iterator;
- explicit ListInit(std::vector<const Init*> &Vs, RecTy *EltTy)
- : TypedInit(ListRecTy::get(EltTy)) {
- Values.swap(Vs);
- }
+private:
explicit ListInit(ArrayRef<const Init *> Range, RecTy *EltTy)
: TypedInit(ListRecTy::get(EltTy)), Values(Range.begin(), Range.end()) {}
@@ -819,6 +817,8 @@ public:
public:
static const ListInit *get(ArrayRef<const Init *> Range, RecTy *EltTy);
+ void Profile(FoldingSetNodeID &ID) const;
+
unsigned getSize() const { return Values.size(); }
const Init *getElement(unsigned i) const {
assert(i < Values.size() && "List element index out of range!");