summaryrefslogtreecommitdiffstats
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
commit81129177a3e6df1c1135b8a9ab0a173fe570d820 (patch)
tree5d676a682bf9e5f514c548ccb368eabe0f5d6b04
parent7828ff9535e114fa1a50887afc11ed5d58ce29e5 (diff)
downloadbcm5719-llvm-81129177a3e6df1c1135b8a9ab0a173fe570d820.tar.gz
bcm5719-llvm-81129177a3e6df1c1135b8a9ab0a173fe570d820.zip
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. llvm-svn: 97214
-rw-r--r--llvm/utils/TableGen/DAGISelMatcher.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/utils/TableGen/DAGISelMatcher.h b/llvm/utils/TableGen/DAGISelMatcher.h
index 6599b21e934..df6389555b4 100644
--- a/llvm/utils/TableGen/DAGISelMatcher.h
+++ b/llvm/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;
OpenPOWER on IntegriCloud