summaryrefslogtreecommitdiff
path: root/utils/TableGen/DAGISelMatcher.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-02-26 07:35:27 +0000
committerChris Lattner <sabre@nondot.org>2010-02-26 07:35:27 +0000
commitca56feaf381db61ad1f07873235185ef33f6426f (patch)
treee2723fcf8cd0241bf51a5fc812fc391d2da7f7dc /utils/TableGen/DAGISelMatcher.h
parent651d85c2f20563b33a330dfadf746169bf290eca (diff)
downloadllvm-ca56feaf381db61ad1f07873235185ef33f6426f.tar.gz
llvm-ca56feaf381db61ad1f07873235185ef33f6426f.tar.bz2
llvm-ca56feaf381db61ad1f07873235185ef33f6426f.tar.xz
add a new setNumChildren method for resizing scopes. Tweak getHash() so
that we never return a tombstone value, which (thankfully) triggers an assert in densemap. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97214 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/DAGISelMatcher.h')
-rw-r--r--utils/TableGen/DAGISelMatcher.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/utils/TableGen/DAGISelMatcher.h b/utils/TableGen/DAGISelMatcher.h
index 6599b21e93..df6389555b 100644
--- a/utils/TableGen/DAGISelMatcher.h
+++ b/utils/TableGen/DAGISelMatcher.h
@@ -100,7 +100,8 @@ public:
}
unsigned getHash() const {
- return (getHashImpl() << 4) ^ getKind();
+ // Clear the high bit so we don't conflict with tombstones etc.
+ return ((getHashImpl() << 4) ^ getKind()) & (~0U>>1);
}
void print(raw_ostream &OS, unsigned indent = 0) const;
@@ -137,6 +138,15 @@ public:
Children[i] = 0;
return Res;
}
+
+ void setNumChildren(unsigned NC) {
+ if (NC < Children.size()) {
+ // delete any children we're about to lose pointers to.
+ for (unsigned i = NC, e = Children.size(); i != e; ++i)
+ delete Children[i];
+ }
+ Children.resize(NC);
+ }
static inline bool classof(const Matcher *N) {
return N->getKind() == Scope;