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

Side by Side Diff: src/IceTranslator.cpp

Issue 1834473002: Allow Subzero to parse function blocks in parallel. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix issues raised in last CL. 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/IceGlobalContext.cpp ('k') | src/PNaClTranslator.cpp » ('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
11 /// \brief Defines the general driver class for translating ICE to machine code. 11 /// \brief Defines the general driver class for translating ICE to machine code.
12 /// 12 ///
13 //===----------------------------------------------------------------------===// 13 //===----------------------------------------------------------------------===//
14 14
15 #include "IceTranslator.h" 15 #include "IceTranslator.h"
16 16
17 #include "IceDefs.h" 17 #include "IceDefs.h"
18 #include "IceCfg.h" 18 #include "IceCfg.h"
19 #include "IceClFlags.h" 19 #include "IceClFlags.h"
20 #include "IceGlobalInits.h" 20 #include "IceGlobalInits.h"
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 class CfgOptWorkItem final : public OptWorkItem {
28 CfgOptWorkItem() = delete;
29 CfgOptWorkItem(const CfgOptWorkItem &) = delete;
30 CfgOptWorkItem &operator=(const CfgOptWorkItem &) = delete;
31
32 public:
33 CfgOptWorkItem(std::unique_ptr<Cfg> Func) : Func(std::move(Func)) {}
34 std::unique_ptr<Cfg> getParsedCfg() override { return std::move(Func); }
35 ~CfgOptWorkItem() override = default;
36
37 private:
38 std::unique_ptr<Ice::Cfg> Func;
39 };
40
27 Translator::Translator(GlobalContext *Ctx) 41 Translator::Translator(GlobalContext *Ctx)
28 : Ctx(Ctx), NextSequenceNumber(GlobalContext::getFirstSequenceNumber()), 42 : Ctx(Ctx), NextSequenceNumber(GlobalContext::getFirstSequenceNumber()),
29 ErrorStatus() {} 43 ErrorStatus() {}
30 44
31 std::string Translator::createUnnamedName(const std::string &Prefix, 45 std::string Translator::createUnnamedName(const std::string &Prefix,
32 SizeT Index) { 46 SizeT Index) {
33 if (Index == 0) 47 if (Index == 0)
34 return Prefix; 48 return Prefix;
35 std::string Buffer; 49 std::string Buffer;
36 llvm::raw_string_ostream StrBuf(Buffer); 50 llvm::raw_string_ostream StrBuf(Buffer);
(...skipping 13 matching lines...) Expand all
50 OstreamLocker L(Ctx); 64 OstreamLocker L(Ctx);
51 Ostream &Stream = Ctx->getStrDump(); 65 Ostream &Stream = Ctx->getStrDump();
52 Stream << "Warning : Default " << Kind << " prefix '" << Prefix 66 Stream << "Warning : Default " << Kind << " prefix '" << Prefix
53 << "' potentially conflicts with name '" << Name << "'.\n"; 67 << "' potentially conflicts with name '" << Name << "'.\n";
54 return true; 68 return true;
55 } 69 }
56 return false; 70 return false;
57 } 71 }
58 72
59 void Translator::translateFcn(std::unique_ptr<Cfg> Func) { 73 void Translator::translateFcn(std::unique_ptr<Cfg> Func) {
60 Ctx->optQueueBlockingPush(std::move(Func)); 74 Ctx->optQueueBlockingPush(makeUnique<CfgOptWorkItem>(std::move(Func)));
61 } 75 }
62 76
63 void Translator::lowerGlobals( 77 void Translator::lowerGlobals(
64 std::unique_ptr<VariableDeclarationList> VariableDeclarations) { 78 std::unique_ptr<VariableDeclarationList> VariableDeclarations) {
65 Ctx->emitQueueBlockingPush(makeUnique<EmitterWorkItem>( 79 Ctx->emitQueueBlockingPush(makeUnique<EmitterWorkItem>(
66 getNextSequenceNumber(), std::move(VariableDeclarations))); 80 getNextSequenceNumber(), std::move(VariableDeclarations)));
67 } 81 }
68 82
69 } // end of namespace Ice 83 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceGlobalContext.cpp ('k') | src/PNaClTranslator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698