diff --git a/lib/Bytecode/Writer/SlotCalculator.h b/lib/Bytecode/Writer/SlotCalculator.h index a7722e893f0..d457c6c8a79 100644 --- a/lib/Bytecode/Writer/SlotCalculator.h +++ b/lib/Bytecode/Writer/SlotCalculator.h @@ -21,6 +21,7 @@ #define LLVM_ANALYSIS_SLOTCALCULATOR_H #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/SmallVector.h" #include namespace llvm { @@ -44,9 +45,10 @@ struct ModuleLevelDenseMapKeyInfo { class SlotCalculator { const Module *TheModule; - +public: typedef std::vector TypeList; - typedef std::vector TypePlane; + typedef SmallVector TypePlane; +private: std::vector Table; TypeList Types; typedef DenseMap NodeMapType; diff --git a/lib/Bytecode/Writer/Writer.cpp b/lib/Bytecode/Writer/Writer.cpp index df62bf934ba..b98604bf719 100644 --- a/lib/Bytecode/Writer/Writer.cpp +++ b/lib/Bytecode/Writer/Writer.cpp @@ -812,21 +812,22 @@ void BytecodeWriter::outputTypes(unsigned TypeNum) { // Helper function for outputConstants(). // Writes out all the constants in the plane Plane starting at entry StartNo. // -void BytecodeWriter::outputConstantsInPlane(const std::vector - &Plane, unsigned StartNo) { +void BytecodeWriter::outputConstantsInPlane(const Value *const *Plane, + unsigned PlaneSize, + unsigned StartNo) { unsigned ValNo = StartNo; // Scan through and ignore function arguments, global values, and constant // strings. - for (; ValNo < Plane.size() && + for (; ValNo < PlaneSize && (isa(Plane[ValNo]) || isa(Plane[ValNo]) || (isa(Plane[ValNo]) && cast(Plane[ValNo])->isString())); ValNo++) /*empty*/; unsigned NC = ValNo; // Number of constants - for (; NC < Plane.size() && (isa(Plane[NC]) || - isa(Plane[NC])); NC++) + for (; NC < PlaneSize && (isa(Plane[NC]) || + isa(Plane[NC])); NC++) /*empty*/; NC -= ValNo; // Convert from index into count if (NC == 0) return; // Skip empty type planes... @@ -839,7 +840,7 @@ void BytecodeWriter::outputConstantsInPlane(const std::vector output_vbr(NC); // Put out the Type ID Number. - output_typeid(Table.getTypeSlot(Plane.front()->getType())); + output_typeid(Table.getTypeSlot(Plane[0]->getType())); for (unsigned i = ValNo; i < ValNo+NC; ++i) { const Value *V = Plane[i]; @@ -864,7 +865,7 @@ void BytecodeWriter::outputConstants() { outputConstantStrings(); for (unsigned pno = 0; pno != NumPlanes; pno++) { - const std::vector &Plane = Table.getPlane(pno); + const SlotCalculator::TypePlane &Plane = Table.getPlane(pno); if (!Plane.empty()) { // Skip empty type planes... unsigned ValNo = 0; if (hasNullValue(Plane[0]->getType())) { @@ -873,7 +874,7 @@ void BytecodeWriter::outputConstants() { } // Write out constants in the plane - outputConstantsInPlane(Plane, ValNo); + outputConstantsInPlane(&Plane[0], Plane.size(), ValNo); } } } diff --git a/lib/Bytecode/Writer/WriterInternals.h b/lib/Bytecode/Writer/WriterInternals.h index 116791e6298..6a036d804a9 100644 --- a/lib/Bytecode/Writer/WriterInternals.h +++ b/lib/Bytecode/Writer/WriterInternals.h @@ -35,11 +35,6 @@ private: void outputConstants(); void outputConstantStrings(); void outputFunction(const Function *F); - void outputCompactionTable(); - void outputCompactionTypes(unsigned StartNo); - void outputCompactionTablePlane(unsigned PlaneNo, - const std::vector &TypePlane, - unsigned StartNo); void outputInstructions(const Function *F); void outputInstruction(const Instruction &I); void outputInstructionFormat0(const Instruction *I, unsigned Opcode, @@ -66,7 +61,7 @@ private: void outputTypeSymbolTable(const TypeSymbolTable &TST); void outputValueSymbolTable(const ValueSymbolTable &ST); void outputTypes(unsigned StartNo); - void outputConstantsInPlane(const std::vector &Plane, + void outputConstantsInPlane(const Value *const*Plane, unsigned PlaneSize, unsigned StartNo); void outputConstant(const Constant *CPV); void outputInlineAsm(const InlineAsm *IA);