1 //===- subzero/src/IceThreading.cpp - Threading function definitions ------===// 2 // 3 // The Subzero Code Generator 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 /// 10 /// \file 11 /// \brief Defines threading-related functions. 12 /// 13 //===----------------------------------------------------------------------===// 14 15 #include "IceThreading.h" 16 17 #include "IceCfg.h" 18 #include "IceDefs.h" 19 20 namespace Ice { 21 22 EmitterWorkItem::EmitterWorkItem(uint32_t Seq) 23 : Sequence(Seq), Kind(WI_Nop), GlobalInits(nullptr), Function(nullptr), 24 RawFunc(nullptr) {} 25 EmitterWorkItem::EmitterWorkItem(uint32_t Seq, 26 std::unique_ptr<VariableDeclarationList> D) 27 : Sequence(Seq), Kind(WI_GlobalInits), GlobalInits(std::move(D)), 28 Function(nullptr), RawFunc(nullptr) {} 29 EmitterWorkItem::EmitterWorkItem(uint32_t Seq, std::unique_ptr<Assembler> A) 30 : Sequence(Seq), Kind(WI_Asm), GlobalInits(nullptr), Function(std::move(A)), 31 RawFunc(nullptr) {} 32 EmitterWorkItem::EmitterWorkItem(uint32_t Seq, std::unique_ptr<Cfg> F) 33 : Sequence(Seq), Kind(WI_Cfg), GlobalInits(nullptr), Function(nullptr), 34 RawFunc(std::move(F)) {} 35 36 void EmitterWorkItem::setGlobalInits( 37 std::unique_ptr<VariableDeclarationList> GloblInits) { 38 assert(getKind() == WI_Asm || getKind() == WI_Cfg); 39 GlobalInits = std::move(GloblInits); 40 } 41 42 std::unique_ptr<VariableDeclarationList> EmitterWorkItem::getGlobalInits() { 43 assert(getKind() == WI_GlobalInits || getKind() == WI_Asm || 44 getKind() == WI_Cfg); 45 return std::move(GlobalInits); 46 } 47 48 std::unique_ptr<Assembler> EmitterWorkItem::getAsm() { 49 assert(getKind() == WI_Asm); 50 return std::move(Function); 51 } 52 53 std::unique_ptr<Cfg> EmitterWorkItem::getCfg() { 54 assert(getKind() == WI_Cfg); 55 return std::move(RawFunc); 56 } 57 58 } // end of namespace Ice 59