aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-04-26 03:27:58 +0000
committerChris Lattner <sabre@nondot.org>2007-04-26 03:27:58 +0000
commit831d420256e9c6ad4b94e33483ec4c136e1f571b (patch)
tree0647be952587cf1e175467168d27803f499de0e5 /llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
parentca3b44aa57f014465df530a320cea843fc2629a8 (diff)
downloadllvm-831d420256e9c6ad4b94e33483ec4c136e1f571b.zip
llvm-831d420256e9c6ad4b94e33483ec4c136e1f571b.tar.gz
llvm-831d420256e9c6ad4b94e33483ec4c136e1f571b.tar.bz2
move some code around, fix a bug in the reader reading globalinits (which
I just introduced), stub out function reading, purge aggregate values from the value table before reading functions. llvm-svn: 36463
Diffstat (limited to 'llvm/lib/Bitcode/Writer/ValueEnumerator.cpp')
-rw-r--r--llvm/lib/Bitcode/Writer/ValueEnumerator.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
index 1172c4f..c22dbf7 100644
--- a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
+++ b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
@@ -140,6 +140,22 @@ void ValueEnumerator::EnumerateType(const Type *Ty) {
EnumerateType(*I);
}
+/// PurgeAggregateValues - If there are any aggregate values at the end of the
+/// value list, remove them and return the count of the remaining values. If
+/// there are none, return -1.
+int ValueEnumerator::PurgeAggregateValues() {
+ // If there are no aggregate values at the end of the list, return -1.
+ if (Values.empty() || Values.back().first->getType()->isFirstClassType())
+ return -1;
+
+ // Otherwise, remove aggregate values...
+ while (!Values.empty() && !Values.back().first->getType()->isFirstClassType())
+ Values.pop_back();
+
+ // ... and return the new size.
+ return Values.size();
+}
+
#if 0