hoshi-lang dev
Yet another programming language
Loading...
Searching...
No Matches
IR.h
Go to the documentation of this file.
1//
2// Created by XIaokang00010 on 2024/9/6.
3//
4
5#ifndef HOSHI_LANG_IR_H
6#define HOSHI_LANG_IR_H
7
8#include "share/def.hpp"
9#include <any>
12#include <map>
13#include <memory>
14#include <set>
15
16namespace yoi {
17 class structDefInnerPair;
18 class implInnerPair;
19
31 std::map<yoi::wstr, yoi::wstr> marcos;
34
35 struct Builder {
46 std::map<yoi::wstr, yoi::wstr> marcos;
48 (std::filesystem::temp_directory_path() /
49 (L"hanabi-" + std::to_wstring(std::chrono::system_clock::now().time_since_epoch().count()))).wstring()};
51
52 Builder() = default;
53
55
57
59
61
63
65
67
68 Builder &addSearchPath(const yoi::wstr &searchPath);
69
71
72 Builder &setMarco(const yoi::wstr &name, const yoi::wstr &value);
73
75
77
79
81
82 std::shared_ptr<IRBuildConfig> yield();
83 };
84 };
85
91
92 struct IRMetadata {
93 std::map<yoi::wstr, std::any> metadata;
94
95 template <typename T> T &getMetadata(const yoi::wstr &key) {
96 return *std::any_cast<T>(&metadata.at(key));
97 }
98
99 template <typename T> const T &getMetadata(const yoi::wstr &key) const {
100 return *std::any_cast<T>(&metadata.at(key));
101 }
102
103 template <typename T> void setMetadata(const yoi::wstr &key, const T &value) {
104 metadata[key] = value;
105 }
106
107 void eraseMetadata(const yoi::wstr &key);
108
109 bool hasMetadata(const yoi::wstr &key) const;
110
111 yoi::wstr to_string() const;
112 };
113
115 public:
117 enum class valueType : yoi::indexT {
118 integerRaw = 0,
121 shortRaw,
126 null,
134 pointerObject, // a placeholder for void* in llvmCodegen for unified interface this pointer
135 pointer,
137 none,
138 charRaw,
142 bracedInitalizerList, // placeholder for basic casts
145
148
150
152
153 std::set<ValueAttr> attributes;
154
156
157 IRValueType();
158
160
162
163 IRValueType(valueType type, yoi::indexT typeAffiliateModule, yoi::indexT objectPrototypeIndex, const std::set<ValueAttr> &attributes);
164
166
168
170
171 bool isBasicType() const;
172
173 bool isBasicRawType() const;
174
175 bool isForeignBasicType() const;
176
177 bool is1ByteType() const;
178
179 bool isArrayType() const;
180
181 bool isDynamicArrayType() const;
182
184
186
188
190
192
194
195 yoi::wstr to_string(bool showAttributes = false) const;
196
197 bool operator==(const yoi::IRValueType &rhs) const;
198
200
202
203 bool hasAttribute(ValueAttr attr) const;
204
206 };
207
208 class IROperand {
209 public:
210 enum class operandType {
211 unknown = 0,
212 integer,
213 decimal,
214 boolean,
215 character,
217 codeBlock,
218 index,
219 shortInt,
221 /* a local var operand can only be used in a load_local instruction for loading a local variable, not
222 available for other instructions */
223 localVar,
224 /* same for global var */
225 globalVar,
226 /* same for extern var */
227 externVar,
228 FINAL
230
232
258
259 std::shared_ptr<IRValueType> lvalueType;
260
261 IROperand();
262
264
265 IROperand(operandType type, std::shared_ptr<IRValueType> lvalueType);
266
267 std::shared_ptr<IRValueType> getLvalueType();
268
269 yoi::wstr to_string() const;
270 };
271
272 class IR {
273 public:
274 enum class Opcode {
275 unknown = 0,
277 negate,
279 mul,
280 mod,
281 div,
282 increment,
283 decrement,
284 add,
285 sub,
287 less_than,
291 equal,
293 not_equal,
298 jump,
307 ret,
308 ret_none,
313 push_null,
316 pop,
327 store_member, // only for struct
328 store_field, // only for data struct
329 load_field, // only for data struct
330 initialize_field, // once and for all initialization of data struct fields, push the struct itself as a result. act like constructor
331 invoke,
359 throws,
366 yield,
368 resume,
369 nop,
370 FINAL,
372
374
376
378
379 IR() = default;
380
382
383 yoi::wstr to_string() const;
384 };
385
387 public:
389 std::shared_ptr<IRValueType> type;
390 };
391
416
419
420 public:
421 IRCodeBlock() = default;
422
423 void insert(const IR &ir);
424
425 yoi::wstr to_string(yoi::indexT indent = 0);
426
428 };
429
433 std::map<yoi::indexT, yoi::indexT> variableScopeMap;
434 std::map<yoi::indexT, yoi::wstr> reversedVariableNameMap;
435
436 public:
437 IRVariableTable() = default;
438
440
448 yoi::indexT lookup(const yoi::wstr &name);
449
450 std::shared_ptr<IRValueType> get(yoi::indexT index);
451
452 std::shared_ptr<IRValueType> operator[](const yoi::wstr &name);
453
454 void set(yoi::indexT index, const std::shared_ptr<IRValueType> &type);
455
456 yoi::indexT put(const yoi::wstr &name, const std::shared_ptr<IRValueType> &type);
457
458 void popScope();
459
460 yoi::wstr to_string(yoi::indexT indent = 0);
461
463
464 std::map<yoi::indexT, yoi::wstr> &getReversedVariableNameMap();
465
467 };
468
470 public:
486
489 std::shared_ptr<IRValueType> returnType;
492 std::set<FunctionAttrs> attrs;
494
496
498 const yoi::vec<std::pair<yoi::wstr, std::shared_ptr<IRValueType>>> &argumentTypes,
499 const std::shared_ptr<IRValueType> &returnType,
500 const yoi::vec<std::shared_ptr<IRCodeBlock>> &codeBlock,
501 const std::set<FunctionAttrs> &attrs,
502 const IRDebugInfo &debugInfo);
503
505
506 yoi::wstr to_string(yoi::indexT indent = 0);
507
508 bool hasAttribute(const FunctionAttrs &attr);
509
510 struct Builder {
513 std::shared_ptr<IRValueType> returnType;
514 std::set<FunctionAttrs> attrs;
516
517 Builder() = default;
518
519 Builder &setName(const yoi::wstr &name);
520
521 Builder &addArgument(const yoi::wstr &argumentName, const std::shared_ptr<IRValueType> &argumentType);
522
523 Builder &setReturnType(const std::shared_ptr<IRValueType> &returnType);
524
526
528
529 std::shared_ptr<IRFunctionDefinition> yield();
530 };
531 };
532
534 public:
535 struct Argument {
536 std::shared_ptr<IRValueType> templateType;
537
539
540 Argument(const std::shared_ptr<IRValueType> &templateType, const yoi::vec<externModuleAccessExpression *> &satisfyConditions);
541
542 Argument(const std::shared_ptr<IRValueType> &templateType);
543 };
544
546
547 IRTemplateBuilder() = default;
548
550 const std::shared_ptr<IRValueType> &templateType,
551 const yoi::vec<externModuleAccessExpression *> &satisfyConditions = {});
552 };
553
555 public:
556 std::shared_ptr<IRFunctionDefinition> templateDefinition;
558
559 IRFunctionTemplate(const std::shared_ptr<IRFunctionDefinition> &templateDefinition,
561
562 class Builder : public IRTemplateBuilder {
563 public:
564 std::shared_ptr<IRFunctionDefinition> templateDefinition;
565
566 Builder() = default;
567
568 Builder &setTemplateDefinition(const std::shared_ptr<IRFunctionDefinition> &templateDefinition);
569
570 std::shared_ptr<IRFunctionTemplate> yield();
571 };
572 };
573
575 public:
578
579 std::map<yoi::wstr, yoi::indexT> fields;
580
582
584 const yoi::vec<std::shared_ptr<IRValueType>> &fieldTypes,
585 const std::map<yoi::wstr, yoi::indexT> &fields,
587
588 yoi::wstr to_string(yoi::indexT indent = 0);
589
590 struct Builder {
593 std::map<yoi::wstr, yoi::indexT> fields;
595
596 Builder() = default;
597
598 Builder &setName(const yoi::wstr &name);
599
600 Builder &addField(const yoi::wstr &fieldName, const std::shared_ptr<IRValueType> &fieldType);
601
603
604 std::shared_ptr<IRDataStructDefinition> yield();
605 };
606 };
607
609 public:
612
613 struct nameInfo {
614 enum class nameType { field, method } type;
616 };
617 std::map<yoi::wstr, nameInfo> nameIndexMap;
618
621 std::map<yoi::wstr, yoi::structDefInnerPair *> templateMethodDecls;
622 std::map<yoi::wstr, yoi::implInnerPair *> templateMethodDefs;
623
625
627 const std::map<yoi::wstr, nameInfo> &nameIndexMap,
628 const vec<std::shared_ptr<IRValueType>> &fieldTypes,
631 const std::map<yoi::wstr, yoi::structDefInnerPair *> &templateMethodDecls = {},
632 const std::map<yoi::wstr, yoi::implInnerPair *> &templateMethodDefs = {});
633
641 const nameInfo &lookupName(const yoi::wstr &name);
642
643 yoi::wstr to_string(yoi::indexT indent = 0);
644
645 struct Builder {
647 std::map<yoi::wstr, nameInfo> nameIndexMap;
649
650 Builder() = default;
651
654 std::map<yoi::wstr, yoi::structDefInnerPair *> templateMethodDecls;
655 std::map<yoi::wstr, yoi::implInnerPair *> templateMethodDefs;
656
657 Builder &setName(const yoi::wstr &name);
658
659 Builder &addField(const yoi::wstr &fieldName, const std::shared_ptr<IRValueType> &fieldType);
660
661 Builder &addMethod(const yoi::wstr &methodName, yoi::indexT index);
662
663 Builder &setStoredTemplateArgs(const yoi::vec<yoi::wstr> &paramNames, const yoi::vec<std::shared_ptr<IRValueType>> &args);
664
666
668
669 std::shared_ptr<IRStructDefinition> yield();
670 };
671 };
672
674 public:
675 std::shared_ptr<IRStructDefinition> templateDefinition;
678
679 IRStructTemplate(const std::shared_ptr<IRStructDefinition> &templateDefinition,
680 const yoi::indexTable<yoi::wstr, std::shared_ptr<IRFunctionTemplate>> &templateMethods,
682
683 class Builder : public IRTemplateBuilder {
684 public:
685 std::shared_ptr<IRStructDefinition> templateDefinition;
687
688 Builder() = default;
689
690 Builder &setTemplateDefinition(const std::shared_ptr<IRStructDefinition> &templateDefinition);
691
692 Builder &setTemplateMethod(const yoi::wstr &methodName, const std::shared_ptr<IRFunctionTemplate> &methodTemplate);
693
694 std::shared_ptr<IRStructTemplate> yield();
695 };
696 };
697
699 public:
701 std::tuple<IRValueType::valueType, yoi::indexT, yoi::indexT> implStructIndex;
702 std::pair<yoi::indexT, yoi::indexT> implInterfaceIndex;
704 std::map<yoi::wstr, yoi::indexT> virtualMethodIndexMap;
705
707
709 std::tuple<IRValueType::valueType, yoi::indexT, yoi::indexT> implStructIndex,
710 const std::pair<yoi::indexT, yoi::indexT> &implInterfaceIndex,
711 const yoi::vec<std::shared_ptr<IRValueType>> &virtualMethods,
712 const std::map<yoi::wstr, yoi::indexT> &virtualMethodIndexMap);
713
714 yoi::wstr to_string(yoi::indexT indent = 0);
715
716 struct Builder {
718 std::tuple<IRValueType::valueType, yoi::indexT, yoi::indexT> implStructIndex;
719 std::pair<yoi::indexT, yoi::indexT> implInterfaceIndex;
720
722 std::map<yoi::wstr, yoi::indexT> virtualMethodIndexMap;
723
724 Builder() = default;
725
726 Builder &setName(const yoi::wstr &name);
727
728 Builder &setImplStructIndex(std::tuple<IRValueType::valueType, yoi::indexT, yoi::indexT> implStructIndex);
729
730 Builder &setImplInterfaceIndex(const std::pair<yoi::indexT, yoi::indexT> &implInterfaceIndex);
731
732 Builder &addVirtualMethod(const yoi::wstr &methodName, const std::shared_ptr<IRValueType> &methodType);
733
734 std::shared_ptr<IRInterfaceImplementationDefinition> yield();
735 };
736 };
737
739 public:
741 std::map<yoi::wstr, yoi::vec<yoi::indexT>> functionOverloadIndexies;
744
746
749 const yoi::indexTable<yoi::wstr, std::shared_ptr<IRFunctionDefinition>> &methodMap);
750
751 yoi::wstr to_string(yoi::indexT indent = 0);
752
753 struct Builder {
755 std::map<yoi::wstr, yoi::vec<yoi::indexT>> functionOverloadIndexies;
757
758 Builder() = default;
759
760 Builder &setName(const yoi::wstr &name);
761
762 Builder &
763 addMethod(const yoi::wstr &methodNameOri, const yoi::wstr &methodName, const std::shared_ptr<IRFunctionDefinition> &methodSignature);
764
765 std::shared_ptr<IRInterfaceInstanceDefinition> yield();
766 };
767 };
768
770 public:
771 std::shared_ptr<IRInterfaceInstanceDefinition> templateDefinition;
773
774 class Builder : public IRTemplateBuilder {
775 public:
776 std::shared_ptr<IRInterfaceInstanceDefinition> templateDefinition;
777
778 Builder() = default;
779
780 Builder &setTemplateDefinition(const std::shared_ptr<IRInterfaceInstanceDefinition> &templateDefinition);
781
782 std::shared_ptr<IRInterfaceInstanceTemplate> yield();
783 };
784
785 IRInterfaceInstanceTemplate(const std::shared_ptr<IRInterfaceInstanceDefinition> &templateDefinition,
787 };
788
790 public:
791 std::shared_ptr<IRInterfaceImplementationDefinition> templateDefinition;
793
794 class Builder : public IRTemplateBuilder {
795 public:
796 std::shared_ptr<IRInterfaceImplementationDefinition> templateDefinition;
798
799 Builder() = default;
800
801 Builder &setTemplateDefinition(const std::shared_ptr<IRInterfaceImplementationDefinition> &templateDefinition);
802
803 std::shared_ptr<IRInterfaceImplementationTemplate> yield();
804 };
805
806 IRInterfaceImplementationTemplate(const std::shared_ptr<IRInterfaceImplementationDefinition> &templateDefinition,
808 };
809
818
841
849
850 class IRModule : std::enable_shared_from_this<IRModule> {
851 public:
855 std::map<yoi::wstr, yoi::indexT> moduleImports;
856 std::set<yoi::indexT> dependentModules;
865
866 std::map<yoi::wstr, yoi::funcDefStmt *> funcTemplateAsts;
867 std::map<yoi::wstr, yoi::structDefStmt *> structTemplateAsts;
868 std::map<yoi::wstr, yoi::interfaceDefStmt *> templateInterfaceAsts;
869 std::map<yoi::wstr, yoi::implStmt *> templateImplAsts; // Maps struct template name to its impl block
870 std::map<yoi::wstr, yoi::vec<yoi::implStmt *>> templateInterfaceImplAsts;
871 std::map<yoi::wstr, yoi::typeAliasStmt *> typeAliasTemplateAsts;
872 std::map<yoi::wstr, IRValueType> typeAliases;
873 std::map<yoi::wstr, yoi::vec<yoi::indexT>> functionOverloadIndexies;
874 std::map<yoi::wstr, std::shared_ptr<IRConcept>> concepts;
875
877
878 yoi::wstr to_string(yoi::indexT indent = 0);
879 };
880
881 class IRBuilder {
886 std::shared_ptr<compilerContext> compilerCtx;
887 std::shared_ptr<IRModule> currentModule;
888 std::shared_ptr<IRFunctionDefinition> currentFunction;
889 std::vector<std::shared_ptr<IRCodeBlock>> codeBlocks;
890 std::vector<std::shared_ptr<yoi::IRValueType>> tempVarStack;
897
898 public:
899 IRBuilder() = delete;
900
901 IRBuilder(std::shared_ptr<compilerContext> compilerCtx,
902 std::shared_ptr<IRModule> currentModule,
903 std::shared_ptr<IRFunctionDefinition> currentFunction);
904
905 void setDebugInfo(const IRDebugInfo &debugInfo);
906
908
909 void pushLoopContext(yoi::indexT breakTarget, yoi::indexT continueTarget);
910
911 void popLoopContext();
912
914
915 void discardState();
916
917 void restoreState();
918
919 void restoreStateTemporarily(); // rollback to the state with current state saved
920
921 void commitState(); // commit the overriden state and pour the saved state back
922
923 void discardStateUntil(yoi::indexT stateIndex);
924
925 void pushTempVar(const std::shared_ptr<IRValueType> &type);
926
928
929 std::shared_ptr<IRFunctionDefinition> irFuncDefinition();
930
932
934
941
943
944 void yield();
945
946 void insert(const IR &ir, yoi::indexT insertionPoint = 0xffffffff);
947
948 yoi::IROperand createLocalVar(const yoi::wstr &varName, const std::shared_ptr<IRValueType> &type);
949
951
952 std::shared_ptr<IRValueType> &getLhsFromTempVarStack();
953
954 std::shared_ptr<IRValueType> &getRhsFromTempVarStack();
955
956 void basicCast(const std::shared_ptr<IRValueType> &valType, yoi::indexT insertionPoint, bool lhs = false);
957
958 void popOp();
959
961
962 void arithmeticOp(IR::Opcode op);
963
964 bool hasTerminated();
965
966 void jumpOp(yoi::indexT target);
967
968 void jumpIfOp(IR::Opcode op, yoi::indexT target);
969
970 void pushOp(IR::Opcode op, const yoi::IROperand &constV);
971
972 void loadOp(IR::Opcode op, const yoi::IROperand &source, const std::shared_ptr<IRValueType> &expectedType, yoi::indexT moduleIndex = -1);
973
974 void loadFieldOp(yoi::vec<yoi::IROperand> &accessors, const std::shared_ptr<IRValueType> &expectedType);
975
976 void loadMemberOp(const yoi::IROperand &memberIndex, const std::shared_ptr<IRValueType> &memberType);
977
978 void storeOp(IR::Opcode op, const yoi::IROperand &operand, yoi::indexT moduleIndex = -1);
979
980 void storeMemberOp(const yoi::IROperand &memberIndex);
981
982 void storeFieldOp(yoi::vec<yoi::IROperand> &accessors);
983
991 void invokeOp(yoi::indexT funcIndex,
992 yoi::indexT funcArgsCount,
993 const std::shared_ptr<IRValueType> &returnType,
994 bool externalInvocation = false,
995 yoi::indexT moduleIndex = -1);
996
1006 void invokeDanglingOp(yoi::indexT funcIndex,
1007 yoi::indexT funcArgsCount,
1008 const std::shared_ptr<IRValueType> &returnType,
1009 bool externalInvocation = false,
1010 yoi::indexT moduleIndex = -1);
1011
1012 void invokeMethodOp(yoi::indexT funcIndex,
1013 yoi::indexT methodArgsCount,
1014 const std::shared_ptr<IRValueType> &returnType,
1015 bool isStatic,
1016 bool externalInvocation = false,
1017 yoi::indexT moduleIndex = -1);
1018
1019 void invokeVirtualOp(yoi::indexT funcIndex,
1020 yoi::indexT interfaceIndex,
1021 yoi::indexT methodArgsCount,
1022 const std::shared_ptr<IRValueType> &returnType,
1023 bool externalInvocation = false,
1024 yoi::indexT moduleIndex = -1);
1025
1026 void invokeImportedOp(yoi::indexT libIndex, yoi::indexT funcIndex, yoi::indexT funcArgsCount, const std::shared_ptr<IRValueType> &returnType);
1027
1028 void retOp(bool returnWithNone = false);
1029
1030 void newStructOp(yoi::indexT structIndex, bool isExternal = false, yoi::indexT moduleIndex = -1);
1031
1032 void newDataStructOp(yoi::indexT structIndex, bool isExternal = false, yoi::indexT moduleIndex = -1);
1033
1034 void initializeFieldsOp(yoi::indexT parameterCount);
1035
1036 void newInterfaceOp(yoi::indexT interfaceIndex, bool isExternal = false, yoi::indexT moduleIndex = -1);
1037
1038 void constructInterfaceImplOp(const std::pair<yoi::indexT, yoi::indexT> &interfaceId,
1039 yoi::indexT interfaceImplIndex,
1040 bool isExternal = false,
1041 yoi::indexT moduleIndex = -1);
1042
1043 void newArrayOp(const std::shared_ptr<IRValueType> &elementType, const yoi::vec<yoi::indexT> &dimensions, yoi::indexT onstackElementCount);
1044
1045 void newDynamicArrayOp(const std::shared_ptr<IRValueType> &elementType, yoi::indexT initializerSize = 0);
1046
1047 void arrayLengthOp();
1048
1049 void interfaceOfOp();
1050
1051 void typeIdOp(const std::shared_ptr<IRValueType> &type);
1052
1053 void typeIdOp();
1054
1055 void dynCastOp(const std::shared_ptr<IRValueType> &type);
1056
1057 void pointerCastOp();
1058
1059 void breakOp();
1060
1061 void continueOp();
1062
1063 enum class ExtractType { All, First, Last };
1064
1070 void bindElementsOp(yoi::indexT extractElementCount, ExtractType extractType);
1071
1077 void bindFieldsOp(yoi::indexT extractFieldCount, ExtractType extractType);
1078
1083 void yieldOp(bool yieldNone = false);
1084
1088 void resumeOp();
1089
1091
1092 void popFromTempVarStack();
1093 };
1094
1096 public:
1097 /* one module that has renamed all functions and variables to their final names */
1098 std::shared_ptr<IRModule> compiledModule;
1099
1101 };
1102
1104 public:
1113
1115
1117
1119
1120 yoi::indexT addImportedFunction(const yoi::wstr &libraryName,
1121 const yoi::wstr &functionName,
1122 const std::shared_ptr<IRFunctionDefinition> &functionDefinition);
1123
1124 void addForeignType(const yoi::wstr &foreignTypeName, const std::shared_ptr<IRValueType> &structType);
1125
1135 void addExportedFunction(const yoi::wstr &exportName,
1136 yoi::indexT moduleIndex,
1137 yoi::indexT functionIndex,
1138 const std::set<IRFunctionDefinition::FunctionAttrs> &attrs);
1139 };
1140} // namespace yoi
1141
1142#endif // HOSHI_LANG_IR_H
void pushLoopContext(yoi::indexT breakTarget, yoi::indexT continueTarget)
Definition IR.cpp:1526
std::vector< std::shared_ptr< IRCodeBlock > > codeBlocks
Definition IR.h:889
void invokeOp(yoi::indexT funcIndex, yoi::indexT funcArgsCount, const std::shared_ptr< IRValueType > &returnType, bool externalInvocation=false, yoi::indexT moduleIndex=-1)
Invoke a function with the given arguments.
Definition IR.cpp:382
bool hasTerminated()
Definition IR.cpp:1464
yoi::indexT saveState()
Definition IR.cpp:1166
void continueOp()
Definition IR.cpp:1496
std::shared_ptr< IRModule > currentModule
Definition IR.h:887
IRValueType getLocalVar(yoi::indexT index)
std::shared_ptr< IRValueType > & getLhsFromTempVarStack()
Definition IR.cpp:159
void newDataStructOp(yoi::indexT structIndex, bool isExternal=false, yoi::indexT moduleIndex=-1)
Definition IR.cpp:462
const IRDebugInfo & getCurrentDebugInfo()
Definition IR.cpp:1209
yoi::vec< std::shared_ptr< yoi::IRValueType > > tempStateTempVarStack
Definition IR.h:894
std::shared_ptr< IRFunctionDefinition > currentFunction
Definition IR.h:888
void popOp()
Definition IR.cpp:1191
void yieldOp(bool yieldNone=false)
Definition IR.cpp:1705
void invokeVirtualOp(yoi::indexT funcIndex, yoi::indexT interfaceIndex, yoi::indexT methodArgsCount, const std::shared_ptr< IRValueType > &returnType, bool externalInvocation=false, yoi::indexT moduleIndex=-1)
Definition IR.cpp:420
void pushOp(IR::Opcode op, const yoi::IROperand &constV)
Definition IR.cpp:303
yoi::vec< std::tuple< yoi::indexT, yoi::indexT, yoi::indexT > > codeBlockInsertionStates
Definition IR.h:892
void interfaceOfOp()
Definition IR.cpp:1347
IRCodeBlock & getCodeBlock(yoi::indexT index)
Definition IR.cpp:128
void storeOp(IR::Opcode op, const yoi::IROperand &operand, yoi::indexT moduleIndex=-1)
Definition IR.cpp:350
void typeIdOp()
Definition IR.cpp:1218
void basicCast(const std::shared_ptr< IRValueType > &valType, yoi::indexT insertionPoint, bool lhs=false)
Definition IR.cpp:169
yoi::indexT createCodeBlock()
Definition IR.cpp:123
void breakOp()
Definition IR.cpp:1491
void constructInterfaceImplOp(const std::pair< yoi::indexT, yoi::indexT > &interfaceId, yoi::indexT interfaceImplIndex, bool isExternal=false, yoi::indexT moduleIndex=-1)
Definition IR.cpp:471
void loadFieldOp(yoi::vec< yoi::IROperand > &accessors, const std::shared_ptr< IRValueType > &expectedType)
Definition IR.cpp:1687
void yield()
Definition IR.cpp:132
std::shared_ptr< IRFunctionDefinition > irFuncDefinition()
Definition IR.cpp:502
void pushTempVar(const std::shared_ptr< IRValueType > &type)
Definition IR.cpp:1187
void newArrayOp(const std::shared_ptr< IRValueType > &elementType, const yoi::vec< yoi::indexT > &dimensions, yoi::indexT onstackElementCount)
Definition IR.cpp:1108
void loadOp(IR::Opcode op, const yoi::IROperand &source, const std::shared_ptr< IRValueType > &expectedType, yoi::indexT moduleIndex=-1)
Definition IR.cpp:329
void storeFieldOp(yoi::vec< yoi::IROperand > &accessors)
Definition IR.cpp:1694
void invokeImportedOp(yoi::indexT libIndex, yoi::indexT funcIndex, yoi::indexT funcArgsCount, const std::shared_ptr< IRValueType > &returnType)
Definition IR.cpp:1072
void newStructOp(yoi::indexT structIndex, bool isExternal=false, yoi::indexT moduleIndex=-1)
Definition IR.cpp:453
yoi::indexT currentCodeBlockIndex
Definition IR.h:891
yoi::indexT switchCodeBlock(yoi::indexT index)
Definition IR.cpp:492
void discardState()
Definition IR.cpp:1171
void discardStateUntil(yoi::indexT stateIndex)
Definition IR.cpp:1458
void newInterfaceOp(yoi::indexT interfaceIndex, bool isExternal=false, yoi::indexT moduleIndex=-1)
void bindElementsOp(yoi::indexT extractElementCount, ExtractType extractType)
Definition IR.cpp:1501
void insert(const IR &ir, yoi::indexT insertionPoint=0xffffffff)
Definition IR.cpp:147
yoi::vec< IR > tempStateCodeBlock
Definition IR.h:893
void invokeMethodOp(yoi::indexT funcIndex, yoi::indexT methodArgsCount, const std::shared_ptr< IRValueType > &returnType, bool isStatic, bool externalInvocation=false, yoi::indexT moduleIndex=-1)
Definition IR.cpp:398
void uniqueArithmeticOp(IR::Opcode op)
Definition IR.cpp:233
void pointerCastOp()
Definition IR.cpp:1278
yoi::IROperand createLocalVar(const yoi::wstr &varName, const std::shared_ptr< IRValueType > &type)
Definition IR.cpp:142
void loadMemberOp(const yoi::IROperand &memberIndex, const std::shared_ptr< IRValueType > &memberType)
Definition IR.cpp:344
void arrayLengthOp()
Definition IR.cpp:1341
void popLoopContext()
Definition IR.cpp:1487
void commitState()
Definition IR.cpp:1446
IRCodeBlock & getCurrentCodeBlock()
Definition IR.cpp:138
void initializeFieldsOp(yoi::indexT parameterCount)
Definition IR.cpp:1680
void resumeOp()
Definition IR.cpp:1700
IRBuilder()=delete
void jumpOp(yoi::indexT target)
Definition IR.cpp:286
IRDebugInfo currentDebugInfo
Definition IR.h:895
void bindFieldsOp(yoi::indexT extractFieldCount, ExtractType extractType)
Definition IR.cpp:1513
void restoreState()
Definition IR.cpp:1176
void jumpIfOp(IR::Opcode op, yoi::indexT target)
Definition IR.cpp:292
yoi::indexT getCurrentInsertionPoint()
Definition IR.cpp:484
void restoreStateTemporarily()
Definition IR.cpp:1435
void invokeDanglingOp(yoi::indexT funcIndex, yoi::indexT funcArgsCount, const std::shared_ptr< IRValueType > &returnType, bool externalInvocation=false, yoi::indexT moduleIndex=-1)
invoke a function with the given arguments, but the last param will be taken as the first param.
Definition IR.cpp:1532
void newDynamicArrayOp(const std::shared_ptr< IRValueType > &elementType, yoi::indexT initializerSize=0)
Definition IR.cpp:1284
std::shared_ptr< compilerContext > compilerCtx
Definition IR.h:886
std::vector< std::shared_ptr< yoi::IRValueType > > tempVarStack
Definition IR.h:890
void popFromTempVarStack()
Definition IR.cpp:488
void storeMemberOp(const yoi::IROperand &memberIndex)
Definition IR.cpp:375
void arithmeticOp(IR::Opcode op)
Definition IR.cpp:242
yoi::indexT getCurrentCodeBlockIndex()
Definition IR.cpp:498
void dynCastOp(const std::shared_ptr< IRValueType > &type)
Definition IR.cpp:1249
std::shared_ptr< IRValueType > & getRhsFromTempVarStack()
Definition IR.cpp:164
yoi::vec< LoopContext > loopContext
Definition IR.h:896
void retOp(bool returnWithNone=false)
Definition IR.cpp:438
void setDebugInfo(const IRDebugInfo &debugInfo)
Definition IR.cpp:1204
yoi::vec< IR > & getIRArray()
Definition IR.cpp:518
void insert(const IR &ir)
Definition IR.cpp:506
yoi::wstr to_string(yoi::indexT indent=0)
Definition IR.cpp:510
IRCodeBlock()=default
yoi::vec< IR > codeBlock
Definition IR.h:418
conceptDefinition * def
Definition IR.h:847
yoi::indexT affiliateModule
Definition IR.h:845
yoi::wstr name
Definition IR.h:844
yoi::vec< std::shared_ptr< IRValueType > > fieldTypes
Definition IR.h:577
std::map< yoi::wstr, yoi::indexT > fields
Definition IR.h:579
yoi::wstr to_string(yoi::indexT indent=0)
Definition IR.cpp:1670
yoi::indexT linkedModuleId
Definition IR.h:581
Builder & addValue(const yoi::wstr &valueName, yoi::indexT valueIndex)
Definition IR.cpp:1580
std::shared_ptr< IREnumerationType > yield()
Definition IR.cpp:1614
yoi::indexTable< yoi::wstr, yoi::indexT > valueToIndexMap
Definition IR.h:404
Builder & setName(const yoi::wstr &name)
Definition IR.cpp:1575
UnderlyingType getUnderlyingType()
Definition IR.cpp:1561
yoi::indexTable< yoi::wstr, yoi::indexT > valueToIndexMap
Definition IR.h:396
yoi::wstr name
Definition IR.h:395
yoi::indexT itemIndex
Definition IR.h:833
externType getExternType() const
Definition IR.cpp:886
yoi::indexT affiliateModule
Definition IR.h:832
enum yoi::IRExternEntry::externType type
yoi::wstr name
Definition IR.h:831
IRExternEntry()=default
yoi::indexTable< yoi::wstr, std::shared_ptr< IRFunctionDefinition > > importedFunctionTable
Definition IR.h:1109
void addForeignType(const yoi::wstr &foreignTypeName, const std::shared_ptr< IRValueType > &structType)
Definition IR.cpp:1058
void addExportedFunction(const yoi::wstr &exportName, yoi::indexT moduleIndex, yoi::indexT functionIndex, const std::set< IRFunctionDefinition::FunctionAttrs > &attrs)
Add an exported function to the FFI table.
Definition IR.cpp:1051
yoi::indexT addImportedFunction(const yoi::wstr &libraryName, const yoi::wstr &functionName, const std::shared_ptr< IRFunctionDefinition > &functionDefinition)
Definition IR.cpp:1041
yoi::indexTable< yoi::wstr, std::tuple< yoi::indexT, yoi::indexT, std::set< IRFunctionDefinition::FunctionAttrs > > > exportedFunctionTable
Definition IR.h:1114
yoi::indexTable< yoi::wstr, std::shared_ptr< IRValueType > > foreignTypeTable
Definition IR.h:1116
yoi::indexTable< yoi::wstr, ImportLibrary > importedLibraries
Definition IR.h:1118
yoi::vec< std::shared_ptr< IRValueType > > argumentTypes
Definition IR.h:488
std::shared_ptr< IRValueType > returnType
Definition IR.h:489
IRDebugInfo debugInfo
Definition IR.h:493
IRVariableTable variableTable
Definition IR.h:491
yoi::wstr to_string(yoi::indexT indent=0)
Definition IR.cpp:522
yoi::vec< std::shared_ptr< IRCodeBlock > > codeBlock
Definition IR.h:490
yoi::indexT linkedModuleId
Definition IR.h:495
bool hasAttribute(const FunctionAttrs &attr)
Definition IR.cpp:1427
std::set< FunctionAttrs > attrs
Definition IR.h:492
IRVariableTable & getVariableTable()
Definition IR.cpp:619
std::shared_ptr< IRFunctionDefinition > templateDefinition
Definition IR.h:564
std::shared_ptr< IRFunctionTemplate > yield()
Definition IR.cpp:970
Builder & setTemplateDefinition(const std::shared_ptr< IRFunctionDefinition > &templateDefinition)
Definition IR.cpp:965
std::shared_ptr< IRFunctionDefinition > templateDefinition
Definition IR.h:556
yoi::indexTable< yoi::wstr, IRTemplateBuilder::Argument > templateArguments
Definition IR.h:557
yoi::wstr to_string(yoi::indexT indent=0)
Definition IR.cpp:946
std::pair< yoi::indexT, yoi::indexT > implInterfaceIndex
Definition IR.h:702
std::map< yoi::wstr, yoi::indexT > virtualMethodIndexMap
Definition IR.h:704
std::tuple< IRValueType::valueType, yoi::indexT, yoi::indexT > implStructIndex
Definition IR.h:701
yoi::vec< std::shared_ptr< IRValueType > > virtualMethods
Definition IR.h:703
std::shared_ptr< IRInterfaceImplementationDefinition > templateDefinition
Definition IR.h:796
yoi::indexTable< yoi::wstr, IRTemplateBuilder::Argument > templateArguments
Definition IR.h:797
std::shared_ptr< IRInterfaceImplementationTemplate > yield()
Definition IR.cpp:1008
Builder & setTemplateDefinition(const std::shared_ptr< IRInterfaceImplementationDefinition > &templateDefinition)
Definition IR.cpp:1002
std::shared_ptr< IRInterfaceImplementationDefinition > templateDefinition
Definition IR.h:791
yoi::indexTable< yoi::wstr, IRTemplateBuilder::Argument > templateArguments
Definition IR.h:792
std::map< yoi::wstr, yoi::vec< yoi::indexT > > functionOverloadIndexies
Definition IR.h:741
yoi::vec< std::tuple< IRValueType::valueType, yoi::indexT, yoi::indexT > > implementations
Definition IR.h:743
yoi::wstr to_string(yoi::indexT indent=0)
Definition IR.cpp:936
yoi::indexTable< yoi::wstr, std::shared_ptr< IRFunctionDefinition > > methodMap
Definition IR.h:742
std::shared_ptr< IRInterfaceInstanceTemplate > yield()
Definition IR.cpp:993
Builder & setTemplateDefinition(const std::shared_ptr< IRInterfaceInstanceDefinition > &templateDefinition)
Definition IR.cpp:988
std::shared_ptr< IRInterfaceInstanceDefinition > templateDefinition
Definition IR.h:776
yoi::indexTable< yoi::wstr, IRTemplateBuilder::Argument > templateArguments
Definition IR.h:772
std::shared_ptr< IRInterfaceInstanceDefinition > templateDefinition
Definition IR.h:771
yoi::wstr modulePath
Definition IR.h:854
std::map< yoi::wstr, yoi::implStmt * > templateImplAsts
Definition IR.h:869
std::map< yoi::wstr, yoi::vec< yoi::indexT > > functionOverloadIndexies
Definition IR.h:873
std::set< yoi::indexT > dependentModules
Definition IR.h:856
std::map< yoi::wstr, yoi::structDefStmt * > structTemplateAsts
Definition IR.h:867
yoi::indexTable< yoi::wstr, std::shared_ptr< IRInterfaceInstanceDefinition > > interfaceTable
Definition IR.h:862
std::map< yoi::wstr, std::shared_ptr< IRConcept > > concepts
Definition IR.h:874
std::map< yoi::wstr, yoi::vec< yoi::implStmt * > > templateInterfaceImplAsts
Definition IR.h:870
yoi::indexTable< yoi::wstr, std::shared_ptr< IRValueType > > globalVariables
Definition IR.h:859
yoi::wstr to_string(yoi::indexT indent=0)
Definition IR.cpp:99
std::map< yoi::wstr, yoi::interfaceDefStmt * > templateInterfaceAsts
Definition IR.h:868
yoi::indexTable< yoi::wstr, std::shared_ptr< IRStructDefinition > > structTable
Definition IR.h:858
IRStringLiteralPool stringLiteralPool
Definition IR.h:876
std::map< yoi::wstr, yoi::funcDefStmt * > funcTemplateAsts
Definition IR.h:866
yoi::indexT identifier
Definition IR.h:852
yoi::indexTable< yoi::wstr, std::shared_ptr< IRFunctionDefinition > > functionTable
Definition IR.h:857
yoi::indexTable< yoi::wstr, std::shared_ptr< IRInterfaceImplementationDefinition > > interfaceImplementationTable
Definition IR.h:863
std::map< yoi::wstr, IRValueType > typeAliases
Definition IR.h:872
std::map< yoi::wstr, yoi::typeAliasStmt * > typeAliasTemplateAsts
Definition IR.h:871
std::map< yoi::wstr, yoi::indexT > moduleImports
Definition IR.h:855
yoi::indexTable< yoi::wstr, std::shared_ptr< IRDataStructDefinition > > dataStructTable
Definition IR.h:864
yoi::indexTable< yoi::wstr, std::shared_ptr< IREnumerationType > > enumerationTable
Definition IR.h:861
bool compiled
Definition IR.h:853
yoi::indexTable< yoi::wstr, std::shared_ptr< IRExternEntry > > externTable
Definition IR.h:860
yoi::indexT entryModule
Definition IR.h:1100
std::shared_ptr< IRModule > compiledModule
Definition IR.h:1098
enum yoi::IROperand::operandType type
std::shared_ptr< IRValueType > lvalueType
Definition IR.h:259
static enum_range< operandType > IROperandTypeEnumRange
Definition IR.h:231
union yoi::IROperand::operandValue value
std::shared_ptr< IRValueType > getLvalueType()
Definition IR.cpp:37
yoi::wstr to_string() const
Definition IR.cpp:41
yoi::wstr & getStringLiteral(yoi::indexT index)
Definition IR.cpp:835
yoi::indexT addStringLiteral(const yoi::wstr &str)
Definition IR.cpp:831
yoi::indexPool< yoi::wstr > pool
Definition IR.h:812
yoi::vec< std::shared_ptr< IRValueType > > fieldTypes
Definition IR.h:611
yoi::vec< std::shared_ptr< IRValueType > > storedTemplateArgs
Definition IR.h:620
yoi::wstr to_string(yoi::indexT indent=0)
Definition IR.cpp:768
const nameInfo & lookupName(const yoi::wstr &name)
Lookup a name in the struct definition, returning the index of the field or method and its type.
Definition IR.cpp:780
yoi::wstr name
Definition IR.h:610
std::map< yoi::wstr, yoi::structDefInnerPair * > templateMethodDecls
Definition IR.h:621
std::map< yoi::wstr, nameInfo > nameIndexMap
Definition IR.h:617
std::map< yoi::wstr, yoi::implInnerPair * > templateMethodDefs
Definition IR.h:622
yoi::indexT linkedModuleId
Definition IR.h:624
yoi::vec< yoi::wstr > templateParamNames
Definition IR.h:619
Builder & setTemplateDefinition(const std::shared_ptr< IRStructDefinition > &templateDefinition)
Definition IR.cpp:974
std::shared_ptr< IRStructDefinition > templateDefinition
Definition IR.h:685
Builder & setTemplateMethod(const yoi::wstr &methodName, const std::shared_ptr< IRFunctionTemplate > &methodTemplate)
Definition IR.cpp:1019
std::shared_ptr< IRStructTemplate > yield()
Definition IR.cpp:979
yoi::indexTable< yoi::wstr, std::shared_ptr< IRFunctionTemplate > > templateMethods
Definition IR.h:686
std::shared_ptr< IRStructDefinition > templateDefinition
Definition IR.h:675
yoi::indexTable< yoi::wstr, IRTemplateBuilder::Argument > templateArguments
Definition IR.h:677
yoi::indexTable< yoi::wstr, std::shared_ptr< IRFunctionTemplate > > templateMethods
Definition IR.h:676
yoi::indexTable< yoi::wstr, Argument > templateArguments
Definition IR.h:545
IRTemplateBuilder & addTemplateArgument(const yoi::wstr &templateName, const std::shared_ptr< IRValueType > &templateType, const yoi::vec< externModuleAccessExpression * > &satisfyConditions={})
Definition IR.cpp:1012
std::shared_ptr< IRValueType > type
Definition IR.h:389
yoi::wstr name
Definition IR.h:388
bool isArrayType() const
Definition IR.cpp:1090
yoi::vec< IRValueType > bracedTypes
Definition IR.h:151
IRMetadata metadata
Definition IR.h:155
IRValueType getNormalizedForeignBasicType()
Definition IR.cpp:643
IRValueType getArrayType(const yoi::vec< yoi::indexT > &dimensions)
Definition IR.cpp:1162
IRValueType getBasicRawType() const
Definition IR.cpp:1376
bool isForeignBasicType() const
Definition IR.cpp:635
yoi::indexT calculateDimensionSize() const
Definition IR.cpp:1632
IRValueType & removeAttribute(ValueAttr attr)
Definition IR.cpp:1358
bool is1ByteType() const
Definition IR.cpp:639
IRValueType getElementType()
Definition IR.cpp:1103
enum yoi::IRValueType::valueType type
bool isDynamicArrayType() const
Definition IR.cpp:1337
IRValueType getBasicObjectType() const
Definition IR.cpp:1406
IRValueType getDynamicArrayType()
Definition IR.cpp:1333
bool hasAttribute(ValueAttr attr) const
Definition IR.cpp:1354
yoi::wstr to_string(bool showAttributes=false) const
Definition IR.cpp:661
std::set< ValueAttr > attributes
Definition IR.h:153
yoi::vec< yoi::indexT > dimensions
Definition IR.h:149
IRValueType & addAttribute(ValueAttr attr)
Definition IR.cpp:1363
bool operator==(const yoi::IRValueType &rhs) const
Definition IR.cpp:753
yoi::indexT typeIndex
Definition IR.h:147
bool isBasicRawType() const
Definition IR.cpp:1371
bool isBasicType() const
Definition IR.cpp:628
yoi::indexT typeAffiliateModule
Definition IR.h:146
yoi::vec< std::map< yoi::wstr, yoi::indexT > > variableNameIndexMap
Definition IR.h:432
IRVariableTable()=default
std::shared_ptr< IRValueType > operator[](const yoi::wstr &name)
Definition IR.cpp:871
void set(yoi::indexT index, const std::shared_ptr< IRValueType > &type)
Definition IR.cpp:1712
yoi::indexT put(const yoi::wstr &name, const std::shared_ptr< IRValueType > &type)
Definition IR.cpp:875
std::shared_ptr< IRValueType > get(yoi::indexT index)
Definition IR.cpp:867
std::map< yoi::indexT, yoi::wstr > & getReversedVariableNameMap()
Definition IR.cpp:1030
yoi::wstr to_string(yoi::indexT indent=0)
Definition IR.cpp:857
yoi::indexT createScope()
Definition IR.cpp:848
yoi::indexT lookup(const yoi::wstr &name)
Look up a variable by name in the current scope. If the variable is not found in the current scope,...
Definition IR.cpp:839
yoi::vec< std::shared_ptr< IRValueType > > variables
Definition IR.h:431
std::map< yoi::indexT, yoi::wstr > reversedVariableNameMap
Definition IR.h:434
std::map< yoi::indexT, yoi::indexT > variableScopeMap
Definition IR.h:433
yoi::vec< std::shared_ptr< IRValueType > > & getVariables()
Definition IR.cpp:1026
yoi::indexT scopeIndex(yoi::indexT varIndex)
Definition IR.cpp:1483
Definition IR.h:272
Opcode
Definition IR.h:274
static enum_range< Opcode > IROpCodeEnumRange
Definition IR.h:373
IRDebugInfo debugInfo
Definition IR.h:377
IR()=default
yoi::vec< IROperand > operands
Definition IR.h:375
enum yoi::IR::Opcode opcode
yoi::wstr to_string() const
Definition IR.cpp:74
wstr::value_type wchar
Definition def.hpp:52
std::vector< t > vec
Definition def.hpp:56
std::wstring wstr
Definition def.hpp:51
uint64_t indexT
Definition def.hpp:54
Builder & addSearchPath(const yoi::wstr &searchPath)
Definition IR.cpp:1067
yoi::wstr targetTriple
Definition IR.h:41
bool preserveIntermediateFiles
Definition IR.h:42
yoi::vec< yoi::wstr > additionalLinkingFiles
Definition IR.h:44
Builder & setImmediatelyClearupCache(bool immediatelyClearupCache)
Definition IR.cpp:1627
BuildType buildType
Definition IR.h:36
Builder & setBuildType(BuildType buildType)
Definition IR.cpp:890
Builder & setBuildCachePath(const yoi::wstr &buildCachePath)
Definition IR.cpp:1620
std::shared_ptr< IRBuildConfig > yield()
Definition IR.cpp:905
Builder & setAdditionalLinkingFiles(const yoi::vec< yoi::wstr > &additionalLinkingFiles)
Definition IR.cpp:1548
yoi::wstr buildArch
Definition IR.h:40
BuildMode buildMode
Definition IR.h:37
Builder & setPreserveIntermediateFiles(bool preserveIntermediateFiles)
Definition IR.cpp:931
Builder & setBuildMode(BuildMode buildMode)
Definition IR.cpp:921
Builder & setBuildPlatform(const yoi::wstr &buildPlatform)
Definition IR.cpp:895
Builder & setTargetTriple(const yoi::wstr &targetTriple)
Definition IR.cpp:1721
yoi::vec< yoi::wstr > additionalLinkerOptions
Definition IR.h:45
Builder & setBuildArch(const yoi::wstr &buildArch)
Definition IR.cpp:900
UseObjectLinker useObjectLinker
Definition IR.h:38
std::map< yoi::wstr, yoi::wstr > marcos
Definition IR.h:46
yoi::wstr buildCachePath
Definition IR.h:47
yoi::wstr buildPlatform
Definition IR.h:39
yoi::vec< yoi::wstr > searchPaths
Definition IR.h:43
Builder & setAdditionalLinkerOptions(const yoi::vec< yoi::wstr > &additionalLinkerOptions)
Definition IR.cpp:1553
Builder & setSearchPaths(const yoi::vec< yoi::wstr > &searchPaths)
Definition IR.cpp:1062
Builder & setMarco(const yoi::wstr &name, const yoi::wstr &value)
Definition IR.cpp:1478
Builder & setUseObjectLinker(UseObjectLinker useObjectLinker)
Definition IR.cpp:926
enum yoi::IRBuildConfig::BuildMode buildMode
yoi::wstr targetTriple
Definition IR.h:26
bool preserveIntermediateFiles
Definition IR.h:27
yoi::vec< yoi::wstr > additionalLinkingFiles
Definition IR.h:29
yoi::wstr buildArch
Definition IR.h:25
yoi::vec< yoi::wstr > additionalLinkerOptions
Definition IR.h:30
std::map< yoi::wstr, yoi::wstr > marcos
Definition IR.h:31
enum yoi::IRBuildConfig::BuildType buildType
yoi::wstr buildCachePath
Definition IR.h:32
yoi::wstr buildPlatform
Definition IR.h:24
enum yoi::IRBuildConfig::UseObjectLinker useObjectLinker
yoi::vec< yoi::wstr > searchPaths
Definition IR.h:28
bool immediatelyClearupCache
Definition IR.h:33
yoi::indexT continueTarget
Definition IR.h:884
yoi::indexT breakTarget
Definition IR.h:883
yoi::vec< std::shared_ptr< IRValueType > > fieldTypes
Definition IR.h:592
std::map< yoi::wstr, yoi::indexT > fields
Definition IR.h:593
Builder & addField(const yoi::wstr &fieldName, const std::shared_ptr< IRValueType > &fieldType)
Definition IR.cpp:1654
std::shared_ptr< IRDataStructDefinition > yield()
Definition IR.cpp:1666
Builder & setLinkedModuleId(yoi::indexT linkedModuleId)
Definition IR.cpp:1661
Builder & setName(const yoi::wstr &name)
Definition IR.cpp:1649
yoi::indexT column
Definition IR.h:89
yoi::indexT line
Definition IR.h:88
yoi::wstr sourceFile
Definition IR.h:87
std::shared_ptr< IRValueType > returnType
Definition IR.h:513
Builder & setDebugInfo(const IRDebugInfo &debugInfo)
Definition IR.cpp:1213
yoi::vec< std::pair< yoi::wstr, std::shared_ptr< IRValueType > > > argumentTypes
Definition IR.h:512
std::shared_ptr< IRFunctionDefinition > yield()
Definition IR.cpp:601
Builder & setName(const yoi::wstr &name)
Definition IR.cpp:541
Builder & addArgument(const yoi::wstr &argumentName, const std::shared_ptr< IRValueType > &argumentType)
Definition IR.cpp:590
Builder & setReturnType(const std::shared_ptr< IRValueType > &returnType)
Definition IR.cpp:596
Builder & addAttr(FunctionAttrs attr)
Definition IR.cpp:1273
std::set< FunctionAttrs > attrs
Definition IR.h:514
std::shared_ptr< IRInterfaceImplementationDefinition > yield()
Definition IR.cpp:570
Builder & setImplStructIndex(std::tuple< IRValueType::valueType, yoi::indexT, yoi::indexT > implStructIndex)
Definition IR.cpp:552
Builder & setImplInterfaceIndex(const std::pair< yoi::indexT, yoi::indexT > &implInterfaceIndex)
Definition IR.cpp:558
Builder & addVirtualMethod(const yoi::wstr &methodName, const std::shared_ptr< IRValueType > &methodType)
Definition IR.cpp:564
std::pair< yoi::indexT, yoi::indexT > implInterfaceIndex
Definition IR.h:719
std::map< yoi::wstr, yoi::indexT > virtualMethodIndexMap
Definition IR.h:722
Builder & setName(const yoi::wstr &name)
Definition IR.cpp:546
std::tuple< IRValueType::valueType, yoi::indexT, yoi::indexT > implStructIndex
Definition IR.h:718
yoi::vec< std::shared_ptr< IRValueType > > virtualMethods
Definition IR.h:721
std::map< yoi::wstr, yoi::vec< yoi::indexT > > functionOverloadIndexies
Definition IR.h:755
std::shared_ptr< IRInterfaceInstanceDefinition > yield()
Definition IR.cpp:586
yoi::indexTable< yoi::wstr, std::shared_ptr< IRFunctionDefinition > > methodMap
Definition IR.h:756
Builder & setName(const yoi::wstr &name)
Definition IR.cpp:575
Builder & addMethod(const yoi::wstr &methodNameOri, const yoi::wstr &methodName, const std::shared_ptr< IRFunctionDefinition > &methodSignature)
Definition IR.cpp:580
T & getMetadata(const yoi::wstr &key)
Definition IR.h:95
void setMetadata(const yoi::wstr &key, const T &value)
Definition IR.h:103
yoi::wstr to_string() const
Definition IR.cpp:1595
std::map< yoi::wstr, std::any > metadata
Definition IR.h:93
void eraseMetadata(const yoi::wstr &key)
Definition IR.cpp:1585
const T & getMetadata(const yoi::wstr &key) const
Definition IR.h:99
bool hasMetadata(const yoi::wstr &key) const
Definition IR.cpp:1591
std::shared_ptr< IRStructDefinition > yield()
Definition IR.cpp:821
Builder & setStoredTemplateArgs(const yoi::vec< yoi::wstr > &paramNames, const yoi::vec< std::shared_ptr< IRValueType > > &args)
Definition IR.cpp:804
yoi::vec< std::shared_ptr< IRValueType > > fieldTypes
Definition IR.h:648
Builder & addMethod(const yoi::wstr &methodName, yoi::indexT index)
Definition IR.cpp:799
yoi::vec< std::shared_ptr< IRValueType > > storedTemplateArgs
Definition IR.h:653
Builder & addTemplateMethodDef(const yoi::wstr &name, yoi::implInnerPair *def)
Definition IR.cpp:816
Builder & addField(const yoi::wstr &fieldName, const std::shared_ptr< IRValueType > &fieldType)
Definition IR.cpp:793
Builder & addTemplateMethodDecl(const yoi::wstr &name, yoi::structDefInnerPair *decl)
Definition IR.cpp:811
std::map< yoi::wstr, yoi::structDefInnerPair * > templateMethodDecls
Definition IR.h:654
std::map< yoi::wstr, nameInfo > nameIndexMap
Definition IR.h:647
std::map< yoi::wstr, yoi::implInnerPair * > templateMethodDefs
Definition IR.h:655
Builder & setName(const yoi::wstr &name)
Definition IR.cpp:788
yoi::vec< yoi::wstr > templateParamNames
Definition IR.h:652
enum yoi::IRStructDefinition::nameInfo::nameType type
std::shared_ptr< IRValueType > templateType
Definition IR.h:536
yoi::vec< externModuleAccessExpression * > satisfyCondition
Definition IR.h:538
yoi::indexT symbolIndex
Definition IR.h:239
yoi::indexT stringLiteralIndex
Definition IR.h:238
yoi::indexT codeBlockIndex
Definition IR.h:240