| 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 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 Loading... |
| 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 |
| OLD | NEW |