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

Side by Side Diff: src/IceTranslator.cpp

Issue 1837663002: Initial Subzero WASM prototype. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review feedback and merging master 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/WasmTranslator.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
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
41 Translator::Translator(GlobalContext *Ctx) 27 Translator::Translator(GlobalContext *Ctx)
42 : Ctx(Ctx), NextSequenceNumber(GlobalContext::getFirstSequenceNumber()), 28 : Ctx(Ctx), NextSequenceNumber(GlobalContext::getFirstSequenceNumber()),
43 ErrorStatus() {} 29 ErrorStatus() {}
44 30
45 std::string Translator::createUnnamedName(const std::string &Prefix, 31 std::string Translator::createUnnamedName(const std::string &Prefix,
46 SizeT Index) { 32 SizeT Index) {
47 if (Index == 0) 33 if (Index == 0)
48 return Prefix; 34 return Prefix;
49 std::string Buffer; 35 std::string Buffer;
50 llvm::raw_string_ostream StrBuf(Buffer); 36 llvm::raw_string_ostream StrBuf(Buffer);
(...skipping 23 matching lines...) Expand all
74 Ctx->optQueueBlockingPush(makeUnique<CfgOptWorkItem>(std::move(Func))); 60 Ctx->optQueueBlockingPush(makeUnique<CfgOptWorkItem>(std::move(Func)));
75 } 61 }
76 62
77 void Translator::lowerGlobals( 63 void Translator::lowerGlobals(
78 std::unique_ptr<VariableDeclarationList> VariableDeclarations) { 64 std::unique_ptr<VariableDeclarationList> VariableDeclarations) {
79 Ctx->emitQueueBlockingPush(makeUnique<EmitterWorkItem>( 65 Ctx->emitQueueBlockingPush(makeUnique<EmitterWorkItem>(
80 getNextSequenceNumber(), std::move(VariableDeclarations))); 66 getNextSequenceNumber(), std::move(VariableDeclarations)));
81 } 67 }
82 68
83 } // end of namespace Ice 69 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceTranslator.h ('k') | src/WasmTranslator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698