1 // =================================
  2 // Copyright (c) 2021 Seppo Laakko
  3 // Distributed under the MIT license
  4 // =================================
  5 
  6 #ifndef CMAJOR_CMSXBE_EMITTER_INCLUDED
  7 #define CMAJOR_CMSXBE_EMITTER_INCLUDED
  8 #include <cmajor/cmsxbe/EmittingContext.hpp>
  9 #include <cmajor/cmsxbe/ValueStack.hpp>
 10 #include <cmajor/cmsxi/CompileUnit.hpp>
 11 #include <cmajor/ir/Emitter.hpp>
 12 #include <boost/uuid/uuid.hpp>
 13 #include <boost/uuid/nil_generator.hpp>
 14 #include <boost/functional/hash.hpp>
 15 
 16 namespace cmsxbe {
 17 
 18 using soulng::lexer::Span;
 19 
 20 class Emitter public cmajor::ir::Emitter
 21 {
 22 public:
 23     Emitter(EmittingContext* emittingContext_);
 24     EmittingContext* GetEmittingContext() const { return emittingContext; }
 25     void SetEmittingDelegate(cmajor::ir::EmittingDelegate* emittingDelegate_) override;
 26     void* GetIrTypeForBool() override;
 27     void* GetIrTypeForSByte() override;
 28     void* GetIrTypeForByte() override;
 29     void* GetIrTypeForShort() override;
 30     void* GetIrTypeForUShort() override;
 31     void* GetIrTypeForInt() override;
 32     void* GetIrTypeForUInt() override;
 33     void* GetIrTypeForLong() override;
 34     void* GetIrTypeForULong() override;
 35     void* GetIrTypeForFloat() override;
 36     void* GetIrTypeForDouble() override;
 37     void* GetIrTypeForChar() override;
 38     void* GetIrTypeForWChar() override;
 39     void* GetIrTypeForUChar() override;
 40     void* GetIrTypeForVoid() override;
 41     void* GetIrTypeForFunction(void* retTypeconst std::std::vector<void*>&paramTypes) override;
 42     void* GetIrTypeForVariableParamFunction(void* retType) override;
 43     void* GetIrTypeByTypeId(const boost::uuids::uuid& typeId) override;
 44     void SetIrTypeByTypeId(const boost::uuids::uuid& typeIdvoid* irType) override;
 45     void* GetIrTypeForArrayType(void* elementTypeint64_t size) override;
 46     void* GetIrTypeForClassType(const std::std::vector<void*>&elementTypes) override;
 47     void* CreateFwdIrTypeForClassType() override;
 48     void SetFwdIrTypeBody(void* forwardDeclaredTypeconst std::std::vector<void*>&elementTypes) override;
 49     void* GetIrTypeForDelegateType(void* retTypeconst std::std::vector<void*>&paramTypes) override;
 50     void* GetIrTypeForVoidPtrType() override;
 51     void* GetIrTypeForStructType(const std::std::vector<void*>&elementTypes) override;
 52     void* GetIrTypeForPtrType(void* baseIrType) override;
 53     std::string GetIrTypeName(void* irType) override;
 54     std::string MakeVmtVariableName(const std::string& vmtObjectName) override;
 55     void* CreateDefaultIrValueForArrayType(void* arrayIrTypeconst std::std::vector<void*>&arrayOfDefaults) override;
 56     void* CreateDefaultIrValueForBool() override;
 57     void* CreateDefaultIrValueForSByte() override;
 58     void* CreateDefaultIrValueForByte() override;
 59     void* CreateDefaultIrValueForShort() override;
 60     void* CreateDefaultIrValueForUShort() override;
 61     void* CreateDefaultIrValueForInt() override;
 62     void* CreateDefaultIrValueForUInt() override;
 63     void* CreateDefaultIrValueForLong() override;
 64     void* CreateDefaultIrValueForULong() override;
 65     void* CreateDefaultIrValueForFloat() override;
 66     void* CreateDefaultIrValueForDouble() override;
 67     void* CreateDefaultIrValueForChar() override;
 68     void* CreateDefaultIrValueForWChar() override;
 69     void* CreateDefaultIrValueForUChar() override;
 70     void* CreateDefaultIrValueForStruct(void* irTypeconst std::std::vector<void*>&defaultMembers) override;
 71     void* CreateDefaultIrValueForDelegateType(void* irType) override;
 72     void* CreateDefaultIrValueForVoidPtrType() override;
 73     void* CreateDefaultIrValueForDerivedType(void* irType) override;
 74     void* CreateDefaultIrValueForPtrType(void* irType) override;
 75     void* CreateIrValueForBool(bool value) override;
 76     void* CreateIrValueForSByte(int8_t value) override;
 77     void* CreateIrValueForByte(uint8_t value) override;
 78     void* CreateIrValueForShort(int16_t value) override;
 79     void* CreateIrValueForUShort(uint16_t value) override;
 80     void* CreateIrValueForInt(int32_t value) override;
 81     void* CreateIrValueForUInt(uint32_t value) override;
 82     void* CreateIrValueForLong(int64_t value) override;
 83     void* CreateIrValueForULong(uint64_t value) override;
 84     void* CreateIrValueForFloat(float value) override;
 85     void* CreateIrValueForDouble(double value) override;
 86     void* CreateIrValueForChar(uint8_t value) override;
 87     void* CreateIrValueForWChar(uint16_t value) override;
 88     void* CreateIrValueForUChar(uint32_t value) override;
 89     void* CreateIrValueForWString(void* wstringConstant) override;
 90     void* CreateIrValueForUString(void* ustringConstant) override;
 91     void* CreateIrValueForConstantArray(void* arrayIrTypeconst std::std::vector<void*>&elementConstantsconststd::string&prefix) override;
 92     void* CreateIrValueForConstantStruct(void* structIrTypeconst std::std::vector<void*>&elementConstants) override;
 93     void* CreateIrValueForUuid(void* uuidConstant) override;
 94     void* GetConversionValue(void* typevoid* from) override;
 95     void* CreateGlobalStringPtr(const std::string& name) override;
 96     void* CreateGlobalWStringPtr(const std::u16string& name) override;
 97     void* CreateGlobalUStringPtr(const std::u32string& name) override;
 98     void* GetGlobalStringPtr(int stringId) override;
 99     void* GetGlobalWStringConstant(int stringId) override;
100     void* GetGlobalUStringConstant(int stringId) override;
101     void* GetGlobalUuidConstant(int uuidId) override;
102     void* CreateDITypeForBool() override;
103     void* CreateDITypeForSByte() override;
104     void* CreateDITypeForByte() override;
105     void* CreateDITypeForShort() override;
106     void* CreateDITypeForUShort() override;
107     void* CreateDITypeForInt() override;
108     void* CreateDITypeForUInt() override;
109     void* CreateDITypeForLong() override;
110     void* CreateDITypeForULong() override;
111     void* CreateDITypeForFloat() override;
112     void* CreateDITypeForDouble() override;
113     void* CreateDITypeForChar() override;
114     void* CreateDITypeForWChar() override;
115     void* CreateDITypeForUChar() override;
116     void* CreateDITypeForVoid() override;
117     void* CreateDITypeForArray(void* elementDITypeconst std::std::vector<void*>&elements) override;
118     void* CreateDITypeForEnumConstant(const std::string& nameint64_t value) override;
119     void* CreateDITypeForEnumType(const std::string& nameconst std::string& mangledNameconst Span& spanconst boost::uuids::uuid& moduleIdconst std::std::vector<void*>&enumConstantElements
120         uint64_t sizeInBitsuint32_t alignInBitsvoid* underlyingDIType) override;
121     void* CreateIrDIForwardDeclaration(void* irTypeconst std::string& nameconst std::string& mangledNameconst Span& spanconst boost::uuids::uuid& moduleId) override;
122     uint64_t GetOffsetInBits(void* classIrTypeint layoutIndex) override;
123     void* CreateDITypeForClassType(void* irTypeconst std::std::vector<void*>&memberVariableElementsconstSpan&classSpanconstboost::uuids::uuid&moduleIdconst std::string& namevoid* vtableHolderClass
124         const std::string& mangledNamevoid* baseClassDIType) override;
125     void MapFwdDeclaration(void* fwdDeclarationconst boost::uuids::uuid& typeId) override;
126     void* GetDITypeByTypeId(const boost::uuids::uuid& typeId) const override;
127     void SetDITypeByTypeId(const boost::uuids::uuid& typeIdvoid* diTypeconst std::string& typeName) override;
128     void* GetDIMemberType(const std::std::pair<boost::uuids::uuidint32_t>&memberVariableId) override;
129     void SetDIMemberType(const std::std::pair<boost::uuids::uuidint32_t>&memberVariableIdvoid*diType) override;
130     void* CreateDIMemberType(void* scopeconst std::string& nameconst Span& spanconst boost::uuids::uuid& moduleIduint64_t sizeInBitsuint64_t alignInBitsuint64_t offsetInBitsvoid* diType) override;
131     void* CreateConstDIType(void* diType) override;
132     void* CreateLValueRefDIType(void* diType) override;
133     void* CreateRValueRefDIType(void* diType) override;
134     void* CreatePointerDIType(void* diType) override;
135     void* CreateUnspecifiedDIType(const std::string& name) override;
136     void MapClassPtr(const boost::uuids::uuid& typeIdvoid* classPtrconst std::string& className) override;
137     uint64_t GetSizeInBits(void* irType) override;
138     uint64_t GetAlignmentInBits(void* irType) override;
139     void SetCurrentDebugLocation(const Span& span) override;
140     void* GetArrayBeginAddress(void* arrayPtr) override;
141     void* GetArrayEndAddress(void* arrayPtruint64_t size) override;
142     void* CreateBasicBlock(const std::string& name) override;
143     void* CreateIncludeBasicBlockInstruction(void* basicBlock) override;
144     void PushParentBlock() override;
145     void PopParentBlock() override;
146     void SetHandlerBlock(void* tryBlockvoid* catchBlock) override;
147     void SetCleanupBlock(void* cleanupBlock) override;
148     int GetBasicBlockId(void* basicBlock) override;
149     void CreateBr(void* targetBasicBlock) override;
150     void* CurrentBasicBlock() const override;
151     void SetCurrentBasicBlock(void* basicBlock) override;
152     void CreateCondBr(void* condvoid* trueBasicBlockvoid* falseBasicBlock) override;
153     void* CreateArrayIndexAddress(void* arrayPtrvoid* index) override;
154     void CreateStore(void* valuevoid* ptr) override;
155     void* CreateLoad(void* ptr) override;
156     void* CreateAdd(void* leftvoid* right) override;
157     void* CreateFAdd(void* leftvoid* right) override;
158     void* CreateSub(void* leftvoid* right) override;
159     void* CreateFSub(void* leftvoid* right) override;
160     void* CreateMul(void* leftvoid* right) override;
161     void* CreateFMul(void* leftvoid* right) override;
162     void* CreateUDiv(void* leftvoid* right) override;
163     void* CreateSDiv(void* leftvoid* right) override;
164     void* CreateFDiv(void* leftvoid* right) override;
165     void* CreateURem(void* leftvoid* right) override;
166     void* CreateSRem(void* leftvoid* right) override;
167     void* CreateAnd(void* leftvoid* right) override;
168     void* CreateOr(void* leftvoid* right) override;
169     void* CreateXor(void* leftvoid* right) override;
170     void* CreateShl(void* leftvoid* right) override;
171     void* CreateAShr(void* leftvoid* right) override;
172     void* CreateLShr(void* leftvoid* right) override;
173     void* CreateICmpEQ(void* leftvoid* right) override;
174     void* CreateFCmpOEQ(void* leftvoid* right) override;
175     void* CreateICmpULT(void* leftValuevoid* rightValue) override;
176     void* CreateICmpSLT(void* leftValuevoid* rightValue) override;
177     void* CreateFCmpOLT(void* leftValuevoid* rightValue) override;
178     void* CreateSExt(void* operandvoid* destinationType) override;
179     void* CreateZExt(void* operandvoid* destinationType) override;
180     void* CreateFPExt(void* operandvoid* destinationType) override;
181     void* CreateTrunc(void* operandvoid* destinationType) override;
182     void* CreateFPTrunc(void* operandvoid* destinationType) override;
183     void* CreateBitCast(void* operandvoid* destinationType) override;
184     void* CreateUIToFP(void* operandvoid* destinationType) override;
185     void* CreateSIToFP(void* operandvoid* destinationType) override;
186     void* CreateFPToUI(void* operandvoid* destinationType) override;
187     void* CreateFPToSI(void* operandvoid* destinationType) override;
188     void* CreateIntToPtr(void* intValuevoid* destinationType) override;
189     void* CreatePtrToInt(void* ptrValuevoid* destinationType) override;
190     void* CreateNot(void* value) override;
191     void* CreateNeg(void* value) override;
192     void* CreateFNeg(void* value) override;
193     void* CreateNop() override;
194     void* CreateSave() override;
195     void* CreateBeginTry() override;
196     void* CreateEndTry(void* nextDest) override;
197     void* CreateBeginCatch() override;
198     void* CreateEndCatch(void* nextDest) override;
199     std::string GetVmtObjectName(void* symbol) const override;
200     void SetVmtObjectName(void* symbolconst std::string& vmtObjectName) override;
201     std::string GetImtArrayObjectName(void* symbol) const override;
202     void SetImtArrayObjectName(void* symbolconst std::string& imtArrayObjectName) override;
203     void* GetVmtObjectType(void* symbol) const override;
204     void SetVmtObjectType(void* symbolvoid* vmtObjectType) override;
205     void* GetStaticObjectType(void* symbol) const override;
206     void SetStaticObjectType(void* symbolvoid* type) override;
207     std::string GetStaticObjectName(void* symbol) const override;
208     void SetStaticObjectName(void* symbolconst std::string& staticObjectName) override;
209     void* GetOrInsertGlobal(const std::string& namevoid* type) override;
210     void* GetOrInsertAnyComdat(const std::string& namevoid* global) override;
211     void* GetOrInsertAnyFunctionComdat(const std::string& namevoid* function) override;
212     void* GetOrInsertFunction(const std::string& namevoid* typebool nothrow) override;
213     void SetInitializer(void* globalvoid* initializer) override;
214     void SetPrivateLinkage(void* global) override;
215     bool IsVmtObjectCreated(void* symbol) const override;
216     void SetVmtObjectCreated(void* symbol) override;
217     bool IsStaticObjectCreated(void* symbol) const override;
218     void SetStaticObjectCreated(void* symbol) override;
219     void* HandlerBlock() override;
220     void* CleanupBlock() override;
221     bool NewCleanupNeeded() override;
222     void CreateCleanup() override;
223     cmajor::ir::Pad* CurrentPad() override;
224     void* CreateCleanupPadWithParent(void* parentPadconst std::std::vector<void*>&args) override;
225     void* CreateCleanupPad(const std::std::vector<void*>&args) override;
226     void* CreateCleanupRet(void* cleanupPadvoid* unwindTarget) override;
227     void* CreateCatchRet(void* catchPadvoid* returnTarget) override;
228     void* CreateCatchSwitch(void* unwindBlock) override;
229     void* CreateCatchSwitchWithParent(void* parentPadvoid* unwindBlock) override;
230     void AddHandlerToCatchSwitch(void* catchSwitchvoid* target) override;
231     void* CreateCatchPad(void* parentPadconst std::std::vector<void*>&args) override;
232     void* CreateClassDIType(void* classPtr) override;
233     void* CreateCall(void* calleeconst std::std::vector<void*>&args) override;
234     void* CreateCallInst(void* calleeconst std::std::vector<void*>&argsconststd::std::vector<void*>&bundlesconstSpan&span) override;
235     void* CreateCallInstToBasicBlock(void* calleeconst std::std::vector<void*>&argsconststd::std::vector<void*>&bundlesvoid*basicBlockconstSpan&span) override;
236     void* CreateInvoke(void* calleevoid* normalBlockvoid* unwindBlockconst std::std::vector<void*>&args) override;
237     void* CreateInvokeInst(void* calleevoid* normalBlockvoid* unwindBlockconst std::std::vector<void*>&argsconststd::std::vector<void*>&bundlesconstSpan&span) override;
238     void* DIBuilder() override;
239     void SetCurrentDIBuilder(void* diBuilder_) override;
240     void* GetObjectFromClassDelegate(void* classDelegatePtr) override;
241     void* GetDelegateFromClassDelegate(void* classDelegatePtr) override;
242     void* GetObjectFromInterface(void* interfaceTypePtr) override;
243     void* GetObjectPtrFromInterface(void* interfaceTypePtr) override;
244     void* GetImtPtrFromInterface(void* interfaceTypePtr) override;
245     void* GetInterfaceMethod(void* imtPtrint32_t methodIndexvoid* interfaceMethodType) override;
246     void* GetFunctionIrType(void* functionSymbol) const override;
247     void SetFunctionIrType(void* symbolvoid* irType) override;
248     void* GetVmtPtr(void* thisPtrint32_t vmtPtrIndexvoid* vmtPtrType) override;
249     void* GetMethodPtr(void* vmtPtrint32_t vmtIndex) override;
250     void* GetImtArray(void* vmtObjectPtrint32_t imtsVmtIndexOffset) override;
251     void* GetImt(void* imtArrayint32_t interfaceIndex) override;
252     void* GetIrObject(void* symbol) const override;
253     void SetIrObject(void* symbolvoid* irObject) override;
254     void* GetMemberVariablePtr(void* classPtrint32_t memberVariableLayoutIndex) override;
255     void* SizeOf(void* ptrType) override;
256     void SetLineNumber(int32_t lineNumber) override;
257     void SaveObjectPointer(void* objectPointer_) override;
258     void SetObjectPointer(void* objectPointer_) override;
259     void* GetObjectPointer() override;
260     void* GetClassIdPtr(void* vmtPtrint32_t classIdVmtIndexOffset) override;
261     void* GetClassName(void* vmtPtrint32_t classNameVmtIndexOffset) override;
262     void* ComputeAddress(void* ptrvoid* index) override;
263     void* CreatePtrDiff(void* leftvoid* right) override;
264     uint32_t GetPrivateFlag() override;
265     uint32_t GetProtectedFlag() override;
266     uint32_t GetPublicFlag() override;
267     uint32_t GetNoFlags() override;
268     void* CreateModule(const std::string& moduleName) override;
269     void DestroyModule(void* module) override;
270     void SetModule(void* module_) override;
271     void SetTargetTriple(const std::string& targetTriple) override;
272     void SetDataLayout(void* dataLayout_) override;
273     void SetSourceFileName(const std::string& sourceFileName) override;
274     void SetDICompileUnit(void* diCompileUnit_) override;
275     void SetDIFile(void* diFile_) override;
276     void SetColumnSpanProvider(cmajor::common::ColumnSpanProvider* columnSpanProvider_) override;
277     void ResetCurrentDebugLocation() override;
278     void StartDebugInfo(const std::string& sourceFilePathconst std::string& compilerVersionbool optimizedcmajor::common::ColumnSpanProvider* columnSpanProvider_) override;
279     void FinalizeDebugInfo() override;
280     void EndDebugInfo() override;
281     void EmitIrText(const std::string& filePath) override;
282     void EmitIrFile(const std::string& filePath) override;
283     void Optimize(const std::string& bcFilePathconst std::string& optBCFilePathconst std::string& optimizationFlags) override;
284     void Disassemble(const std::string& bcFilePathconst std::string& filePath) override;
285     void Compile(const std::string& bcFilePathconst std::string& objectFilePathint optimizationLevel) override;
286     void VerifyModule() override;
287     void EmitObjectCodeFile(const std::string& objectFilePath) override;
288     void* CreateDebugInfoForNamespace(void* scopeconst std::string& name) override;
289     void* GetDebugInfoForFile(const Span& spanconst boost::uuids::uuid& moduleId) override;
290     void PushScope(void* scope) override;
291     void PopScope() override;
292     void* CurrentScope() override;
293     uint64_t GetClassTypeSizeInBits(void* classIrType) override;
294     uint64_t GetClassTypeAlignmentInBits(void* classIrType) override;
295     void AddInlineFunctionAttribute(void* function) override;
296     void SetFunctionLinkage(void* functionbool setInline) override;
297     void SetFunctionLinkageToLinkOnceODRLinkage(void* function) override;
298     void SetFunctionCallConventionToStdCall(void* function) override;
299     void SetFunction(void* function_int32_t fileIndexconst boost::uuids::uuid& sourceModuleIdconst boost::uuids::uuid& functionId) override;
300     void SetFunctionName(const std::string& functionName) override;
301     void BeginScope() override;
302     void EndScope() override;
303     int16_t GetCurrentScopeId() const override;
304     void SetCurrentScopeId(int16_t scopeId) override;
305     int32_t AddControlFlowGraphNode() override;
306     void SetCurrentControlFlowGraphNodeId(int32_t controlFlowGraphNodeId) override;
307     void AddControlFlowGraphEdge(int32_t startNodeIdint32_t endNodeId) override;
308     void AddLocalVariable(const std::string& localVariableNameconst boost::uuids::uuid& typeIdvoid* irObject) override;
309     void BeginInstructionFlag(int16_t flag) override;
310     void EndInstructionFlag(int16_t flag) override;
311     void SetInPrologue(bool inPrologue_) override;
312     void* CreateSubroutineType(const std::std::vector<void*>&elementTypes) override;
313     unsigned GetPureVirtualVirtuality() override;
314     unsigned GetVirtualVirtuality() override;
315     unsigned GetFunctionFlags(bool isStaticunsigned accessFlagsbool isExplicit) override;
316     void* CreateDIMethod(const std::string& nameconst std::string& mangledNameconst Span& spanconst boost::uuids::uuid& moduleIdvoid* subroutineTypeunsigned virtualityunsigned vtableIndexvoid* vtableHolder
317         unsigned flags) override;
318     void* CreateDIFunction(const std::string& nameconst std::string& mangledNameconst Span& spanconst boost::uuids::uuid& moduleIdvoid* subroutineTypeunsigned flags) override;
319     void SetDISubprogram(void* functionvoid* subprogram) override;
320     void* CreateAlloca(void* irType) override;
321     void* CreateDIParameterVariable(const std::string& nameint indexconst Span& spanconst boost::uuids::uuid& moduleIdvoid* irTypevoid* allocaInst) override;
322     void* CreateDIAutoVariable(const std::string& nameconst Span& spanconst boost::uuids::uuid& moduleIdvoid* irTypevoid* allocaInst) override;
323     void* GetFunctionArgument(void* functionint argumentIndex) override;
324     void SetDebugLoc(void* callInst) override;
325     void* CreateRet(void* value) override;
326     void* CreateRetVoid() override;
327     void SetPersonalityFunction(void* functionvoid* personalityFunction) override;
328     void AddNoUnwindAttribute(void* function) override;
329     void AddUWTableAttribute(void* function) override;
330     void* CreateLexicalBlock(const Span& spanconst boost::uuids::uuid& moduleId) override;
331     void* CreateSwitch(void* conditionvoid* defaultDestunsigned numCases) override;
332     void AddCase(void* switchInstvoid* caseValuevoid* caseDest) override;
333     void* GenerateTrap(const std::std::vector<void*>&args) override;
334     void SetCompileUnitId(const std::string& compileUnitId) override;
335     void* GetClsIdValue(const std::string& typeId) override;
336     void* CreateMDBool(bool value) override;
337     void* CreateMDLong(int64_t value) override;
338     void* CreateMDString(const std::string& value) override;
339     void* CreateMDStructRef(int id) override;
340     int GetMDStructId(void* mdStruct) override;
341     void* CreateMDStruct() override;
342     void* CreateMDBasicBlockRef(void* bb) override;
343     void AddMDItem(void* mdStructconst std::string& fieldNamevoid* mdItem) override;
344     void SetFunctionMdId(void* functionint mdId) override;
345     void SetCurrentSourceSpan(int32_t lineint16_t scolint16_t ecol) override;
346     void* GetMDStructRefForSourceFile(const std::string& sourceFileName) override;
347     void SetMetadataRef(void* instvoid* mdStructRef) override;
348     void FinalizeFunction(void* functionbool hasCleanup) override;
349     int Install(const std::string& str) override;
350     int Install(const std::u16string& str) override;
351     int Install(const std::u32string& str) override;
352     void* CreateLandingPad(void* lpType) override;
353     void SetLandindPadAsCleanup(void* landingPad) override;
354     void MoveAllocaIntoBasicBlock(void* allocaInstvoid* lastAllocavoid* basicBlock) override;
355     void AddClauseToLangdingPad(void* landingPadvoid* exceptionTypeId) override;
356     void* CreateExtractValue(void* aggregateconst std::std::vector<unsigned int>&indeces) override;
357     void* CreateInsertValue(void* aggregatevoid* valueconst std::std::vector<unsigned int>&indeces) override;
358     void* CreateUndefValue(void* type) override;
359     void CreateResume(void* exception) override;
360     void DebugPrintDebugInfo(const std::string& filePath) override;
361     void BeginSubstituteLineNumber(int32_t lineNumber) override;
362     void EndSubstituteLineNumber() override;
363     void SetBoundCompileUnit(void* boundCompileUnit_) override { }
364     void* GetBoundCompileUnit() const override { return nullptr; }
365 private:
366     cmsxbe::EmittingContext* emittingContext;
367     cmajor::ir::EmittingDelegate* emittingDelegate;
368     ValueStack stack;
369     cmsxi::CompileUnit* compileUnit;
370     cmsxi::Context* context;
371     std::unordered_map<void*cmsxi::FunctionType*> functionIrTypeMap;
372     std::unordered_map<boost::uuids::uuidcmsxi::Type*boost::boost::hash<boost::uuids::uuid>>irTypeTypeIdMap;
373     cmsxi::Function* currentFunction;
374     std::unordered_map<void*cmsxi::Value*> irObjectMap;
375     std::unordered_set<void*> vmtObjectCreatedSet;
376     std::unordered_set<void*> staticObjectCreatedSet;
377     std::unordered_map<void*cmsxi::StructureType*> staticTypeMap;
378     std::unordered_map<void*std::string> staticObjectNameMap;
379     cmsxi::Value* objectPointer;
380 };
381 
382 } // namespace cmsxbe
383 
384 #endif // CMAJOR_CMSXBE_EMITTER_INCLUDED