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

Side by Side Diff: src/IceTranslator.cpp

Issue 1838753002: Subzero: Remove IceString. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes Created 4 years, 8 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 | « src/IceTranslator.h ('k') | src/IceTypes.h » ('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/IceTranslator.cpp - ICE to machine code ------*- C++ -*-===// 1 //===- subzero/src/IceTranslator.cpp - ICE to machine code ------*- 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 /// \file 10 /// \file
(...skipping 10 matching lines...) Expand all
21 #include "IceTargetLowering.h" 21 #include "IceTargetLowering.h"
22 22
23 #include <utility> 23 #include <utility>
24 24
25 namespace Ice { 25 namespace Ice {
26 26
27 Translator::Translator(GlobalContext *Ctx) 27 Translator::Translator(GlobalContext *Ctx)
28 : Ctx(Ctx), NextSequenceNumber(GlobalContext::getFirstSequenceNumber()), 28 : Ctx(Ctx), NextSequenceNumber(GlobalContext::getFirstSequenceNumber()),
29 ErrorStatus() {} 29 ErrorStatus() {}
30 30
31 IceString Translator::createUnnamedName(const IceString &Prefix, SizeT Index) { 31 std::string Translator::createUnnamedName(const std::string &Prefix,
32 SizeT Index) {
32 if (Index == 0) 33 if (Index == 0)
33 return Prefix; 34 return Prefix;
34 std::string Buffer; 35 std::string Buffer;
35 llvm::raw_string_ostream StrBuf(Buffer); 36 llvm::raw_string_ostream StrBuf(Buffer);
36 StrBuf << Prefix << Index; 37 StrBuf << Prefix << Index;
37 return StrBuf.str(); 38 return StrBuf.str();
38 } 39 }
39 40
40 bool Translator::checkIfUnnamedNameSafe(const IceString &Name, const char *Kind, 41 bool Translator::checkIfUnnamedNameSafe(const std::string &Name,
41 const IceString &Prefix) { 42 const char *Kind,
43 const std::string &Prefix) {
42 if (Name.find(Prefix) == 0) { 44 if (Name.find(Prefix) == 0) {
43 for (size_t i = Prefix.size(); i < Name.size(); ++i) { 45 for (size_t i = Prefix.size(); i < Name.size(); ++i) {
44 if (!isdigit(Name[i])) { 46 if (!isdigit(Name[i])) {
45 return false; 47 return false;
46 } 48 }
47 } 49 }
48 OstreamLocker L(Ctx); 50 OstreamLocker L(Ctx);
49 Ostream &Stream = Ctx->getStrDump(); 51 Ostream &Stream = Ctx->getStrDump();
50 Stream << "Warning : Default " << Kind << " prefix '" << Prefix 52 Stream << "Warning : Default " << Kind << " prefix '" << Prefix
51 << "' potentially conflicts with name '" << Name << "'.\n"; 53 << "' potentially conflicts with name '" << Name << "'.\n";
52 return true; 54 return true;
53 } 55 }
54 return false; 56 return false;
55 } 57 }
56 58
57 void Translator::translateFcn(std::unique_ptr<Cfg> Func) { 59 void Translator::translateFcn(std::unique_ptr<Cfg> Func) {
58 Ctx->optQueueBlockingPush(std::move(Func)); 60 Ctx->optQueueBlockingPush(std::move(Func));
59 } 61 }
60 62
61 void Translator::lowerGlobals( 63 void Translator::lowerGlobals(
62 std::unique_ptr<VariableDeclarationList> VariableDeclarations) { 64 std::unique_ptr<VariableDeclarationList> VariableDeclarations) {
63 Ctx->emitQueueBlockingPush(makeUnique<EmitterWorkItem>( 65 Ctx->emitQueueBlockingPush(makeUnique<EmitterWorkItem>(
64 getNextSequenceNumber(), std::move(VariableDeclarations))); 66 getNextSequenceNumber(), std::move(VariableDeclarations)));
65 } 67 }
66 68
67 } // end of namespace Ice 69 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceTranslator.h ('k') | src/IceTypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698