diff options
author | Mark Seaborn <mseaborn@chromium.org> | 2013-09-05 08:46:41 -0700 |
---|---|---|
committer | Mark Seaborn <mseaborn@chromium.org> | 2013-09-05 08:46:41 -0700 |
commit | 1180f259c88b1eb1000d0aaf5753b3da9f8e4e51 (patch) | |
tree | 93e5a4aa9aa5c5cedf8fe2c1137bef15e0ef081a /lib/Bitcode | |
parent | d8f9bfbc093e7e0c1fab719bc014ba7c6f94ad6d (diff) |
PNaCl bitcode: Don't output the LABEL type in the type table
The type ID for the "label" type is never referenced.
The "label" type was only being added to the type table because
EnumerateType() treats BasicBlock and Value operands the same.
However, the rest of the reader and writer treat BasicBlock operands
specially and not like other Values.
Change some tests to use wildcards for some type IDs. This is so that
I don't have to update all the type ID numbers now that the generated
type tables have changed.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590
TEST=run small_tests with v2 bitcode format enabled
Review URL: https://codereview.chromium.org/23530031
Diffstat (limited to 'lib/Bitcode')
-rw-r--r-- | lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp | 4 | ||||
-rw-r--r-- | lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp | 1 | ||||
-rw-r--r-- | lib/Bitcode/NaCl/Writer/NaClValueEnumerator.cpp | 4 |
3 files changed, 8 insertions, 1 deletions
diff --git a/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp b/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp index cccc5cee5a..eaaa85a164 100644 --- a/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp +++ b/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp @@ -449,6 +449,10 @@ bool NaClBitcodeReader::ParseTypeTableBody() { ResultTy = Type::getDoubleTy(Context); break; case naclbitc::TYPE_CODE_LABEL: // LABEL + // TODO(mseaborn): Remove this case when we drop support for v1 + // of the PNaCl bitcode format. + if (GetPNaClVersion() >= 2) + return Error("Label type not supported in PNaCl bitcode"); ResultTy = Type::getLabelTy(Context); break; case naclbitc::TYPE_CODE_INTEGER: // INTEGER: [width] diff --git a/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp b/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp index ec13266221..166a95bb23 100644 --- a/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp +++ b/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp @@ -224,7 +224,6 @@ static void WriteTypeTable(const NaClValueEnumerator &VE, case Type::VoidTyID: Code = naclbitc::TYPE_CODE_VOID; break; case Type::FloatTyID: Code = naclbitc::TYPE_CODE_FLOAT; break; case Type::DoubleTyID: Code = naclbitc::TYPE_CODE_DOUBLE; break; - case Type::LabelTyID: Code = naclbitc::TYPE_CODE_LABEL; break; case Type::IntegerTyID: // INTEGER: [width] Code = naclbitc::TYPE_CODE_INTEGER; diff --git a/lib/Bitcode/NaCl/Writer/NaClValueEnumerator.cpp b/lib/Bitcode/NaCl/Writer/NaClValueEnumerator.cpp index a58a421db2..64d7661415 100644 --- a/lib/Bitcode/NaCl/Writer/NaClValueEnumerator.cpp +++ b/lib/Bitcode/NaCl/Writer/NaClValueEnumerator.cpp @@ -299,6 +299,10 @@ void NaClValueEnumerator::EnumerateValue(const Value *VIn) { void NaClValueEnumerator::EnumerateType(Type *Ty, bool InsideOptimizeTypes) { + // The label type does not need to be given a type ID. + if (Ty->isLabelTy()) + return; + // This function is used to enumerate types referenced by the given // module. This function is called in two phases, based on the value // of TypeCountMap. These phases are: |