diff options
Diffstat (limited to 'lib/Bitcode/Writer')
-rw-r--r-- | lib/Bitcode/Writer/BitcodeWriter.cpp | 24 | ||||
-rw-r--r-- | lib/Bitcode/Writer/ValueEnumerator.cpp | 14 |
2 files changed, 31 insertions, 7 deletions
diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index ad651d36bf..cb5963cb8e 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -610,6 +610,20 @@ static void WriteConstants(unsigned FirstVal, unsigned LastVal, Record.push_back(VE.getValueID(C->getOperand(i))); } break; + case Instruction::ExtractValue: + Code = bitc::CST_CODE_CE_EXTRACTVAL; + for (unsigned i = 0, e = CE->getNumOperands(); i != e; ++i) { + Record.push_back(VE.getTypeID(C->getOperand(i)->getType())); + Record.push_back(VE.getValueID(C->getOperand(i))); + } + break; + case Instruction::InsertValue: + Code = bitc::CST_CODE_CE_INSERTVAL; + for (unsigned i = 0, e = CE->getNumOperands(); i != e; ++i) { + Record.push_back(VE.getTypeID(C->getOperand(i)->getType())); + Record.push_back(VE.getValueID(C->getOperand(i))); + } + break; case Instruction::Select: Code = bitc::CST_CODE_CE_SELECT; Record.push_back(VE.getValueID(C->getOperand(0))); @@ -718,6 +732,16 @@ static void WriteInstruction(const Instruction &I, unsigned InstID, for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) PushValueAndType(I.getOperand(i), InstID, Vals, VE); break; + case Instruction::ExtractValue: + Code = bitc::FUNC_CODE_INST_EXTRACTVAL; + for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) + PushValueAndType(I.getOperand(i), InstID, Vals, VE); + break; + case Instruction::InsertValue: + Code = bitc::FUNC_CODE_INST_INSERTVAL; + for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) + PushValueAndType(I.getOperand(i), InstID, Vals, VE); + break; case Instruction::Select: Code = bitc::FUNC_CODE_INST_SELECT; PushValueAndType(I.getOperand(1), InstID, Vals, VE); diff --git a/lib/Bitcode/Writer/ValueEnumerator.cpp b/lib/Bitcode/Writer/ValueEnumerator.cpp index 92271ce2b9..21d0dfe7eb 100644 --- a/lib/Bitcode/Writer/ValueEnumerator.cpp +++ b/lib/Bitcode/Writer/ValueEnumerator.cpp @@ -21,9 +21,9 @@ #include <algorithm> using namespace llvm; -static bool isFirstClassType(const std::pair<const llvm::Type*, - unsigned int> &P) { - return P.first->isFirstClassType(); +static bool isSingleValueType(const std::pair<const llvm::Type*, + unsigned int> &P) { + return P.first->isSingleValueType(); } static bool isIntegerValue(const std::pair<const Value*, unsigned> &V) { @@ -103,10 +103,10 @@ ValueEnumerator::ValueEnumerator(const Module *M) { // in the table (have low bit-width). std::stable_sort(Types.begin(), Types.end(), CompareByFrequency); - // Partition the Type ID's so that the first-class types occur before the + // Partition the Type ID's so that the single-value types occur before the // aggregate types. This allows the aggregate types to be dropped from the // type table after parsing the global variable initializers. - std::partition(Types.begin(), Types.end(), isFirstClassType); + std::partition(Types.begin(), Types.end(), isSingleValueType); // Now that we rearranged the type table, rebuild TypeMap. for (unsigned i = 0, e = Types.size(); i != e; ++i) @@ -264,11 +264,11 @@ void ValueEnumerator::EnumerateParamAttrs(const PAListPtr &PAL) { /// 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()) + if (Values.empty() || Values.back().first->getType()->isSingleValueType()) return -1; // Otherwise, remove aggregate values... - while (!Values.empty() && !Values.back().first->getType()->isFirstClassType()) + while (!Values.empty() && !Values.back().first->getType()->isSingleValueType()) Values.pop_back(); // ... and return the new size. |