1 /*========================== begin_copyright_notice ============================ 2 3 Copyright (C) 2017-2021 Intel Corporation 4 5 SPDX-License-Identifier: MIT 6 7 ============================= end_copyright_notice ===========================*/ 8 9 #ifndef _BINARYCISAEMISSION_H_ 10 #define _BINARYCISAEMISSION_H_ 11 12 #include <map> 13 #include "visa_igc_common_header.h" 14 #include "Common_ISA.h" 15 #include "Common_ISA_util.h" 16 #include "Common_ISA_framework.h" 17 18 namespace vISA 19 { 20 class CISALabelInfo 21 { 22 public: CISALabelInfo(int name_index,int label_table_index,bool kind)23 CISALabelInfo(int name_index, int label_table_index, bool kind) :m_name_index(name_index), 24 m_label_table_index(label_table_index), m_kind(kind) {} 25 26 int m_name_index; 27 int m_label_table_index; 28 bool m_kind; 29 }; 30 31 // Define a map of labels 32 class CISALabelMap : public std::map<std::string, CISALabelInfo> {}; 33 34 class CBinaryCISAEmitter{ 35 public: 36 int Emit(VISAKernelImpl * cisa_kernel, unsigned int&); CBinaryCISAEmitter()37 CBinaryCISAEmitter() {} ~CBinaryCISAEmitter()38 ~CBinaryCISAEmitter() { 39 } 40 private: 41 void emitVarInfo(VISAKernelImpl * cisa_kernel, var_info_t * var); 42 void emitStateInfo(VISAKernelImpl * cisa_kernel, state_info_t * var); 43 void emitAddressInfo(VISAKernelImpl * cisa_kernel, addr_info_t * addr); 44 void emitPredicateInfo(VISAKernelImpl * cisa_kernel, pred_info_t * pred); 45 void emitLabelInfo(VISAKernelImpl * cisa_kernel, label_info_t * lbl); 46 void emitInputInfo(VISAKernelImpl * cisa_kernel, input_info_t * in); 47 void emitAttributeInfo(VISAKernelImpl * cisa_kernel, attribute_info_t * attr); 48 int emitCisaInst(VISAKernelImpl * cisa_kernel, const CISA_INST * inst, const VISA_INST_Desc * desc); 49 void emitVectorOpnd(VISAKernelImpl * cisa_kernel, vector_opnd * v_opnd); 50 void emitRawOpnd(VISAKernelImpl * cisa_kernel, raw_opnd * v_opnd); 51 }; 52 } 53 #endif // _BINARYCISAEMISSION_H_ 54