1 #ifndef COMMON_INSTRUCTIONS_H 2 #define COMMON_INSTRUCTIONS_H 7 #include "llvm/IR/Function.h" 8 #include "llvm/IR/Instruction.h" 9 #include "llvm/IR/Instructions.h" 10 #include "llvm/IR/Module.h" 11 #include "llvm/Support/raw_ostream.h" 13 #include "memoir/support/InternalDatatypes.hpp" 15 #include "memoir/utility/FunctionNames.hpp" 17 #include "memoir/ir/Types.hpp" 28 struct CollectionType;
35 static void invalidate();
37 llvm::Function &getFunction()
const;
38 llvm::CallInst &getCallInst()
const;
39 llvm::Function &getLLVMFunction()
const;
40 llvm::Module *getModule()
const;
41 llvm::BasicBlock *getParent()
const;
42 MemOIR_Func getKind()
const;
44 explicit operator llvm::Value *() {
45 return &this->getCallInst();
47 explicit operator llvm::Value &() {
48 return this->getCallInst();
50 explicit operator llvm::Instruction *() {
51 return &this->getCallInst();
53 explicit operator llvm::Instruction &() {
54 return this->getCallInst();
57 friend std::ostream &operator<<(std::ostream &os,
const MemOIRInst &I);
58 friend llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
60 virtual std::string toString(std::string indent =
"")
const = 0;
65 llvm::CallInst &call_inst;
67 static map<llvm::Instruction *, MemOIRInst *> *llvm_to_memoir;
69 MemOIRInst(llvm::CallInst &call_inst) : call_inst(call_inst) {};
75 virtual Type &getType()
const = 0;
79 #define HANDLE_TYPE_INST(ENUM, FUNC, CLASS) \ 80 (I->getKind() == MemOIR_Func::ENUM) || 81 #include "memoir/ir/Instructions.def" 93 Type &getType()
const override;
96 return (I->getKind() == MemOIR_Func::UINT64_TYPE);
99 std::string toString(std::string indent =
"")
const override;
109 Type &getType()
const override;
112 return (I->getKind() == MemOIR_Func::UINT32_TYPE);
115 std::string toString(std::string indent =
"")
const override;
125 Type &getType()
const override;
128 return (I->getKind() == MemOIR_Func::UINT16_TYPE);
131 std::string toString(std::string indent =
"")
const override;
141 Type &getType()
const override;
144 return (I->getKind() == MemOIR_Func::UINT8_TYPE);
147 std::string toString(std::string indent =
"")
const override;
157 Type &getType()
const override;
160 return (I->getKind() == MemOIR_Func::UINT2_TYPE);
163 std::string toString(std::string indent =
"")
const override;
173 Type &getType()
const override;
176 return (I->getKind() == MemOIR_Func::INT64_TYPE);
179 std::string toString(std::string indent =
"")
const override;
189 Type &getType()
const override;
192 return (I->getKind() == MemOIR_Func::INT32_TYPE);
195 std::string toString(std::string indent =
"")
const override;
205 Type &getType()
const override;
208 return (I->getKind() == MemOIR_Func::INT16_TYPE);
211 std::string toString(std::string indent =
"")
const override;
221 Type &getType()
const override;
224 return (I->getKind() == MemOIR_Func::INT8_TYPE);
227 std::string toString(std::string indent =
"")
const override;
237 Type &getType()
const override;
240 return (I->getKind() == MemOIR_Func::INT2_TYPE);
243 std::string toString(std::string indent =
"")
const override;
253 Type &getType()
const override;
256 return (I->getKind() == MemOIR_Func::BOOL_TYPE);
259 std::string toString(std::string indent =
"")
const override;
269 Type &getType()
const override;
272 return (I->getKind() == MemOIR_Func::FLOAT_TYPE);
275 std::string toString(std::string indent =
"")
const override;
285 Type &getType()
const override;
288 return (I->getKind() == MemOIR_Func::DOUBLE_TYPE);
291 std::string toString(std::string indent =
"")
const override;
301 Type &getType()
const override;
304 return (I->getKind() == MemOIR_Func::POINTER_TYPE);
307 std::string toString(std::string indent =
"")
const override;
317 Type &getType()
const override;
318 Type &getReferencedType()
const;
319 llvm::Value &getReferencedTypeOperand()
const;
320 llvm::Use &getReferencedTypeOperandAsUse()
const;
323 return (I->getKind() == MemOIR_Func::REFERENCE_TYPE);
326 std::string toString(std::string indent =
"")
const override;
336 Type &getType()
const override;
337 std::string getName()
const;
338 llvm::Value &getNameOperand()
const;
339 llvm::Use &getNameOperandAsUse()
const;
341 unsigned getNumberOfFields()
const;
342 llvm::Value &getNumberOfFieldsOperand()
const;
343 llvm::Use &getNumberOfFieldsOperandAsUse()
const;
345 Type &getFieldType(
unsigned field_index)
const;
346 llvm::Value &getFieldTypeOperand(
unsigned field_index)
const;
347 llvm::Use &getFieldTypeOperandAsUse(
unsigned field_index)
const;
350 return (I->getKind() == MemOIR_Func::DEFINE_STRUCT_TYPE);
353 std::string toString(std::string indent =
"")
const override;
363 Type &getType()
const override;
364 std::string getName()
const;
365 llvm::Value &getNameOperand()
const;
366 llvm::Use &getNameOperandAsUse()
const;
369 return (I->getKind() == MemOIR_Func::STRUCT_TYPE);
372 std::string toString(std::string indent =
"")
const override;
382 Type &getType()
const override;
383 Type &getElementType()
const;
384 llvm::Value &getElementTypeOperand()
const;
385 llvm::Use &getElementTypeOperandAsUse()
const;
386 unsigned getNumberOfDimensions()
const;
387 llvm::Value &getNumberOfDimensionsOperand()
const;
388 llvm::Use &getNumberOfDimensionsOperandAsUse()
const;
389 size_t getLengthOfDimension(
unsigned dimension_index)
const;
390 llvm::Value &getLengthOfDimensionOperand(
unsigned dimension_index)
const;
391 llvm::Use &getLengthOfDimensionOperandAsUse(
unsigned dimension_index)
const;
394 return (I->getKind() == MemOIR_Func::STATIC_TENSOR_TYPE);
397 std::string toString(std::string indent =
"")
const override;
407 Type &getType()
const override;
408 Type &getElementType()
const;
409 llvm::Value &getElementOperand()
const;
410 llvm::Use &getElementOperandAsUse()
const;
411 unsigned getNumberOfDimensions()
const;
412 llvm::Value &getNumberOfDimensionsOperand()
const;
413 llvm::Use &getNumberOfDimensionsOperandAsUse()
const;
416 return (I->getKind() == MemOIR_Func::TENSOR_TYPE);
419 std::string toString(std::string indent =
"")
const override;
429 Type &getType()
const override;
430 Type &getKeyType()
const;
431 llvm::Value &getKeyOperand()
const;
432 llvm::Use &getKeyOperandAsUse()
const;
433 Type &getValueType()
const;
434 llvm::Value &getValueOperand()
const;
435 llvm::Use &getValueOperandAsUse()
const;
438 return (I->getKind() == MemOIR_Func::ASSOC_ARRAY_TYPE);
441 std::string toString(std::string indent =
"")
const override;
452 Type &getType()
const override;
453 Type &getElementType()
const;
454 llvm::Value &getElementOperand()
const;
455 llvm::Use &getElementOperandAsUse()
const;
458 return (I->getKind() == MemOIR_Func::SEQUENCE_TYPE);
461 std::string toString(std::string indent =
"")
const override;
472 llvm::Value &getAllocation()
const;
473 virtual Type &getType()
const = 0;
477 #define HANDLE_ALLOC_INST(ENUM, FUNC, CLASS) \ 478 (I->getKind() == MemOIR_Func::ENUM) || 479 #include "memoir/ir/Instructions.def" 491 llvm::Value &getStruct()
const;
494 Type &getType()
const override;
496 llvm::Value &getTypeOperand()
const;
497 llvm::Use &getTypeOperandAsUse()
const;
500 return (I->getKind() == MemOIR_Func::ALLOCATE_STRUCT);
503 std::string toString(std::string indent =
"")
const override;
513 virtual llvm::Value &getCollection()
const = 0;
518 #define HANDLE_COLLECTION_ALLOC_INST(ENUM, FUNC, CLASS) \
519 (I->getKind() == MemOIR_Func::ENUM) ||
520 #include
"memoir/ir/Instructions.def" 524 Type &getType()
const override;
534 llvm::Value &getCollection()
const override;
537 Type &getElementType()
const;
538 llvm::Value &getElementOperand()
const;
539 llvm::Use &getElementOperandAsUse()
const;
541 unsigned getNumberOfDimensions()
const;
542 llvm::Value &getNumberOfDimensionsOperand()
const;
543 llvm::Use &getNumberOfDimensionsOperandAsUse()
const;
544 llvm::Value &getLengthOfDimensionOperand(
unsigned dimension_index)
const;
545 llvm::Use &getLengthOfDimensionOperandAsUse(
unsigned dimension_index)
const;
548 return (I->getKind() == MemOIR_Func::ALLOCATE_TENSOR);
551 std::string toString(std::string indent =
"")
const override;
561 llvm::Value &getCollection()
const override;
564 Type &getKeyType()
const;
565 llvm::Value &getKeyOperand()
const;
566 llvm::Use &getKeyOperandAsUse()
const;
568 Type &getValueType()
const;
569 llvm::Value &getValueOperand()
const;
570 llvm::Use &getValueOperandAsUse()
const;
573 return (I->getKind() == MemOIR_Func::ALLOCATE_ASSOC_ARRAY);
576 std::string toString(std::string indent =
"")
const override;
588 llvm::Value &getCollection()
const override;
591 Type &getElementType()
const;
592 llvm::Value &getElementOperand()
const;
593 llvm::Use &getElementOperandAsUse()
const;
595 llvm::Value &getSizeOperand()
const;
596 llvm::Use &getSizeOperandAsUse()
const;
599 return (I->getKind() == MemOIR_Func::ALLOCATE_SEQUENCE);
602 std::string toString(std::string indent =
"")
const override;
616 virtual llvm::Value &getObjectOperand()
const = 0;
617 virtual llvm::Use &getObjectOperandAsUse()
const = 0;
621 #define HANDLE_ACCESS_INST(ENUM, FUNC, CLASS) \
622 (I->getKind() == MemOIR_Func::ENUM) ||
623 #include
"memoir/ir/Instructions.def" 636 llvm::Value &getValueRead()
const;
638 llvm::Value &getObjectOperand()
const override;
639 llvm::Use &getObjectOperandAsUse()
const override;
643 #define HANDLE_READ_INST(ENUM, FUNC, CLASS) \ 644 (I->getKind() == MemOIR_Func::ENUM) || 645 #include "memoir/ir/Instructions.def" 659 unsigned getFieldIndex()
const;
660 llvm::Value &getFieldIndexOperand()
const;
661 llvm::Use &getFieldIndexOperandAsUse()
const;
665 #define HANDLE_STRUCT_READ_INST(ENUM, FUNC, CLASS) \ 666 (I->getKind() == MemOIR_Func::ENUM) || 667 #include "memoir/ir/Instructions.def" 671 std::string toString(std::string indent =
"")
const override;
681 unsigned getNumberOfDimensions()
const;
682 llvm::Value &getIndexOfDimension(
unsigned dim_idx)
const;
683 llvm::Use &getIndexOfDimensionAsUse(
unsigned dim_idx)
const;
687 #define HANDLE_INDEX_READ_INST(ENUM, FUNC, CLASS) \ 688 (I->getKind() == MemOIR_Func::ENUM) || 689 #include "memoir/ir/Instructions.def" 693 std::string toString(std::string indent =
"")
const override;
703 llvm::Value &getKeyOperand()
const;
704 llvm::Use &getKeyOperandAsUse()
const;
708 #define HANDLE_ASSOC_READ_INST(ENUM, FUNC, CLASS) \ 709 (I->getKind() == MemOIR_Func::ENUM) || 710 #include "memoir/ir/Instructions.def" 714 std::string toString(std::string indent =
"")
const override;
725 llvm::Value &getValueWritten()
const;
726 llvm::Use &getValueWrittenAsUse()
const;
728 llvm::Value &getObjectOperand()
const override;
729 llvm::Use &getObjectOperandAsUse()
const override;
733 #define HANDLE_WRITE_INST(ENUM, FUNC, CLASS) \ 734 (I->getKind() == MemOIR_Func::ENUM) || 735 #include "memoir/ir/Instructions.def" 749 unsigned getFieldIndex()
const;
750 llvm::Value &getFieldIndexOperand()
const;
751 llvm::Use &getFieldIndexOperandAsUse()
const;
755 #define HANDLE_STRUCT_WRITE_INST(ENUM, FUNC, CLASS) \ 756 (I->getKind() == MemOIR_Func::ENUM) || 757 #include "memoir/ir/Instructions.def" 761 std::string toString(std::string indent =
"")
const override;
771 llvm::Value &getCollection()
const;
773 unsigned getNumberOfDimensions()
const;
774 llvm::Value &getIndexOfDimension(
unsigned dim_idx)
const;
775 llvm::Use &getIndexOfDimensionAsUse(
unsigned dim_idx)
const;
779 #define HANDLE_INDEX_WRITE_INST(ENUM, FUNC, CLASS) \ 780 (I->getKind() == MemOIR_Func::ENUM) || 781 #include "memoir/ir/Instructions.def" 785 std::string toString(std::string indent =
"")
const override;
795 llvm::Value &getCollection()
const;
797 llvm::Value &getKeyOperand()
const;
798 llvm::Use &getKeyOperandAsUse()
const;
802 #define HANDLE_ASSOC_WRITE_INST(ENUM, FUNC, CLASS) \ 803 (I->getKind() == MemOIR_Func::ENUM) || 804 #include "memoir/ir/Instructions.def" 808 std::string toString(std::string indent =
"")
const override;
819 llvm::Value &getNestedObject()
const;
821 llvm::Value &getObjectOperand()
const override;
822 llvm::Use &getObjectOperandAsUse()
const override;
826 #define HANDLE_GET_INST(ENUM, FUNC, CLASS) \ 827 (I->getKind() == MemOIR_Func::ENUM) || 828 #include "memoir/ir/Instructions.def" 842 unsigned getFieldIndex()
const;
843 llvm::Value &getFieldIndexOperand()
const;
844 llvm::Use &getFieldIndexOperandAsUse()
const;
848 #define HANDLE_STRUCT_GET_INST(ENUM, FUNC, CLASS) \ 849 (I->getKind() == MemOIR_Func::ENUM) || 850 #include "memoir/ir/Instructions.def" 854 std::string toString(std::string indent =
"")
const override;
864 unsigned getNumberOfDimensions()
const;
865 llvm::Value &getIndexOfDimension(
unsigned dim_idx)
const;
866 llvm::Use &getIndexOfDimensionAsUse(
unsigned dim_idx)
const;
870 #define HANDLE_INDEX_GET_INST(ENUM, FUNC, CLASS) \ 871 (I->getKind() == MemOIR_Func::ENUM) || 872 #include "memoir/ir/Instructions.def" 876 std::string toString(std::string indent =
"")
const override;
886 llvm::Value &getKeyOperand()
const;
887 llvm::Use &getKeyOperandAsUse()
const;
891 #define HANDLE_ASSOC_GET_INST(ENUM, FUNC, CLASS) \ 892 (I->getKind() == MemOIR_Func::ENUM) || 893 #include "memoir/ir/Instructions.def" 897 std::string toString(std::string indent =
"")
const override;
908 virtual llvm::Value &getResultCollection()
const;
910 virtual llvm::Value &getBaseCollection()
const = 0;
911 virtual llvm::Use &getBaseCollectionAsUse()
const = 0;
913 virtual llvm::Value &getInsertionPoint()
const = 0;
914 virtual llvm::Use &getInsertionPointAsUse()
const = 0;
918 #define HANDLE_INSERT_INST(ENUM, FUNC, CLASS) \ 919 (I->getKind() == MemOIR_Func::ENUM) || 920 #include "memoir/ir/Instructions.def" 930 llvm::Value &getBaseCollection()
const override;
931 llvm::Use &getBaseCollectionAsUse()
const override;
933 llvm::Value &getValueInserted()
const;
934 llvm::Use &getValueInsertedAsUse()
const;
936 llvm::Value &getInsertionPoint()
const override;
937 llvm::Use &getInsertionPointAsUse()
const override;
941 #define HANDLE_SEQ_INSERT_INST(ENUM, FUNC, CLASS) \ 942 (I->getKind() == MemOIR_Func::ENUM) || 943 #include "memoir/ir/Instructions.def" 947 std::string toString(std::string indent =
"")
const override;
957 llvm::Value &getBaseCollection()
const override;
958 llvm::Use &getBaseCollectionAsUse()
const override;
960 llvm::Value &getInsertedCollection()
const;
961 llvm::Use &getInsertedCollectionAsUse()
const;
963 llvm::Value &getInsertionPoint()
const override;
964 llvm::Use &getInsertionPointAsUse()
const override;
967 return (I->getKind() == MemOIR_Func::SEQ_INSERT);
970 std::string toString(std::string indent =
"")
const override;
980 virtual llvm::Value &getResultCollection()
const;
982 virtual llvm::Value &getBaseCollection()
const = 0;
983 virtual llvm::Use &getBaseCollectionAsUse()
const = 0;
987 #define HANDLE_REMOVE_INST(ENUM, FUNC, CLASS) \ 988 (I->getKind() == MemOIR_Func::ENUM) || 989 #include "memoir/ir/Instructions.def" 998 llvm::Value &getBaseCollection()
const override;
999 llvm::Use &getBaseCollectionAsUse()
const override;
1001 llvm::Value &getBeginIndex()
const;
1002 llvm::Use &getBeginIndexAsUse()
const;
1004 llvm::Value &getEndIndex()
const;
1005 llvm::Use &getEndIndexAsUse()
const;
1008 return (I->getKind() == MemOIR_Func::SEQ_REMOVE);
1011 std::string toString(std::string indent =
"")
const override;
1020 llvm::Value &getResult()
const;
1022 virtual llvm::Value &getIncomingCollectionFor(
1023 llvm::Value &collection)
const = 0;
1024 virtual llvm::Use &getIncomingCollectionAsUseFor(
1025 llvm::Value &collection)
const = 0;
1027 virtual llvm::Value &getFromCollection()
const = 0;
1028 virtual llvm::Use &getFromCollectionAsUse()
const = 0;
1030 virtual llvm::Value &getBeginIndex()
const = 0;
1031 virtual llvm::Use &getBeginIndexAsUse()
const = 0;
1033 virtual llvm::Value &getEndIndex()
const = 0;
1034 virtual llvm::Use &getEndIndexAsUse()
const = 0;
1036 virtual llvm::Value &getToCollection()
const = 0;
1037 virtual llvm::Use &getToCollectionAsUse()
const = 0;
1039 virtual llvm::Value &getToBeginIndex()
const = 0;
1040 virtual llvm::Use &getToBeginIndexAsUse()
const = 0;
1044 #define HANDLE_SWAP_INST(ENUM, FUNC, CLASS) \ 1045 (I->getKind() == MemOIR_Func::ENUM) || 1046 #include "memoir/ir/Instructions.def" 1055 llvm::Value &getIncomingCollectionFor(llvm::Value &collection)
const override;
1056 llvm::Use &getIncomingCollectionAsUseFor(
1057 llvm::Value &collection)
const override;
1059 llvm::Value &getFromCollection()
const override;
1060 llvm::Use &getFromCollectionAsUse()
const override;
1062 llvm::Value &getBeginIndex()
const override;
1063 llvm::Use &getBeginIndexAsUse()
const override;
1065 llvm::Value &getEndIndex()
const override;
1066 llvm::Use &getEndIndexAsUse()
const override;
1068 llvm::Value &getToCollection()
const override;
1069 llvm::Use &getToCollectionAsUse()
const override;
1071 llvm::Value &getToBeginIndex()
const override;
1072 llvm::Use &getToBeginIndexAsUse()
const override;
1075 return (I->getKind() == MemOIR_Func::SEQ_SWAP);
1078 std::string toString(std::string indent =
"")
const override;
1088 llvm::Value &getIncomingCollectionFor(llvm::Value &collection)
const override;
1089 llvm::Use &getIncomingCollectionAsUseFor(
1090 llvm::Value &collection)
const override;
1092 llvm::Value &getFromCollection()
const override;
1093 llvm::Use &getFromCollectionAsUse()
const override;
1095 llvm::Value &getBeginIndex()
const override;
1096 llvm::Use &getBeginIndexAsUse()
const override;
1098 llvm::Value &getEndIndex()
const override;
1099 llvm::Use &getEndIndexAsUse()
const override;
1101 llvm::Value &getToCollection()
const override;
1102 llvm::Use &getToCollectionAsUse()
const override;
1104 llvm::Value &getToBeginIndex()
const override;
1105 llvm::Use &getToBeginIndexAsUse()
const override;
1108 return (I->getKind() == MemOIR_Func::SEQ_SWAP_WITHIN);
1111 std::string toString(std::string indent =
"")
const override;
1120 virtual llvm::Value &getCopy()
const;
1122 virtual llvm::Value &getCopiedCollection()
const;
1123 virtual llvm::Use &getCopiedCollectionAsUse()
const;
1127 #define HANDLE_COPY_INST(ENUM, FUNC, CLASS) \ 1128 (I->getKind() == MemOIR_Func::ENUM) || 1129 #include "memoir/ir/Instructions.def" 1141 llvm::Value &getBeginIndex()
const;
1142 llvm::Use &getBeginIndexAsUse()
const;
1144 llvm::Value &getEndIndex()
const;
1145 llvm::Use &getEndIndexAsUse()
const;
1148 return (I->getKind() == MemOIR_Func::SEQ_COPY);
1151 std::string toString(std::string indent =
"")
const override;
1162 llvm::Value &getSize()
const;
1164 llvm::Value &getCollection()
const;
1165 llvm::Use &getCollectionAsUse()
const;
1168 return (I->getKind() == MemOIR_Func::SIZE);
1171 std::string toString(std::string indent =
"")
const override;
1181 llvm::Value &getValue()
const;
1184 return (I->getKind() == MemOIR_Func::END);
1187 std::string toString(std::string indent =
"")
const override;
1198 llvm::Value &getObjectOperand()
const override;
1199 llvm::Use &getObjectOperandAsUse()
const override;
1201 llvm::Value &getKeyOperand()
const;
1202 llvm::Use &getKeyOperandAsUse()
const;
1205 return (I->getKind() == MemOIR_Func::ASSOC_HAS);
1208 std::string toString(std::string indent =
"")
const override;
1218 llvm::Value &getBaseCollection()
const override;
1219 llvm::Use &getBaseCollectionAsUse()
const override;
1221 llvm::Value &getInsertionPoint()
const override;
1222 llvm::Use &getInsertionPointAsUse()
const override;
1225 return (I->getKind() == MemOIR_Func::ASSOC_INSERT);
1228 std::string toString(std::string indent =
"")
const override;
1238 llvm::Value &getBaseCollection()
const override;
1239 llvm::Use &getBaseCollectionAsUse()
const override;
1241 llvm::Value &getKey()
const;
1242 llvm::Use &getKeyAsUse()
const;
1245 return (I->getKind() == MemOIR_Func::ASSOC_REMOVE);
1248 std::string toString(std::string indent =
"")
const override;
1258 llvm::Value &getKeys()
const;
1260 llvm::Value &getCollection()
const;
1261 llvm::Use &getCollectionAsUse()
const;
1264 return (I->getKind() == MemOIR_Func::ASSOC_KEYS);
1267 std::string toString(std::string indent =
"")
const override;
1278 llvm::Value &getResult()
const;
1280 llvm::Value &getInitial()
const;
1281 llvm::Use &getInitialAsUse()
const;
1283 llvm::Value &getCollection()
const;
1284 llvm::Use &getCollectionAsUse()
const;
1286 llvm::Function &getFunction()
const;
1287 llvm::Value &getFunctionOperand()
const;
1288 llvm::Use &getFunctionOperandAsUse()
const;
1290 unsigned getNumberOfClosed()
const;
1291 llvm::Value &getClosed(
unsigned index)
const;
1292 llvm::Use &getClosedAsUse(
unsigned index)
const;
1294 std::string toString(std::string indent =
"")
const override;
1298 #define HANDLE_FOLD_INST(ENUM, FUNC, CLASS) \ 1299 (I->getKind() == MemOIR_Func::ENUM) || 1300 #include "memoir/ir/Instructions.def" 1313 llvm::Value &getResultCollection()
const;
1315 llvm::Value &getUsedCollection()
const;
1316 llvm::Use &getUsedCollectionAsUse()
const;
1318 llvm::Instruction &getUseInst()
const;
1319 void setUseInst(llvm::Instruction &I)
const;
1323 return (I->getKind() == MemOIR_Func::USE_PHI);
1326 std::string toString(std::string indent =
"")
const override;
1336 llvm::Value &getResultCollection()
const;
1338 llvm::Value &getDefinedCollection()
const;
1339 llvm::Use &getDefinedCollectionAsUse()
const;
1341 llvm::Instruction &getDefInst()
const;
1342 void setDefInst(llvm::Instruction &I)
const;
1346 return (I->getKind() == MemOIR_Func::DEF_PHI);
1349 std::string toString(std::string indent =
"")
const override;
1359 llvm::Value &getResultCollection()
const;
1361 llvm::Value &getInputCollection()
const;
1362 llvm::Use &getInputCollectionAsUse()
const;
1367 return (I->getKind() == MemOIR_Func::ARG_PHI);
1370 std::string toString(std::string indent =
"")
const override;
1380 llvm::Value &getResultCollection()
const;
1382 llvm::Value &getInputCollection()
const;
1383 llvm::Use &getInputCollectionAsUse()
const;
1388 return (I->getKind() == MemOIR_Func::RET_PHI);
1391 std::string toString(std::string indent =
"")
const override;
1402 llvm::Value &getDeletedStruct()
const;
1403 llvm::Use &getDeletedStructAsUse()
const;
1406 return (I->getKind() == MemOIR_Func::DELETE_STRUCT);
1409 std::string toString(std::string indent =
"")
const override;
1419 llvm::Value &getDeletedCollection()
const;
1420 llvm::Use &getDeletedCollectionAsUse()
const;
1423 return (I->getKind() == MemOIR_Func::DELETE_COLLECTION);
1426 std::string toString(std::string indent =
"")
const override;
1437 virtual Type &getType()
const = 0;
1438 virtual llvm::Value &getTypeOperand()
const = 0;
1439 virtual llvm::Use &getTypeOperandAsUse()
const = 0;
1441 virtual llvm::Value &getObject()
const = 0;
1442 virtual llvm::Use &getObjectAsUse()
const = 0;
1446 #define HANDLE_ASSERT_TYPE_INST(ENUM, FUNC, CLASS) \ 1447 (I->getKind() == MemOIR_Func::ENUM) || 1448 #include "memoir/ir/Instructions.def" 1460 Type &getType()
const override;
1461 llvm::Value &getTypeOperand()
const override;
1462 llvm::Use &getTypeOperandAsUse()
const override;
1464 llvm::Value &getStruct()
const;
1465 llvm::Use &getStructAsUse()
const;
1466 llvm::Value &getObject()
const override;
1467 llvm::Use &getObjectAsUse()
const override;
1470 return (I->getKind() == MemOIR_Func::ASSERT_STRUCT_TYPE);
1473 std::string toString(std::string indent =
"")
const override;
1483 Type &getType()
const override;
1484 llvm::Value &getTypeOperand()
const override;
1485 llvm::Use &getTypeOperandAsUse()
const override;
1487 llvm::Value &getCollection()
const;
1488 llvm::Use &getCollectionAsUse()
const;
1489 llvm::Value &getObject()
const override;
1490 llvm::Use &getObjectAsUse()
const override;
1493 return (I->getKind() == MemOIR_Func::ASSERT_COLLECTION_TYPE);
1496 std::string toString(std::string indent =
"")
const override;
1507 Type &getType()
const;
1508 llvm::Value &getTypeOperand()
const;
1509 llvm::Use &getTypeOperandAsUse()
const;
1512 return (I->getKind() == MemOIR_Func::SET_RETURN_TYPE);
1515 std::string toString(std::string indent =
"")
const override;
Definition: Instructions.hpp:283
Definition: Instructions.hpp:267
Definition: Instructions.hpp:187
Definition: Instructions.hpp:1256
Definition: Instructions.hpp:139
Definition: Instructions.hpp:928
Definition: Instructions.hpp:155
Definition: Instructions.hpp:745
Definition: Instructions.hpp:1417
Definition: Instructions.hpp:634
Definition: Instructions.hpp:489
Definition: Instructions.hpp:679
Definition: Instructions.hpp:701
Definition: Instructions.hpp:171
Definition: Instructions.hpp:1400
Definition: Instructions.hpp:586
Definition: Instructions.hpp:1481
Definition: Instructions.hpp:978
Definition: Instructions.hpp:1086
Definition: Instructions.hpp:655
Definition: Instructions.hpp:1019
Definition: Instructions.hpp:1236
Definition: Instructions.hpp:1435
Definition: Types.hpp:213
Definition: Instructions.hpp:1311
Definition: Instructions.hpp:405
Definition: Instructions.hpp:1334
Definition: Instructions.hpp:450
Definition: Instructions.hpp:73
Definition: Instructions.hpp:884
Definition: Instructions.hpp:235
Definition: Instructions.hpp:1276
Definition: Instructions.hpp:315
Definition: Instructions.hpp:219
Definition: Instructions.hpp:470
Definition: Instructions.hpp:1139
Definition: Instructions.hpp:906
Definition: Instructions.hpp:559
Definition: Instructions.hpp:361
Definition: Instructions.hpp:1458
Definition: Instructions.hpp:427
Definition: Instructions.hpp:299
Definition: Instructions.hpp:862
Definition: Instructions.hpp:996
Definition: Instructions.hpp:1196
Definition: Instructions.hpp:334
Definition: Instructions.hpp:1216
Definition: Instructions.hpp:1053
Definition: Instructions.hpp:532
Definition: Instructions.hpp:511
Definition: Instructions.hpp:107
Definition: Instructions.hpp:91
Definition: Instructions.hpp:1179
Definition: Instructions.hpp:380
Definition: Instructions.hpp:838
Definition: Liveness.hpp:17
Definition: Instructions.hpp:955
Definition: Instructions.hpp:1119
Definition: Instructions.hpp:31
Definition: Instructions.hpp:793
Definition: Instructions.hpp:1357
Definition: Types.hpp:250
Definition: Instructions.hpp:817
Definition: Instructions.hpp:123
Definition: Instructions.hpp:251
Definition: Instructions.hpp:1160
Definition: Instructions.hpp:612
Definition: Instructions.hpp:203
Definition: Instructions.hpp:1378
Definition: Instructions.hpp:1505
Definition: Instructions.hpp:723
Definition: Instructions.hpp:769