diff options
author | Chris Lattner <sabre@nondot.org> | 2007-05-03 22:46:43 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-05-03 22:46:43 +0000 |
commit | 50954f5cba406a88011cc8ade3ceb4235830f907 (patch) | |
tree | 0b4584873e19e3c117a3427cc5c422f49cac7120 /lib/Bitcode/Writer/ValueEnumerator.cpp | |
parent | 76520191abf157dfa2bcb473406193ab362480b6 (diff) |
enumerate parameter attr lists.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36709 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode/Writer/ValueEnumerator.cpp')
-rw-r--r-- | lib/Bitcode/Writer/ValueEnumerator.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/Bitcode/Writer/ValueEnumerator.cpp b/lib/Bitcode/Writer/ValueEnumerator.cpp index 4d3f0fd792..ba091b564f 100644 --- a/lib/Bitcode/Writer/ValueEnumerator.cpp +++ b/lib/Bitcode/Writer/ValueEnumerator.cpp @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "ValueEnumerator.h" +#include "llvm/DerivedTypes.h" #include "llvm/Module.h" #include "llvm/TypeSymbolTable.h" #include "llvm/ValueSymbolTable.h" @@ -143,8 +144,24 @@ void ValueEnumerator::EnumerateType(const Type *Ty) { for (Type::subtype_iterator I = Ty->subtype_begin(), E = Ty->subtype_end(); I != E; ++I) EnumerateType(*I); + + // If this is a function type, enumerate the param attrs. + if (const FunctionType *FTy = dyn_cast<FunctionType>(Ty)) + EnumerateParamAttrs(FTy->getParamAttrs()); } +void ValueEnumerator::EnumerateParamAttrs(const ParamAttrsList *PAL) { + if (PAL == 0) return; // null is always 0. + // Do a lookup. + unsigned &Entry = ParamAttrMap[PAL]; + if (Entry == 0) { + // Never saw this before, add it. + ParamAttrs.push_back(PAL); + Entry = ParamAttrs.size(); + } +} + + /// 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. |