OLD | NEW |
---|---|
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 { | |
John
2016/03/24 17:32:35
enclose this namespace in Ice, and then remove the
Karl
2016/03/24 22:35:25
Done.
| |
26 | |
27 class CfgOptWorkItem : public Ice::OptWorkItem { | |
28 CfgOptWorkItem() = delete; | |
29 CfgOptWorkItem(const CfgOptWorkItem &) = delete; | |
30 CfgOptWorkItem &operator=(const CfgOptWorkItem &) = delete; | |
31 | |
32 public: | |
33 CfgOptWorkItem(std::unique_ptr<Ice::Cfg> Func) : Func(std::move(Func)) {} | |
34 std::unique_ptr<Ice::Cfg> getParsedCfg() final { return std::move(Func); } | |
John
2016/03/24 17:32:34
final is better off when used in the class declara
Karl
2016/03/24 22:35:25
On 2016/03/24 17:32:34, John wrote:
> final is bet
| |
35 ~CfgOptWorkItem() final {} | |
John
2016/03/24 17:32:35
~CfgOptWorkItem() override = default;
Karl
2016/03/24 22:35:25
Done.
| |
36 | |
37 private: | |
38 std::unique_ptr<Ice::Cfg> Func; | |
39 }; | |
40 | |
41 } // end of anonymous namespace | |
42 | |
25 namespace Ice { | 43 namespace Ice { |
26 | 44 |
27 Translator::Translator(GlobalContext *Ctx) | 45 Translator::Translator(GlobalContext *Ctx) |
28 : Ctx(Ctx), NextSequenceNumber(GlobalContext::getFirstSequenceNumber()), | 46 : Ctx(Ctx), NextSequenceNumber(GlobalContext::getFirstSequenceNumber()), |
29 ErrorStatus() {} | 47 ErrorStatus() {} |
30 | 48 |
31 IceString Translator::createUnnamedName(const IceString &Prefix, SizeT Index) { | 49 IceString Translator::createUnnamedName(const IceString &Prefix, SizeT Index) { |
32 if (Index == 0) | 50 if (Index == 0) |
33 return Prefix; | 51 return Prefix; |
34 std::string Buffer; | 52 std::string Buffer; |
(...skipping 13 matching lines...) Expand all Loading... | |
48 OstreamLocker L(Ctx); | 66 OstreamLocker L(Ctx); |
49 Ostream &Stream = Ctx->getStrDump(); | 67 Ostream &Stream = Ctx->getStrDump(); |
50 Stream << "Warning : Default " << Kind << " prefix '" << Prefix | 68 Stream << "Warning : Default " << Kind << " prefix '" << Prefix |
51 << "' potentially conflicts with name '" << Name << "'.\n"; | 69 << "' potentially conflicts with name '" << Name << "'.\n"; |
52 return true; | 70 return true; |
53 } | 71 } |
54 return false; | 72 return false; |
55 } | 73 } |
56 | 74 |
57 void Translator::translateFcn(std::unique_ptr<Cfg> Func) { | 75 void Translator::translateFcn(std::unique_ptr<Cfg> Func) { |
58 Ctx->optQueueBlockingPush(std::move(Func)); | 76 Ctx->optQueueBlockingPush(makeUnique<CfgOptWorkItem>(std::move(Func))); |
59 } | 77 } |
60 | 78 |
61 void Translator::lowerGlobals( | 79 void Translator::lowerGlobals( |
62 std::unique_ptr<VariableDeclarationList> VariableDeclarations) { | 80 std::unique_ptr<VariableDeclarationList> VariableDeclarations) { |
63 Ctx->emitQueueBlockingPush(makeUnique<EmitterWorkItem>( | 81 Ctx->emitQueueBlockingPush(makeUnique<EmitterWorkItem>( |
64 getNextSequenceNumber(), std::move(VariableDeclarations))); | 82 getNextSequenceNumber(), std::move(VariableDeclarations))); |
65 } | 83 } |
66 | 84 |
67 } // end of namespace Ice | 85 } // end of namespace Ice |
OLD | NEW |