diff options
author | Eric Christopher <echristo@apple.com> | 2011-11-08 18:38:40 +0000 |
---|---|---|
committer | Eric Christopher <echristo@apple.com> | 2011-11-08 18:38:40 +0000 |
commit | 30b4d8b83b7b3995ac1b53f35d3110d48676b187 (patch) | |
tree | 35053ad941f22545e81375984a197eceee59be4d /lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp | |
parent | ec8ffc29c04e5e11d8637f1ba1df67d97bafb499 (diff) | |
download | external_llvm-30b4d8b83b7b3995ac1b53f35d3110d48676b187.zip external_llvm-30b4d8b83b7b3995ac1b53f35d3110d48676b187.tar.gz external_llvm-30b4d8b83b7b3995ac1b53f35d3110d48676b187.tar.bz2 |
A few more places where we can avoid multiple size queries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144099 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp')
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp b/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp index a684966..7c93dbf 100644 --- a/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp @@ -58,7 +58,7 @@ void DwarfAccelTable::ComputeBucketCount(void) { // First get the number of unique hashes. std::vector<uint32_t> uniques; uniques.resize(Data.size()); - for (size_t i = 0; i < Data.size(); ++i) + for (size_t i = 0, e = Data.size(); i < e; ++i) uniques[i] = Data[i]->HashValue; std::sort(uniques.begin(), uniques.end()); std::vector<uint32_t>::iterator p = @@ -94,7 +94,7 @@ void DwarfAccelTable::FinalizeTable(AsmPrinter *Asm, const char *Prefix) { // Compute bucket contents and final ordering. Buckets.resize(Header.bucket_count); - for (size_t i = 0; i < Data.size(); ++i) { + for (size_t i = 0, e = Data.size(); i < e; ++i) { uint32_t bucket = Data[i]->HashValue % Header.bucket_count; Buckets[bucket].push_back(Data[i]); Data[i]->Sym = Asm->GetTempSymbol(Prefix, i); @@ -132,7 +132,7 @@ void DwarfAccelTable::EmitHeader(AsmPrinter *Asm) { // like a list of numbers of how many elements are in each bucket. void DwarfAccelTable::EmitBuckets(AsmPrinter *Asm) { unsigned index = 0; - for (size_t i = 0; i < Buckets.size(); ++i) { + for (size_t i = 0, e = Buckets.size(); i < e; ++i) { Asm->OutStreamer.AddComment("Bucket " + Twine(i)); if (Buckets[i].size() != 0) Asm->EmitInt32(index); @@ -145,7 +145,7 @@ void DwarfAccelTable::EmitBuckets(AsmPrinter *Asm) { // Walk through the buckets and emit the individual hashes for each // bucket. void DwarfAccelTable::EmitHashes(AsmPrinter *Asm) { - for (size_t i = 0; i < Buckets.size(); ++i) { + for (size_t i = 0, e = Buckets.size(); i < e; ++i) { for (HashList::const_iterator HI = Buckets[i].begin(), HE = Buckets[i].end(); HI != HE; ++HI) { Asm->OutStreamer.AddComment("Hash in Bucket " + Twine(i)); @@ -159,7 +159,7 @@ void DwarfAccelTable::EmitHashes(AsmPrinter *Asm) { // beginning of the section. The non-section symbol will be output later // when we emit the actual data. void DwarfAccelTable::EmitOffsets(AsmPrinter *Asm, MCSymbol *SecBegin) { - for (size_t i = 0; i < Buckets.size(); ++i) { + for (size_t i = 0, e = Buckets.size(); i < e; ++i) { for (HashList::const_iterator HI = Buckets[i].begin(), HE = Buckets[i].end(); HI != HE; ++HI) { Asm->OutStreamer.AddComment("Offset in Bucket " + Twine(i)); @@ -178,7 +178,7 @@ void DwarfAccelTable::EmitOffsets(AsmPrinter *Asm, MCSymbol *SecBegin) { // Terminate each HashData bucket with 0. void DwarfAccelTable::EmitData(AsmPrinter *Asm, DwarfDebug *D) { uint64_t PrevHash = UINT64_MAX; - for (size_t i = 0; i < Buckets.size(); ++i) { + for (size_t i = 0, e = Buckets.size(); i < e; ++i) { for (HashList::const_iterator HI = Buckets[i].begin(), HE = Buckets[i].end(); HI != HE; ++HI) { // Remember to emit the label for our offset. @@ -237,7 +237,7 @@ void DwarfAccelTable::print(raw_ostream &O) { } O << "Buckets and Hashes: \n"; - for (size_t i = 0; i < Buckets.size(); ++i) + for (size_t i = 0, e = Buckets.size(); i < e; ++i) for (HashList::const_iterator HI = Buckets[i].begin(), HE = Buckets[i].end(); HI != HE; ++HI) (*HI)->print(O); |