diff options
author | Chris Lattner <sabre@nondot.org> | 2007-02-10 07:42:59 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-02-10 07:42:59 +0000 |
commit | 31b60980dc1645d14dc7dadf176b12fd4f3b2060 (patch) | |
tree | 97cb99271cc18de169869672469a705203607c31 /llvm/lib/Bytecode/Writer/Writer.cpp | |
parent | d7f677c590ab1bf462b3d99c4952d72ada69e10d (diff) | |
download | bcm5719-llvm-31b60980dc1645d14dc7dadf176b12fd4f3b2060.tar.gz bcm5719-llvm-31b60980dc1645d14dc7dadf176b12fd4f3b2060.zip |
Change the table datastructure to be a vector<smallvector>, instead of
vector<vector> to avoid allocations. This speeds up bcwriting of 447.dealII
from 0.8276 to 0.7637s (8.4%).
This concludes this round of proding the bcwriter into submission. Final
speedup from 24.4s to 0.7637s (32x).
llvm-svn: 34142
Diffstat (limited to 'llvm/lib/Bytecode/Writer/Writer.cpp')
-rw-r--r-- | llvm/lib/Bytecode/Writer/Writer.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/llvm/lib/Bytecode/Writer/Writer.cpp b/llvm/lib/Bytecode/Writer/Writer.cpp index df62bf934ba..b98604bf719 100644 --- a/llvm/lib/Bytecode/Writer/Writer.cpp +++ b/llvm/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<const Value*> - &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<Argument>(Plane[ValNo]) || isa<GlobalValue>(Plane[ValNo]) || (isa<ConstantArray>(Plane[ValNo]) && cast<ConstantArray>(Plane[ValNo])->isString())); ValNo++) /*empty*/; unsigned NC = ValNo; // Number of constants - for (; NC < Plane.size() && (isa<Constant>(Plane[NC]) || - isa<InlineAsm>(Plane[NC])); NC++) + for (; NC < PlaneSize && (isa<Constant>(Plane[NC]) || + isa<InlineAsm>(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<const Value*> 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<const Value*> &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); } } } |