Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: src/IceGlobalContext.cpp

Issue 390533002: Subzero: Fix the name mangling code's base-36 increment. (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tests_lit/llvm2ice_tests/mangle.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceGlobalContext.cpp - Global context defs ---*- C++ -*-===// 1 //===- subzero/src/IceGlobalContext.cpp - Global context defs ---*- C++ -*-===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // This file defines aspects of the compilation that persist across 10 // This file defines aspects of the compilation that persist across
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 159 }
160 } 160 }
161 if (Found) { 161 if (Found) {
162 NewName[NewPos++] = OldName[OldPos++]; // 'S' 162 NewName[NewPos++] = OldName[OldPos++]; // 'S'
163 size_t Length = Last - OldPos; 163 size_t Length = Last - OldPos;
164 // NewPos and OldPos point just past the 'S'. 164 // NewPos and OldPos point just past the 'S'.
165 assert(NewName[NewPos - 1] == 'S'); 165 assert(NewName[NewPos - 1] == 'S');
166 assert(OldName[OldPos - 1] == 'S'); 166 assert(OldName[OldPos - 1] == 'S');
167 assert(OldName[OldPos + Length] == '_'); 167 assert(OldName[OldPos + Length] == '_');
168 if (AllZs) { 168 if (AllZs) {
169 // Replace N 'Z' characters with N+1 '0' characters. (This 169 // Replace N 'Z' characters with a '0' (if N=0) or '1' (if
170 // is also true for N=0, i.e. S_ ==> S0_ .) 170 // N>0) followed by N '0' characters.
171 for (size_t i = 0; i < Length + 1; ++i) { 171 NewName[NewPos++] = (Length ? '1' : '0');
172 for (size_t i = 0; i < Length; ++i) {
172 NewName[NewPos++] = '0'; 173 NewName[NewPos++] = '0';
173 } 174 }
174 } else { 175 } else {
175 // Iterate right-to-left and increment the base-36 number. 176 // Iterate right-to-left and increment the base-36 number.
176 bool Carry = true; 177 bool Carry = true;
177 for (size_t i = 0; i < Length; ++i) { 178 for (size_t i = 0; i < Length; ++i) {
178 size_t Offset = Length - 1 - i; 179 size_t Offset = Length - 1 - i;
179 char Ch = OldName[OldPos + Offset]; 180 char Ch = OldName[OldPos + Offset];
180 if (Carry) { 181 if (Carry) {
181 Carry = false; 182 Carry = false;
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 375
375 void Timer::printElapsedUs(GlobalContext *Ctx, const IceString &Tag) const { 376 void Timer::printElapsedUs(GlobalContext *Ctx, const IceString &Tag) const {
376 if (Ctx->isVerbose(IceV_Timing)) { 377 if (Ctx->isVerbose(IceV_Timing)) {
377 // Prefixing with '#' allows timing strings to be included 378 // Prefixing with '#' allows timing strings to be included
378 // without error in textual assembly output. 379 // without error in textual assembly output.
379 Ctx->getStrDump() << "# " << getElapsedUs() << " usec " << Tag << "\n"; 380 Ctx->getStrDump() << "# " << getElapsedUs() << " usec " << Tag << "\n";
380 } 381 }
381 } 382 }
382 383
383 } // end of namespace Ice 384 } // end of namespace Ice
OLDNEW
« no previous file with comments | « no previous file | tests_lit/llvm2ice_tests/mangle.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698