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
29 std::map<yoi::wstr, yoi::wstr> marcos;
32
76 };
77
83
84 struct IRMetadata {
85 std::map<yoi::wstr, std::any> metadata;
86
87 template <typename T> T &getMetadata(const yoi::wstr &key) {
88 return *std::any_cast<T>(&metadata.at(key));
89 }
90
91 template <typename T> const T &getMetadata(const yoi::wstr &key) const {
92 return *std::any_cast<T>(&metadata.at(key));
93 }
94
95 template <typename T> void setMetadata(const yoi::wstr &key, const T &value) {
96 metadata[key] = value;
97 }
98
99 void eraseMetadata(const yoi::wstr &key);
100
101 bool hasMetadata(const yoi::wstr &key) const;
102
103 yoi::wstr to_string() const;
104 };
105
107 public:
109 enum class valueType : yoi::indexT {
110 integerRaw = 0,
113 shortRaw,
118 null,
126 pointerObject, // a placeholder for void* in llvmCodegen for unified interface this pointer
127 pointer,
129 none,
130 charRaw,
134 bracedInitalizerList, // placeholder for basic casts
137
140
142
144
145 std::set<ValueAttr> attributes;
146
148
149 IRValueType();
150
152
154
155 IRValueType(valueType type, yoi::indexT typeAffiliateModule, yoi::indexT objectPrototypeIndex, const std::set<ValueAttr> &attributes);
156
158
160
162
163 bool isBasicType() const;
164
165 bool isBasicRawType() const;
166
167 bool isForeignBasicType() const;
168
169 bool is1ByteType() const;
170
171 bool isArrayType() const;
172
173 bool isDynamicArrayType() const;
174
176
178
180
182
184
186
187 yoi::wstr to_string(bool showAttributes = false) const;
188
189 bool operator==(const yoi::IRValueType &rhs) const;
190
192
194
195 bool hasAttribute(ValueAttr attr) const;
196
198 };
199
200 class IROperand {
201 public:
202 enum class operandType {
203 unknown = 0,
204 integer,
205 decimal,
206 boolean,
207 character,
209 codeBlock,
210 index,
211 shortInt,
213 /* a local var operand can only be used in a load_local instruction for loading a local variable, not
214 available for other instructions */
215 localVar,
216 /* same for global var */
217 globalVar,
218 /* same for extern var */
219 externVar,
220 FINAL
222
224
250
251 std::shared_ptr<IRValueType> lvalueType;
252
253 IROperand();
254
256
257 IROperand(operandType type, std::shared_ptr<IRValueType> lvalueType);
258
259 std::shared_ptr<IRValueType> getLvalueType();
260
261 yoi::wstr to_string() const;
262 };
263
264 class IR {
265 public:
266 enum class Opcode {
267 unknown = 0,
269 negate,
271 mul,
272 mod,
273 div,
274 increment,
275 decrement,
276 add,
277 sub,
279 less_than,
283 equal,
285 not_equal,
290 jump,
299 ret,
300 ret_none,
305 push_null,
308 pop,
319 store_member, // only for struct
320 store_field, // only for data struct
321 load_field, // only for data struct
322 initialize_field, // once and for all initialization of data struct fields, push the struct itself as a result. act like constructor
323 invoke,
351 throws,
358 yield,
360 resume,
361 nop,
362 FINAL,
364
366
368
370
371 IR() = default;
372
374
375 yoi::wstr to_string() const;
376 };
377
379 public:
381 std::shared_ptr<IRValueType> type;
382 };
383
408
411
412 public:
413 IRCodeBlock() = default;
414
415 void insert(const IR &ir);
416
417 yoi::wstr to_string(yoi::indexT indent = 0);
418
420 };
421
425 std::map<yoi::indexT, yoi::indexT> variableScopeMap;
426 std::map<yoi::indexT, yoi::wstr> reversedVariableNameMap;
427
428 public:
429 IRVariableTable() = default;
430
432
440 yoi::indexT lookup(const yoi::wstr &name);
441
442 std::shared_ptr<IRValueType> get(yoi::indexT index);
443
444 std::shared_ptr<IRValueType> operator[](const yoi::wstr &name);
445
446 void set(yoi::indexT index, const std::shared_ptr<IRValueType> &type);
447
448 yoi::indexT put(const yoi::wstr &name, const std::shared_ptr<IRValueType> &type);
449
450 void popScope();
451
452 yoi::wstr to_string(yoi::indexT indent = 0);
453
455
456 std::map<yoi::indexT, yoi::wstr> &getReversedVariableNameMap();
457
459 };
460
462 public:
478
481 std::shared_ptr<IRValueType> returnType;
484 std::set<FunctionAttrs> attrs;
486
488
490 const yoi::vec<std::pair<yoi::wstr, std::shared_ptr<IRValueType>>> &argumentTypes,
491 const std::shared_ptr<IRValueType> &returnType,
492 const yoi::vec<std::shared_ptr<IRCodeBlock>> &codeBlock,
493 const std::set<FunctionAttrs> &attrs,
494 const IRDebugInfo &debugInfo);
495
497
498 yoi::wstr to_string(yoi::indexT indent = 0);
499
500 bool hasAttribute(const FunctionAttrs &attr);
501
502 struct Builder {
505 std::shared_ptr<IRValueType> returnType;
506 std::set<FunctionAttrs> attrs;
508
509 Builder() = default;
510
511 Builder &setName(const yoi::wstr &name);
512
513 Builder &addArgument(const yoi::wstr &argumentName, const std::shared_ptr<IRValueType> &argumentType);
514
515 Builder &setReturnType(const std::shared_ptr<IRValueType> &returnType);
516
518
520
521 std::shared_ptr<IRFunctionDefinition> yield();
522 };
523 };
524
526 public:
527 struct Argument {
528 std::shared_ptr<IRValueType> templateType;
529
531
532 Argument(const std::shared_ptr<IRValueType> &templateType, const yoi::vec<externModuleAccessExpression *> &satisfyConditions);
533
534 Argument(const std::shared_ptr<IRValueType> &templateType);
535 };
536
538
539 IRTemplateBuilder() = default;
540
542 const std::shared_ptr<IRValueType> &templateType,
543 const yoi::vec<externModuleAccessExpression *> &satisfyConditions = {});
544 };
545
547 public:
548 std::shared_ptr<IRFunctionDefinition> templateDefinition;
550
551 IRFunctionTemplate(const std::shared_ptr<IRFunctionDefinition> &templateDefinition,
553
554 class Builder : public IRTemplateBuilder {
555 public:
556 std::shared_ptr<IRFunctionDefinition> templateDefinition;
557
558 Builder() = default;
559
560 Builder &setTemplateDefinition(const std::shared_ptr<IRFunctionDefinition> &templateDefinition);
561
562 std::shared_ptr<IRFunctionTemplate> yield();
563 };
564 };
565
567 public:
570
571 std::map<yoi::wstr, yoi::indexT> fields;
572
574
576 const yoi::vec<std::shared_ptr<IRValueType>> &fieldTypes,
577 const std::map<yoi::wstr, yoi::indexT> &fields,
579
580 yoi::wstr to_string(yoi::indexT indent = 0);
581
582 struct Builder {
585 std::map<yoi::wstr, yoi::indexT> fields;
587
588 Builder() = default;
589
590 Builder &setName(const yoi::wstr &name);
591
592 Builder &addField(const yoi::wstr &fieldName, const std::shared_ptr<IRValueType> &fieldType);
593
595
596 std::shared_ptr<IRDataStructDefinition> yield();
597 };
598 };
599
601 public:
604
605 struct nameInfo {
606 enum class nameType { field, method } type;
608 };
609 std::map<yoi::wstr, nameInfo> nameIndexMap;
610
613 std::map<yoi::wstr, yoi::structDefInnerPair *> templateMethodDecls;
614 std::map<yoi::wstr, yoi::implInnerPair *> templateMethodDefs;
615
617
619 const std::map<yoi::wstr, nameInfo> &nameIndexMap,
620 const vec<std::shared_ptr<IRValueType>> &fieldTypes,
623 const std::map<yoi::wstr, yoi::structDefInnerPair *> &templateMethodDecls = {},
624 const std::map<yoi::wstr, yoi::implInnerPair *> &templateMethodDefs = {});
625
633 const nameInfo &lookupName(const yoi::wstr &name);
634
635 yoi::wstr to_string(yoi::indexT indent = 0);
636
637 struct Builder {
639 std::map<yoi::wstr, nameInfo> nameIndexMap;
641
642 Builder() = default;
643
646 std::map<yoi::wstr, yoi::structDefInnerPair *> templateMethodDecls;
647 std::map<yoi::wstr, yoi::implInnerPair *> templateMethodDefs;
648
649 Builder &setName(const yoi::wstr &name);
650
651 Builder &addField(const yoi::wstr &fieldName, const std::shared_ptr<IRValueType> &fieldType);
652
653 Builder &addMethod(const yoi::wstr &methodName, yoi::indexT index);
654
655 Builder &setStoredTemplateArgs(const yoi::vec<yoi::wstr> &paramNames, const yoi::vec<std::shared_ptr<IRValueType>> &args);
656
658
660
661 std::shared_ptr<IRStructDefinition> yield();
662 };
663 };
664
666 public:
667 std::shared_ptr<IRStructDefinition> templateDefinition;
670
671 IRStructTemplate(const std::shared_ptr<IRStructDefinition> &templateDefinition,
672 const yoi::indexTable<yoi::wstr, std::shared_ptr<IRFunctionTemplate>> &templateMethods,
674
675 class Builder : public IRTemplateBuilder {
676 public:
677 std::shared_ptr<IRStructDefinition> templateDefinition;
679
680 Builder() = default;
681
682 Builder &setTemplateDefinition(const std::shared_ptr<IRStructDefinition> &templateDefinition);
683
684 Builder &setTemplateMethod(const yoi::wstr &methodName, const std::shared_ptr<IRFunctionTemplate> &methodTemplate);
685
686 std::shared_ptr<IRStructTemplate> yield();
687 };
688 };
689
691 public:
693 std::tuple<IRValueType::valueType, yoi::indexT, yoi::indexT> implStructIndex;
694 std::pair<yoi::indexT, yoi::indexT> implInterfaceIndex;
696 std::map<yoi::wstr, yoi::indexT> virtualMethodIndexMap;
697
699
701 std::tuple<IRValueType::valueType, yoi::indexT, yoi::indexT> implStructIndex,
702 const std::pair<yoi::indexT, yoi::indexT> &implInterfaceIndex,
703 const yoi::vec<std::shared_ptr<IRValueType>> &virtualMethods,
704 const std::map<yoi::wstr, yoi::indexT> &virtualMethodIndexMap);
705
706 yoi::wstr to_string(yoi::indexT indent = 0);
707
708 struct Builder {
710 std::tuple<IRValueType::valueType, yoi::indexT, yoi::indexT> implStructIndex;
711 std::pair<yoi::indexT, yoi::indexT> implInterfaceIndex;
712
714 std::map<yoi::wstr, yoi::indexT> virtualMethodIndexMap;
715
716 Builder() = default;
717
718 Builder &setName(const yoi::wstr &name);
719
720 Builder &setImplStructIndex(std::tuple<IRValueType::valueType, yoi::indexT, yoi::indexT> implStructIndex);
721
722 Builder &setImplInterfaceIndex(const std::pair<yoi::indexT, yoi::indexT> &implInterfaceIndex);
723
724 Builder &addVirtualMethod(const yoi::wstr &methodName, const std::shared_ptr<IRValueType> &methodType);
725
726 std::shared_ptr<IRInterfaceImplementationDefinition> yield();
727 };
728 };
729
731 public:
733 std::map<yoi::wstr, yoi::vec<yoi::indexT>> functionOverloadIndexies;
736
738
741 const yoi::indexTable<yoi::wstr, std::shared_ptr<IRFunctionDefinition>> &methodMap);
742
743 yoi::wstr to_string(yoi::indexT indent = 0);
744
745 struct Builder {
747 std::map<yoi::wstr, yoi::vec<yoi::indexT>> functionOverloadIndexies;
749
750 Builder() = default;
751
752 Builder &setName(const yoi::wstr &name);
753
754 Builder &
755 addMethod(const yoi::wstr &methodNameOri, const yoi::wstr &methodName, const std::shared_ptr<IRFunctionDefinition> &methodSignature);
756
757 std::shared_ptr<IRInterfaceInstanceDefinition> yield();
758 };
759 };
760
762 public:
763 std::shared_ptr<IRInterfaceInstanceDefinition> templateDefinition;
765
766 class Builder : public IRTemplateBuilder {
767 public:
768 std::shared_ptr<IRInterfaceInstanceDefinition> templateDefinition;
769
770 Builder() = default;
771
772 Builder &setTemplateDefinition(const std::shared_ptr<IRInterfaceInstanceDefinition> &templateDefinition);
773
774 std::shared_ptr<IRInterfaceInstanceTemplate> yield();
775 };
776
777 IRInterfaceInstanceTemplate(const std::shared_ptr<IRInterfaceInstanceDefinition> &templateDefinition,
779 };
780
782 public:
783 std::shared_ptr<IRInterfaceImplementationDefinition> templateDefinition;
785
786 class Builder : public IRTemplateBuilder {
787 public:
788 std::shared_ptr<IRInterfaceImplementationDefinition> templateDefinition;
790
791 Builder() = default;
792
793 Builder &setTemplateDefinition(const std::shared_ptr<IRInterfaceImplementationDefinition> &templateDefinition);
794
795 std::shared_ptr<IRInterfaceImplementationTemplate> yield();
796 };
797
798 IRInterfaceImplementationTemplate(const std::shared_ptr<IRInterfaceImplementationDefinition> &templateDefinition,
800 };
801
810
833
841
842 class IRModule : std::enable_shared_from_this<IRModule> {
843 public:
847 std::map<yoi::wstr, yoi::indexT> moduleImports;
848 std::set<yoi::indexT> dependentModules;
857
858 std::map<yoi::wstr, yoi::funcDefStmt *> funcTemplateAsts;
859 std::map<yoi::wstr, yoi::structDefStmt *> structTemplateAsts;
860 std::map<yoi::wstr, yoi::interfaceDefStmt *> templateInterfaceAsts;
861 std::map<yoi::wstr, yoi::implStmt *> templateImplAsts; // Maps struct template name to its impl block
862 std::map<yoi::wstr, yoi::vec<yoi::implStmt *>> templateInterfaceImplAsts;
863 std::map<yoi::wstr, yoi::typeAliasStmt *> typeAliasTemplateAsts;
864 std::map<yoi::wstr, IRValueType> typeAliases;
865 std::map<yoi::wstr, yoi::vec<yoi::indexT>> functionOverloadIndexies;
866 std::map<yoi::wstr, std::shared_ptr<IRConcept>> concepts;
867
869
870 yoi::wstr to_string(yoi::indexT indent = 0);
871 };
872
873 class IRBuilder {
878 std::shared_ptr<compilerContext> compilerCtx;
879 std::shared_ptr<IRModule> currentModule;
880 std::shared_ptr<IRFunctionDefinition> currentFunction;
881 std::vector<std::shared_ptr<IRCodeBlock>> codeBlocks;
882 std::vector<std::shared_ptr<yoi::IRValueType>> tempVarStack;
889
890 public:
891 IRBuilder() = delete;
892
893 IRBuilder(std::shared_ptr<compilerContext> compilerCtx,
894 std::shared_ptr<IRModule> currentModule,
895 std::shared_ptr<IRFunctionDefinition> currentFunction);
896
897 void setDebugInfo(const IRDebugInfo &debugInfo);
898
900
901 void pushLoopContext(yoi::indexT breakTarget, yoi::indexT continueTarget);
902
903 void popLoopContext();
904
906
907 void discardState();
908
909 void restoreState();
910
911 void restoreStateTemporarily(); // rollback to the state with current state saved
912
913 void commitState(); // commit the overriden state and pour the saved state back
914
915 void discardStateUntil(yoi::indexT stateIndex);
916
917 void pushTempVar(const std::shared_ptr<IRValueType> &type);
918
920
921 std::shared_ptr<IRFunctionDefinition> irFuncDefinition();
922
924
926
933
935
936 void yield();
937
938 void insert(const IR &ir, yoi::indexT insertionPoint = 0xffffffff);
939
940 yoi::IROperand createLocalVar(const yoi::wstr &varName, const std::shared_ptr<IRValueType> &type);
941
943
944 std::shared_ptr<IRValueType> &getLhsFromTempVarStack();
945
946 std::shared_ptr<IRValueType> &getRhsFromTempVarStack();
947
948 void basicCast(const std::shared_ptr<IRValueType> &valType, yoi::indexT insertionPoint, bool lhs = false);
949
950 void popOp();
951
953
954 void arithmeticOp(IR::Opcode op);
955
956 bool hasTerminated();
957
958 void jumpOp(yoi::indexT target);
959
960 void jumpIfOp(IR::Opcode op, yoi::indexT target);
961
962 void pushOp(IR::Opcode op, const yoi::IROperand &constV);
963
964 void loadOp(IR::Opcode op, const yoi::IROperand &source, const std::shared_ptr<IRValueType> &expectedType, yoi::indexT moduleIndex = -1);
965
966 void loadFieldOp(yoi::vec<yoi::IROperand> &accessors, const std::shared_ptr<IRValueType> &expectedType);
967
968 void loadMemberOp(const yoi::IROperand &memberIndex, const std::shared_ptr<IRValueType> &memberType);
969
970 void storeOp(IR::Opcode op, const yoi::IROperand &operand, yoi::indexT moduleIndex = -1);
971
972 void storeMemberOp(const yoi::IROperand &memberIndex);
973
974 void storeFieldOp(yoi::vec<yoi::IROperand> &accessors);
975
983 void invokeOp(yoi::indexT funcIndex,
984 yoi::indexT funcArgsCount,
985 const std::shared_ptr<IRValueType> &returnType,
986 bool externalInvocation = false,
987 yoi::indexT moduleIndex = -1);
988
998 void invokeDanglingOp(yoi::indexT funcIndex,
999 yoi::indexT funcArgsCount,
1000 const std::shared_ptr<IRValueType> &returnType,
1001 bool externalInvocation = false,
1002 yoi::indexT moduleIndex = -1);
1003
1004 void invokeMethodOp(yoi::indexT funcIndex,
1005 yoi::indexT methodArgsCount,
1006 const std::shared_ptr<IRValueType> &returnType,
1007 bool isStatic,
1008 bool externalInvocation = false,
1009 yoi::indexT moduleIndex = -1);
1010
1011 void invokeVirtualOp(yoi::indexT funcIndex,
1012 yoi::indexT interfaceIndex,
1013 yoi::indexT methodArgsCount,
1014 const std::shared_ptr<IRValueType> &returnType,
1015 bool externalInvocation = false,
1016 yoi::indexT moduleIndex = -1);
1017
1018 void invokeImportedOp(yoi::indexT libIndex, yoi::indexT funcIndex, yoi::indexT funcArgsCount, const std::shared_ptr<IRValueType> &returnType);
1019
1020 void retOp(bool returnWithNone = false);
1021
1022 void newStructOp(yoi::indexT structIndex, bool isExternal = false, yoi::indexT moduleIndex = -1);
1023
1024 void newDataStructOp(yoi::indexT structIndex, bool isExternal = false, yoi::indexT moduleIndex = -1);
1025
1026 void initializeFieldsOp(yoi::indexT parameterCount);
1027
1028 void newInterfaceOp(yoi::indexT interfaceIndex, bool isExternal = false, yoi::indexT moduleIndex = -1);
1029
1030 void constructInterfaceImplOp(const std::pair<yoi::indexT, yoi::indexT> &interfaceId,
1031 yoi::indexT interfaceImplIndex,
1032 bool isExternal = false,
1033 yoi::indexT moduleIndex = -1);
1034
1035 void newArrayOp(const std::shared_ptr<IRValueType> &elementType, const yoi::vec<yoi::indexT> &dimensions, yoi::indexT onstackElementCount);
1036
1037 void newDynamicArrayOp(const std::shared_ptr<IRValueType> &elementType, yoi::indexT initializerSize = 0);
1038
1039 void arrayLengthOp();
1040
1041 void interfaceOfOp();
1042
1043 void typeIdOp(const std::shared_ptr<IRValueType> &type);
1044
1045 void typeIdOp();
1046
1047 void dynCastOp(const std::shared_ptr<IRValueType> &type);
1048
1049 void pointerCastOp();
1050
1051 void breakOp();
1052
1053 void continueOp();
1054
1055 enum class ExtractType { All, First, Last };
1056
1062 void bindElementsOp(yoi::indexT extractElementCount, ExtractType extractType);
1063
1069 void bindFieldsOp(yoi::indexT extractFieldCount, ExtractType extractType);
1070
1075 void yieldOp(bool yieldNone = false);
1076
1080 void resumeOp();
1081
1083
1084 void popFromTempVarStack();
1085 };
1086
1088 public:
1089 /* one module that has renamed all functions and variables to their final names */
1090 std::shared_ptr<IRModule> compiledModule;
1091
1093 };
1094
1096 public:
1105
1107
1109
1111
1112 yoi::indexT addImportedFunction(const yoi::wstr &libraryName,
1113 const yoi::wstr &functionName,
1114 const std::shared_ptr<IRFunctionDefinition> &functionDefinition);
1115
1116 void addForeignType(const yoi::wstr &foreignTypeName, const std::shared_ptr<IRValueType> &structType);
1117
1127 void addExportedFunction(const yoi::wstr &exportName,
1128 yoi::indexT moduleIndex,
1129 yoi::indexT functionIndex,
1130 const std::set<IRFunctionDefinition::FunctionAttrs> &attrs);
1131 };
1132} // namespace yoi
1133
1134#endif // HOSHI_LANG_IR_H
void pushLoopContext(yoi::indexT breakTarget, yoi::indexT continueTarget)
Definition IR.cpp:1524
std::vector< std::shared_ptr< IRCodeBlock > > codeBlocks
Definition IR.h:881
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:1462
yoi::indexT saveState()
Definition IR.cpp:1164
void continueOp()
Definition IR.cpp:1494
std::shared_ptr< IRModule > currentModule
Definition IR.h:879
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:1207
yoi::vec< std::shared_ptr< yoi::IRValueType > > tempStateTempVarStack
Definition IR.h:886
std::shared_ptr< IRFunctionDefinition > currentFunction
Definition IR.h:880
void popOp()
Definition IR.cpp:1189
void yieldOp(bool yieldNone=false)
Definition IR.cpp:1698
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:884
void interfaceOfOp()
Definition IR.cpp:1345
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:1216
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:1489
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:1680
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:1185
void newArrayOp(const std::shared_ptr< IRValueType > &elementType, const yoi::vec< yoi::indexT > &dimensions, yoi::indexT onstackElementCount)
Definition IR.cpp:1106
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:1687
void invokeImportedOp(yoi::indexT libIndex, yoi::indexT funcIndex, yoi::indexT funcArgsCount, const std::shared_ptr< IRValueType > &returnType)
Definition IR.cpp:1070
void newStructOp(yoi::indexT structIndex, bool isExternal=false, yoi::indexT moduleIndex=-1)
Definition IR.cpp:453
yoi::indexT currentCodeBlockIndex
Definition IR.h:883
yoi::indexT switchCodeBlock(yoi::indexT index)
Definition IR.cpp:492
void discardState()
Definition IR.cpp:1169
void discardStateUntil(yoi::indexT stateIndex)
Definition IR.cpp:1456
void newInterfaceOp(yoi::indexT interfaceIndex, bool isExternal=false, yoi::indexT moduleIndex=-1)
void bindElementsOp(yoi::indexT extractElementCount, ExtractType extractType)
Definition IR.cpp:1499
void insert(const IR &ir, yoi::indexT insertionPoint=0xffffffff)
Definition IR.cpp:147
yoi::vec< IR > tempStateCodeBlock
Definition IR.h:885
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:1276
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:1339
void popLoopContext()
Definition IR.cpp:1485
void commitState()
Definition IR.cpp:1444
IRCodeBlock & getCurrentCodeBlock()
Definition IR.cpp:138
void initializeFieldsOp(yoi::indexT parameterCount)
Definition IR.cpp:1673
void resumeOp()
Definition IR.cpp:1693
IRBuilder()=delete
void jumpOp(yoi::indexT target)
Definition IR.cpp:286
IRDebugInfo currentDebugInfo
Definition IR.h:887
void bindFieldsOp(yoi::indexT extractFieldCount, ExtractType extractType)
Definition IR.cpp:1511
void restoreState()
Definition IR.cpp:1174
void jumpIfOp(IR::Opcode op, yoi::indexT target)
Definition IR.cpp:292
yoi::indexT getCurrentInsertionPoint()
Definition IR.cpp:484
void restoreStateTemporarily()
Definition IR.cpp:1433
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:1530
void newDynamicArrayOp(const std::shared_ptr< IRValueType > &elementType, yoi::indexT initializerSize=0)
Definition IR.cpp:1282
std::shared_ptr< compilerContext > compilerCtx
Definition IR.h:878
std::vector< std::shared_ptr< yoi::IRValueType > > tempVarStack
Definition IR.h:882
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:1247
std::shared_ptr< IRValueType > & getRhsFromTempVarStack()
Definition IR.cpp:164
yoi::vec< LoopContext > loopContext
Definition IR.h:888
void retOp(bool returnWithNone=false)
Definition IR.cpp:438
void setDebugInfo(const IRDebugInfo &debugInfo)
Definition IR.cpp:1202
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:410
conceptDefinition * def
Definition IR.h:839
yoi::indexT affiliateModule
Definition IR.h:837
yoi::wstr name
Definition IR.h:836
yoi::vec< std::shared_ptr< IRValueType > > fieldTypes
Definition IR.h:569
std::map< yoi::wstr, yoi::indexT > fields
Definition IR.h:571
yoi::wstr to_string(yoi::indexT indent=0)
Definition IR.cpp:1663
yoi::indexT linkedModuleId
Definition IR.h:573
Builder & addValue(const yoi::wstr &valueName, yoi::indexT valueIndex)
Definition IR.cpp:1573
std::shared_ptr< IREnumerationType > yield()
Definition IR.cpp:1607
yoi::indexTable< yoi::wstr, yoi::indexT > valueToIndexMap
Definition IR.h:396
Builder & setName(const yoi::wstr &name)
Definition IR.cpp:1568
UnderlyingType getUnderlyingType()
Definition IR.cpp:1554
yoi::indexTable< yoi::wstr, yoi::indexT > valueToIndexMap
Definition IR.h:388
yoi::wstr name
Definition IR.h:387
yoi::indexT itemIndex
Definition IR.h:825
externType getExternType() const
Definition IR.cpp:886
yoi::indexT affiliateModule
Definition IR.h:824
enum yoi::IRExternEntry::externType type
yoi::wstr name
Definition IR.h:823
IRExternEntry()=default
yoi::indexTable< yoi::wstr, std::shared_ptr< IRFunctionDefinition > > importedFunctionTable
Definition IR.h:1101
void addForeignType(const yoi::wstr &foreignTypeName, const std::shared_ptr< IRValueType > &structType)
Definition IR.cpp:1056
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:1049
yoi::indexT addImportedFunction(const yoi::wstr &libraryName, const yoi::wstr &functionName, const std::shared_ptr< IRFunctionDefinition > &functionDefinition)
Definition IR.cpp:1039
yoi::indexTable< yoi::wstr, std::tuple< yoi::indexT, yoi::indexT, std::set< IRFunctionDefinition::FunctionAttrs > > > exportedFunctionTable
Definition IR.h:1106
yoi::indexTable< yoi::wstr, std::shared_ptr< IRValueType > > foreignTypeTable
Definition IR.h:1108
yoi::indexTable< yoi::wstr, ImportLibrary > importedLibraries
Definition IR.h:1110
yoi::vec< std::shared_ptr< IRValueType > > argumentTypes
Definition IR.h:480
std::shared_ptr< IRValueType > returnType
Definition IR.h:481
IRDebugInfo debugInfo
Definition IR.h:485
IRVariableTable variableTable
Definition IR.h:483
yoi::wstr to_string(yoi::indexT indent=0)
Definition IR.cpp:522
yoi::vec< std::shared_ptr< IRCodeBlock > > codeBlock
Definition IR.h:482
yoi::indexT linkedModuleId
Definition IR.h:487
bool hasAttribute(const FunctionAttrs &attr)
Definition IR.cpp:1425
std::set< FunctionAttrs > attrs
Definition IR.h:484
IRVariableTable & getVariableTable()
Definition IR.cpp:619
std::shared_ptr< IRFunctionDefinition > templateDefinition
Definition IR.h:556
std::shared_ptr< IRFunctionTemplate > yield()
Definition IR.cpp:968
Builder & setTemplateDefinition(const std::shared_ptr< IRFunctionDefinition > &templateDefinition)
Definition IR.cpp:963
std::shared_ptr< IRFunctionDefinition > templateDefinition
Definition IR.h:548
yoi::indexTable< yoi::wstr, IRTemplateBuilder::Argument > templateArguments
Definition IR.h:549
yoi::wstr to_string(yoi::indexT indent=0)
Definition IR.cpp:944
std::pair< yoi::indexT, yoi::indexT > implInterfaceIndex
Definition IR.h:694
std::map< yoi::wstr, yoi::indexT > virtualMethodIndexMap
Definition IR.h:696
std::tuple< IRValueType::valueType, yoi::indexT, yoi::indexT > implStructIndex
Definition IR.h:693
yoi::vec< std::shared_ptr< IRValueType > > virtualMethods
Definition IR.h:695
std::shared_ptr< IRInterfaceImplementationDefinition > templateDefinition
Definition IR.h:788
yoi::indexTable< yoi::wstr, IRTemplateBuilder::Argument > templateArguments
Definition IR.h:789
std::shared_ptr< IRInterfaceImplementationTemplate > yield()
Definition IR.cpp:1006
Builder & setTemplateDefinition(const std::shared_ptr< IRInterfaceImplementationDefinition > &templateDefinition)
Definition IR.cpp:1000
std::shared_ptr< IRInterfaceImplementationDefinition > templateDefinition
Definition IR.h:783
yoi::indexTable< yoi::wstr, IRTemplateBuilder::Argument > templateArguments
Definition IR.h:784
std::map< yoi::wstr, yoi::vec< yoi::indexT > > functionOverloadIndexies
Definition IR.h:733
yoi::vec< std::tuple< IRValueType::valueType, yoi::indexT, yoi::indexT > > implementations
Definition IR.h:735
yoi::wstr to_string(yoi::indexT indent=0)
Definition IR.cpp:934
yoi::indexTable< yoi::wstr, std::shared_ptr< IRFunctionDefinition > > methodMap
Definition IR.h:734
std::shared_ptr< IRInterfaceInstanceTemplate > yield()
Definition IR.cpp:991
Builder & setTemplateDefinition(const std::shared_ptr< IRInterfaceInstanceDefinition > &templateDefinition)
Definition IR.cpp:986
std::shared_ptr< IRInterfaceInstanceDefinition > templateDefinition
Definition IR.h:768
yoi::indexTable< yoi::wstr, IRTemplateBuilder::Argument > templateArguments
Definition IR.h:764
std::shared_ptr< IRInterfaceInstanceDefinition > templateDefinition
Definition IR.h:763
yoi::wstr modulePath
Definition IR.h:846
std::map< yoi::wstr, yoi::implStmt * > templateImplAsts
Definition IR.h:861
std::map< yoi::wstr, yoi::vec< yoi::indexT > > functionOverloadIndexies
Definition IR.h:865
std::set< yoi::indexT > dependentModules
Definition IR.h:848
std::map< yoi::wstr, yoi::structDefStmt * > structTemplateAsts
Definition IR.h:859
yoi::indexTable< yoi::wstr, std::shared_ptr< IRInterfaceInstanceDefinition > > interfaceTable
Definition IR.h:854
std::map< yoi::wstr, std::shared_ptr< IRConcept > > concepts
Definition IR.h:866
std::map< yoi::wstr, yoi::vec< yoi::implStmt * > > templateInterfaceImplAsts
Definition IR.h:862
yoi::indexTable< yoi::wstr, std::shared_ptr< IRValueType > > globalVariables
Definition IR.h:851
yoi::wstr to_string(yoi::indexT indent=0)
Definition IR.cpp:99
std::map< yoi::wstr, yoi::interfaceDefStmt * > templateInterfaceAsts
Definition IR.h:860
yoi::indexTable< yoi::wstr, std::shared_ptr< IRStructDefinition > > structTable
Definition IR.h:850
IRStringLiteralPool stringLiteralPool
Definition IR.h:868
std::map< yoi::wstr, yoi::funcDefStmt * > funcTemplateAsts
Definition IR.h:858
yoi::indexT identifier
Definition IR.h:844
yoi::indexTable< yoi::wstr, std::shared_ptr< IRFunctionDefinition > > functionTable
Definition IR.h:849
yoi::indexTable< yoi::wstr, std::shared_ptr< IRInterfaceImplementationDefinition > > interfaceImplementationTable
Definition IR.h:855
std::map< yoi::wstr, IRValueType > typeAliases
Definition IR.h:864
std::map< yoi::wstr, yoi::typeAliasStmt * > typeAliasTemplateAsts
Definition IR.h:863
std::map< yoi::wstr, yoi::indexT > moduleImports
Definition IR.h:847
yoi::indexTable< yoi::wstr, std::shared_ptr< IRDataStructDefinition > > dataStructTable
Definition IR.h:856
yoi::indexTable< yoi::wstr, std::shared_ptr< IREnumerationType > > enumerationTable
Definition IR.h:853
bool compiled
Definition IR.h:845
yoi::indexTable< yoi::wstr, std::shared_ptr< IRExternEntry > > externTable
Definition IR.h:852
yoi::indexT entryModule
Definition IR.h:1092
std::shared_ptr< IRModule > compiledModule
Definition IR.h:1090
enum yoi::IROperand::operandType type
std::shared_ptr< IRValueType > lvalueType
Definition IR.h:251
static enum_range< operandType > IROperandTypeEnumRange
Definition IR.h:223
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:804
yoi::vec< std::shared_ptr< IRValueType > > fieldTypes
Definition IR.h:603
yoi::vec< std::shared_ptr< IRValueType > > storedTemplateArgs
Definition IR.h:612
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:602
std::map< yoi::wstr, yoi::structDefInnerPair * > templateMethodDecls
Definition IR.h:613
std::map< yoi::wstr, nameInfo > nameIndexMap
Definition IR.h:609
std::map< yoi::wstr, yoi::implInnerPair * > templateMethodDefs
Definition IR.h:614
yoi::indexT linkedModuleId
Definition IR.h:616
yoi::vec< yoi::wstr > templateParamNames
Definition IR.h:611
Builder & setTemplateDefinition(const std::shared_ptr< IRStructDefinition > &templateDefinition)
Definition IR.cpp:972
std::shared_ptr< IRStructDefinition > templateDefinition
Definition IR.h:677
Builder & setTemplateMethod(const yoi::wstr &methodName, const std::shared_ptr< IRFunctionTemplate > &methodTemplate)
Definition IR.cpp:1017
std::shared_ptr< IRStructTemplate > yield()
Definition IR.cpp:977
yoi::indexTable< yoi::wstr, std::shared_ptr< IRFunctionTemplate > > templateMethods
Definition IR.h:678
std::shared_ptr< IRStructDefinition > templateDefinition
Definition IR.h:667
yoi::indexTable< yoi::wstr, IRTemplateBuilder::Argument > templateArguments
Definition IR.h:669
yoi::indexTable< yoi::wstr, std::shared_ptr< IRFunctionTemplate > > templateMethods
Definition IR.h:668
yoi::indexTable< yoi::wstr, Argument > templateArguments
Definition IR.h:537
IRTemplateBuilder & addTemplateArgument(const yoi::wstr &templateName, const std::shared_ptr< IRValueType > &templateType, const yoi::vec< externModuleAccessExpression * > &satisfyConditions={})
Definition IR.cpp:1010
std::shared_ptr< IRValueType > type
Definition IR.h:381
yoi::wstr name
Definition IR.h:380
bool isArrayType() const
Definition IR.cpp:1088
yoi::vec< IRValueType > bracedTypes
Definition IR.h:143
IRMetadata metadata
Definition IR.h:147
IRValueType getNormalizedForeignBasicType()
Definition IR.cpp:643
IRValueType getArrayType(const yoi::vec< yoi::indexT > &dimensions)
Definition IR.cpp:1160
IRValueType getBasicRawType() const
Definition IR.cpp:1374
bool isForeignBasicType() const
Definition IR.cpp:635
yoi::indexT calculateDimensionSize() const
Definition IR.cpp:1625
IRValueType & removeAttribute(ValueAttr attr)
Definition IR.cpp:1356
bool is1ByteType() const
Definition IR.cpp:639
IRValueType getElementType()
Definition IR.cpp:1101
enum yoi::IRValueType::valueType type
bool isDynamicArrayType() const
Definition IR.cpp:1335
IRValueType getBasicObjectType() const
Definition IR.cpp:1404
IRValueType getDynamicArrayType()
Definition IR.cpp:1331
bool hasAttribute(ValueAttr attr) const
Definition IR.cpp:1352
yoi::wstr to_string(bool showAttributes=false) const
Definition IR.cpp:661
std::set< ValueAttr > attributes
Definition IR.h:145
yoi::vec< yoi::indexT > dimensions
Definition IR.h:141
IRValueType & addAttribute(ValueAttr attr)
Definition IR.cpp:1361
bool operator==(const yoi::IRValueType &rhs) const
Definition IR.cpp:753
yoi::indexT typeIndex
Definition IR.h:139
bool isBasicRawType() const
Definition IR.cpp:1369
bool isBasicType() const
Definition IR.cpp:628
yoi::indexT typeAffiliateModule
Definition IR.h:138
yoi::vec< std::map< yoi::wstr, yoi::indexT > > variableNameIndexMap
Definition IR.h:424
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:1705
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:1028
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:423
std::map< yoi::indexT, yoi::wstr > reversedVariableNameMap
Definition IR.h:426
std::map< yoi::indexT, yoi::indexT > variableScopeMap
Definition IR.h:425
yoi::vec< std::shared_ptr< IRValueType > > & getVariables()
Definition IR.cpp:1024
yoi::indexT scopeIndex(yoi::indexT varIndex)
Definition IR.cpp:1481
Definition IR.h:264
Opcode
Definition IR.h:266
static enum_range< Opcode > IROpCodeEnumRange
Definition IR.h:365
IRDebugInfo debugInfo
Definition IR.h:369
IR()=default
yoi::vec< IROperand > operands
Definition IR.h:367
enum yoi::IR::Opcode opcode
yoi::wstr to_string() const
Definition IR.cpp:74
wstr::value_type wchar
Definition def.hpp:49
std::vector< t > vec
Definition def.hpp:53
std::wstring wstr
Definition def.hpp:48
uint64_t indexT
Definition def.hpp:51
Builder & addSearchPath(const yoi::wstr &searchPath)
Definition IR.cpp:1065
bool preserveIntermediateFiles
Definition IR.h:39
yoi::vec< yoi::wstr > additionalLinkingFiles
Definition IR.h:41
Builder & setImmediatelyClearupCache(bool immediatelyClearupCache)
Definition IR.cpp:1620
BuildType buildType
Definition IR.h:34
Builder & setBuildType(BuildType buildType)
Definition IR.cpp:890
Builder & setBuildCachePath(const yoi::wstr &buildCachePath)
Definition IR.cpp:1613
std::shared_ptr< IRBuildConfig > yield()
Definition IR.cpp:905
Builder & setAdditionalLinkingFiles(const yoi::vec< yoi::wstr > &additionalLinkingFiles)
Definition IR.cpp:1546
yoi::wstr buildArch
Definition IR.h:38
BuildMode buildMode
Definition IR.h:35
Builder & setPreserveIntermediateFiles(bool preserveIntermediateFiles)
Definition IR.cpp:929
Builder & setBuildMode(BuildMode buildMode)
Definition IR.cpp:919
Builder & setBuildPlatform(const yoi::wstr &buildPlatform)
Definition IR.cpp:895
Builder & setBuildArch(const yoi::wstr &buildArch)
Definition IR.cpp:900
UseObjectLinker useObjectLinker
Definition IR.h:36
std::map< yoi::wstr, yoi::wstr > marcos
Definition IR.h:42
yoi::wstr buildCachePath
Definition IR.h:43
yoi::wstr buildPlatform
Definition IR.h:37
yoi::vec< yoi::wstr > searchPaths
Definition IR.h:40
Builder & setSearchPaths(const yoi::vec< yoi::wstr > &searchPaths)
Definition IR.cpp:1060
Builder & setMarco(const yoi::wstr &name, const yoi::wstr &value)
Definition IR.cpp:1476
Builder & setUseObjectLinker(UseObjectLinker useObjectLinker)
Definition IR.cpp:924
enum yoi::IRBuildConfig::BuildMode buildMode
bool preserveIntermediateFiles
Definition IR.h:26
yoi::vec< yoi::wstr > additionalLinkingFiles
Definition IR.h:28
yoi::wstr buildArch
Definition IR.h:25
std::map< yoi::wstr, yoi::wstr > marcos
Definition IR.h:29
enum yoi::IRBuildConfig::BuildType buildType
yoi::wstr buildCachePath
Definition IR.h:30
yoi::wstr buildPlatform
Definition IR.h:24
enum yoi::IRBuildConfig::UseObjectLinker useObjectLinker
yoi::vec< yoi::wstr > searchPaths
Definition IR.h:27
bool immediatelyClearupCache
Definition IR.h:31
yoi::indexT continueTarget
Definition IR.h:876
yoi::indexT breakTarget
Definition IR.h:875
yoi::vec< std::shared_ptr< IRValueType > > fieldTypes
Definition IR.h:584
std::map< yoi::wstr, yoi::indexT > fields
Definition IR.h:585
Builder & addField(const yoi::wstr &fieldName, const std::shared_ptr< IRValueType > &fieldType)
Definition IR.cpp:1647
std::shared_ptr< IRDataStructDefinition > yield()
Definition IR.cpp:1659
Builder & setLinkedModuleId(yoi::indexT linkedModuleId)
Definition IR.cpp:1654
Builder & setName(const yoi::wstr &name)
Definition IR.cpp:1642
yoi::indexT column
Definition IR.h:81
yoi::indexT line
Definition IR.h:80
yoi::wstr sourceFile
Definition IR.h:79
std::shared_ptr< IRValueType > returnType
Definition IR.h:505
Builder & setDebugInfo(const IRDebugInfo &debugInfo)
Definition IR.cpp:1211
yoi::vec< std::pair< yoi::wstr, std::shared_ptr< IRValueType > > > argumentTypes
Definition IR.h:504
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:1271
std::set< FunctionAttrs > attrs
Definition IR.h:506
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:711
std::map< yoi::wstr, yoi::indexT > virtualMethodIndexMap
Definition IR.h:714
Builder & setName(const yoi::wstr &name)
Definition IR.cpp:546
std::tuple< IRValueType::valueType, yoi::indexT, yoi::indexT > implStructIndex
Definition IR.h:710
yoi::vec< std::shared_ptr< IRValueType > > virtualMethods
Definition IR.h:713
std::map< yoi::wstr, yoi::vec< yoi::indexT > > functionOverloadIndexies
Definition IR.h:747
std::shared_ptr< IRInterfaceInstanceDefinition > yield()
Definition IR.cpp:586
yoi::indexTable< yoi::wstr, std::shared_ptr< IRFunctionDefinition > > methodMap
Definition IR.h:748
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:87
void setMetadata(const yoi::wstr &key, const T &value)
Definition IR.h:95
yoi::wstr to_string() const
Definition IR.cpp:1588
std::map< yoi::wstr, std::any > metadata
Definition IR.h:85
void eraseMetadata(const yoi::wstr &key)
Definition IR.cpp:1578
const T & getMetadata(const yoi::wstr &key) const
Definition IR.h:91
bool hasMetadata(const yoi::wstr &key) const
Definition IR.cpp:1584
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:640
Builder & addMethod(const yoi::wstr &methodName, yoi::indexT index)
Definition IR.cpp:799
yoi::vec< std::shared_ptr< IRValueType > > storedTemplateArgs
Definition IR.h:645
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:646
std::map< yoi::wstr, nameInfo > nameIndexMap
Definition IR.h:639
std::map< yoi::wstr, yoi::implInnerPair * > templateMethodDefs
Definition IR.h:647
Builder & setName(const yoi::wstr &name)
Definition IR.cpp:788
yoi::vec< yoi::wstr > templateParamNames
Definition IR.h:644
enum yoi::IRStructDefinition::nameInfo::nameType type
std::shared_ptr< IRValueType > templateType
Definition IR.h:528
yoi::vec< externModuleAccessExpression * > satisfyCondition
Definition IR.h:530
yoi::indexT symbolIndex
Definition IR.h:231
yoi::indexT stringLiteralIndex
Definition IR.h:230
yoi::indexT codeBlockIndex
Definition IR.h:232