diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-01-12 22:30:34 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-01-12 22:30:34 +0000 |
commit | 2fcf60e78efde7b9766bb58dd2fcf0b5773d75ee (patch) | |
tree | cb985c1de12e0e8392046c335bbbe32746e5b8fd /llvm/lib/Bitcode/Writer/ValueEnumerator.h | |
parent | 0b31dd1d67c0bb68db6f868a2330b61c7a162c71 (diff) | |
download | llvm-2fcf60e78efde7b9766bb58dd2fcf0b5773d75ee.zip llvm-2fcf60e78efde7b9766bb58dd2fcf0b5773d75ee.tar.gz llvm-2fcf60e78efde7b9766bb58dd2fcf0b5773d75ee.tar.bz2 |
Bitcode: Simplify emission of METADATA_BLOCK
Refactor logic so that we know up-front whether to open a block and
whether we need an MDString abbreviation.
This is almost NFC, but will start emitting `MDString` abbreviations
when the first record is not an `MDString`.
llvm-svn: 225712
Diffstat (limited to 'llvm/lib/Bitcode/Writer/ValueEnumerator.h')
-rw-r--r-- | llvm/lib/Bitcode/Writer/ValueEnumerator.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Writer/ValueEnumerator.h b/llvm/lib/Bitcode/Writer/ValueEnumerator.h index 3b1b313..e63394f 100644 --- a/llvm/lib/Bitcode/Writer/ValueEnumerator.h +++ b/llvm/lib/Bitcode/Writer/ValueEnumerator.h @@ -64,6 +64,7 @@ private: SmallVector<const LocalAsMetadata *, 8> FunctionLocalMDs; typedef DenseMap<const Metadata *, unsigned> MetadataMapType; MetadataMapType MDValueMap; + bool HasMDString; typedef DenseMap<AttributeSet, unsigned> AttributeGroupMapType; AttributeGroupMapType AttributeGroupMap; @@ -109,6 +110,8 @@ public: unsigned getValueID(const Value *V) const; unsigned getMetadataID(const Metadata *V) const; + bool hasMDString() const { return HasMDString; } + unsigned getTypeID(Type *T) const { TypeMapType::const_iterator I = TypeMap.find(T); assert(I != TypeMap.end() && "Type not in ValueEnumerator!"); |