6 #include <yuni/core/string.h> 21 enum class Pragma : uint32_t {
37 shortcircuitOpNopOffset,
39 shortcircuitMutateToBool,
47 static const constexpr uint32_t PragmaCount = 1 + (uint32_t) Pragma::synthetic;
54 enum class Blueprint : uint32_t {
76 enum class TypeQualifier : uint32_t {
82 static const constexpr uint32_t TypeQualifierCount = 1 + (uint32_t) TypeQualifier::constant;
85 template<ny::ir::isa::Op O>
struct Operand final {};
88 template<>
struct Operand<
ny::ir::isa::Op::nop> final {
89 constexpr
static const char* opname() {
94 template<
class T>
void eachLVID(T&) {}
97 template<>
struct Operand<
ny::ir::isa::Op::eq> final {
98 constexpr
static const char* opname() {
106 template<
class T>
void eachLVID(T& c) {
112 constexpr
static const char* opname() {
120 template<
class T>
void eachLVID(T& c) {
126 constexpr
static const char* opname() {
134 template<
class T>
void eachLVID(T& c) {
139 template<>
struct Operand<
ny::ir::isa::Op::flte> final {
140 constexpr
static const char* opname() {
148 template<
class T>
void eachLVID(T& c) {
154 constexpr
static const char* opname() {
162 template<
class T>
void eachLVID(T& c) {
167 template<>
struct Operand<
ny::ir::isa::Op::fgte> final {
168 constexpr
static const char* opname() {
176 template<
class T>
void eachLVID(T& c) {
182 constexpr
static const char* opname() {
190 template<
class T>
void eachLVID(T& c) {
196 constexpr
static const char* opname() {
204 template<
class T>
void eachLVID(T& c) {
210 constexpr
static const char* opname() {
218 template<
class T>
void eachLVID(T& c) {
223 template<>
struct Operand<
ny::ir::isa::Op::ilte> final {
224 constexpr
static const char* opname() {
232 template<
class T>
void eachLVID(T& c) {
238 constexpr
static const char* opname() {
246 template<
class T>
void eachLVID(T& c) {
252 constexpr
static const char* opname() {
260 template<
class T>
void eachLVID(T& c) {
266 constexpr
static const char* opname() {
274 template<
class T>
void eachLVID(T& c) {
279 template<>
struct Operand<
ny::ir::isa::Op::igte> final {
280 constexpr
static const char* opname() {
288 template<
class T>
void eachLVID(T& c) {
293 template<>
struct Operand<
ny::ir::isa::Op::opand> final {
294 constexpr
static const char* opname() {
302 template<
class T>
void eachLVID(T& c) {
307 template<>
struct Operand<
ny::ir::isa::Op::opor> final {
308 constexpr
static const char* opname() {
316 template<
class T>
void eachLVID(T& c) {
321 template<>
struct Operand<
ny::ir::isa::Op::opxor> final {
322 constexpr
static const char* opname() {
330 template<
class T>
void eachLVID(T& c) {
335 template<>
struct Operand<
ny::ir::isa::Op::opmod> final {
336 constexpr
static const char* opname() {
344 template<
class T>
void eachLVID(T& c) {
349 template<>
struct Operand<
ny::ir::isa::Op::negation> final {
350 constexpr
static const char* opname() {
357 template<
class T>
void eachLVID(T& c) {
362 template<>
struct Operand<
ny::ir::isa::Op::fadd> final {
363 constexpr
static const char* opname() {
370 template<
class T>
void eachLVID(T& c) {
375 template<>
struct Operand<
ny::ir::isa::Op::fsub> final {
376 constexpr
static const char* opname() {
384 template<
class T>
void eachLVID(T& c) {
389 template<>
struct Operand<
ny::ir::isa::Op::fmul> final {
390 constexpr
static const char* opname() {
398 template<
class T>
void eachLVID(T& c) {
403 template<>
struct Operand<
ny::ir::isa::Op::fdiv> final {
404 constexpr
static const char* opname() {
412 template<
class T>
void eachLVID(T& c) {
418 constexpr
static const char* opname() {
426 template<
class T>
void eachLVID(T& c) {
432 constexpr
static const char* opname() {
440 template<
class T>
void eachLVID(T& c) {
446 constexpr
static const char* opname() {
454 template<
class T>
void eachLVID(T& c) {
460 constexpr
static const char* opname() {
468 template<
class T>
void eachLVID(T& c) {
473 template<>
struct Operand<
ny::ir::isa::Op::imul> final {
474 constexpr
static const char* opname() {
482 template<
class T>
void eachLVID(T& c) {
487 template<>
struct Operand<
ny::ir::isa::Op::idiv> final {
488 constexpr
static const char* opname() {
496 template<
class T>
void eachLVID(T& c) {
501 template<>
struct Operand<
ny::ir::isa::Op::fieldget> final {
502 constexpr
static const char* opname() {
509 template<
class T>
void eachLVID(T& c) {
514 template<>
struct Operand<
ny::ir::isa::Op::fieldset> final {
515 constexpr
static const char* opname() {
522 template<
class T>
void eachLVID(T& c) {
527 template<>
struct Operand<
ny::ir::isa::Op::stacksize> final {
528 constexpr
static const char* opname() {
533 template<
class T>
void eachLVID(T&) {}
536 template<>
struct Operand<
ny::ir::isa::Op::comment> final {
537 constexpr
static const char* opname() {
542 template<
class T>
void eachLVID(T&) {}
545 template<>
struct Operand<
ny::ir::isa::Op::stackalloc> final {
546 constexpr
static const char* opname() {
553 template<
class T>
void eachLVID(T& c) {
558 template<>
struct Operand<
ny::ir::isa::Op::storeConstant> final {
559 constexpr
static const char* opname() {
560 return "storeConstant";
568 template<
class T>
void eachLVID(T& c) {
573 template<>
struct Operand<
ny::ir::isa::Op::storeText> final {
574 constexpr
static const char* opname() {
580 template<
class T>
void eachLVID(T& c) {
585 template<>
struct Operand<
ny::ir::isa::Op::store> final {
586 constexpr
static const char* opname() {
592 template<
class T>
void eachLVID(T& c) {
598 constexpr
static const char* opname() {
604 template<
class T>
void eachLVID(T& c) {
609 template<>
struct Operand<
ny::ir::isa::Op::push> final {
610 constexpr
static const char* opname() {
616 template<
class T>
void eachLVID(T& c) {
621 template<>
struct Operand<
ny::ir::isa::Op::tpush> final {
622 constexpr
static const char* opname() {
628 template<
class T>
void eachLVID(T& c) {
633 template<>
struct Operand<
ny::ir::isa::Op::call> final {
634 constexpr
static const char* opname() {
641 template<
class T>
void eachLVID(T& c) {
646 template<>
struct Operand<
ny::ir::isa::Op::intrinsic> final {
647 constexpr
static const char* opname() {
656 template<
class T>
void eachLVID(T& c) {
661 template<>
struct Operand<
ny::ir::isa::Op::debugfile> final {
662 constexpr
static const char* opname() {
667 template<
class T>
void eachLVID(T&) {}
670 template<>
struct Operand<
ny::ir::isa::Op::namealias> final {
671 constexpr
static const char* opname() {
677 template<
class T>
void eachLVID(T& c) {
682 template<>
struct Operand<
ny::ir::isa::Op::debugpos> final {
683 constexpr
static const char* opname() {
689 template<
class T>
void eachLVID(T&) {}
692 template<>
struct Operand<
ny::ir::isa::Op::scope> final {
693 constexpr
static const char* opname() {
697 template<
class T>
void eachLVID(T&) {}
701 constexpr
static const char* opname() {
705 template<
class T>
void eachLVID(T&) {}
708 template<>
struct Operand<
ny::ir::isa::Op::qualifiers> final {
709 constexpr
static const char* opname() {
714 TypeQualifier qualifier;
717 template<
class T>
void eachLVID(T& c) {
723 template<>
struct Operand<
ny::ir::isa::Op::opassert> final {
724 constexpr
static const char* opname() {
729 template<
class T>
void eachLVID(T& c) {
734 template<>
struct Operand<
ny::ir::isa::Op::memcheckhold> final {
735 constexpr
static const char* opname() {
736 return "memcheckhold";
741 template<
class T>
void eachLVID(T& c) {
746 template<>
struct Operand<
ny::ir::isa::Op::label> final {
747 constexpr
static const char* opname() {
752 template<
class T>
void eachLVID(T& c) {
758 constexpr
static const char* opname() {
763 template<
class T>
void eachLVID(T&) {}
767 constexpr
static const char* opname() {
774 template<
class T>
void eachLVID(T& c) {
780 constexpr
static const char* opname() {
787 template<
class T>
void eachLVID(T& c) {
792 template<>
struct Operand<
ny::ir::isa::Op::memalloc> final {
793 constexpr
static const char* opname() {
799 template<
class T>
void eachLVID(T& c) {
804 template<>
struct Operand<
ny::ir::isa::Op::memfree> final {
805 constexpr
static const char* opname() {
811 template<
class T>
void eachLVID(T& c) {
816 template<>
struct Operand<
ny::ir::isa::Op::memfill> final {
817 constexpr
static const char* opname() {
824 template<
class T>
void eachLVID(T& c) {
829 template<>
struct Operand<
ny::ir::isa::Op::memcopy> final {
830 constexpr
static const char* opname() {
837 template<
class T>
void eachLVID(T& c) {
838 c(lvid, srclvid, regsize);
842 template<>
struct Operand<
ny::ir::isa::Op::memmove> final {
843 constexpr
static const char* opname() {
850 template<
class T>
void eachLVID(T& c) {
851 c(lvid, srclvid, regsize);
855 template<>
struct Operand<
ny::ir::isa::Op::memcmp> final {
856 constexpr
static const char* opname() {
863 template<
class T>
void eachLVID(T& c) {
864 c(lvid, srclvid, regsize);
868 template<>
struct Operand<
ny::ir::isa::Op::cstrlen> final {
869 constexpr
static const char* opname() {
876 template<
class T>
void eachLVID(T& c) {
881 template<>
struct Operand<
ny::ir::isa::Op::load_u64> final {
882 constexpr
static const char* opname() {
888 template<
class T>
void eachLVID(T& c) {
892 template<>
struct Operand<
ny::ir::isa::Op::load_u32> final {
893 constexpr
static const char* opname() {
899 template<
class T>
void eachLVID(T& c) {
903 template<>
struct Operand<
ny::ir::isa::Op::load_u8> final {
904 constexpr
static const char* opname() {
910 template<
class T>
void eachLVID(T& c) {
915 template<>
struct Operand<
ny::ir::isa::Op::store_u64> final {
916 constexpr
static const char* opname() {
922 template<
class T>
void eachLVID(T& c) {
926 template<>
struct Operand<
ny::ir::isa::Op::store_u32> final {
927 constexpr
static const char* opname() {
933 template<
class T>
void eachLVID(T& c) {
937 template<>
struct Operand<
ny::ir::isa::Op::store_u8> final {
938 constexpr
static const char* opname() {
944 template<
class T>
void eachLVID(T& c) {
949 template<>
struct Operand<
ny::ir::isa::Op::memrealloc> final {
950 constexpr
static const char* opname() {
957 template<
class T>
void eachLVID(T& c) {
958 c(lvid, oldsize, newsize);
962 template<>
struct Operand<
ny::ir::isa::Op::pragma> final {
963 constexpr
static const char* opname() {
973 uint32_t blueprintsize;
974 uint32_t shortcircuit;
985 } shortcircuitMetadata;
989 } shortcircuitMutate;
993 template<
class T>
void eachLVID(T& c) {
996 case Pragma::synthetic: {
997 c(value.synthetic.lvid);
1000 case Pragma::shortcircuitOpNopOffset: {
1001 c(value.shortcircuitMetadata.label);
1004 case Pragma::shortcircuitMutateToBool: {
1005 c(value.shortcircuitMutate.lvid);
1008 case Pragma::unknown:
1009 case Pragma::codegen:
1010 case Pragma::blueprintsize:
1011 case Pragma::visibility:
1012 case Pragma::bodystart:
1013 case Pragma::shortcircuit:
1014 case Pragma::builtinalias:
1015 case Pragma::suggest:
1021 template<>
struct Operand<
ny::ir::isa::Op::blueprint> final {
1022 constexpr
static const char* opname() {
1037 void setLVID(uint32_t newlvid) {
1041 } converter {newlvid};
1042 lvid = converter.lvid;
1044 template<
class T>
void eachLVID(T& c) {
1046 uint32_t cplvid = lvid;
1053 constexpr
static const char* opname() {
1058 template<
class T>
void eachLVID(T& c) {
1063 template<>
struct Operand<
ny::ir::isa::Op::identify> final {
1064 constexpr
static const char* opname() {
1071 template<
class T>
void eachLVID(T& c) {
1075 template<>
struct Operand<
ny::ir::isa::Op::identifyset> final {
1076 constexpr
static const char* opname() {
1077 return "identifyset";
1083 template<
class T>
void eachLVID(T& c) {
1088 template<>
struct Operand<
ny::ir::isa::Op::ensureresolved> final {
1089 constexpr
static const char* opname() {
1090 return "ensureresolved";
1094 template<
class T>
void eachLVID(T& c) {
1099 template<>
struct Operand<
ny::ir::isa::Op::commontype> final {
1100 constexpr
static const char* opname() {
1101 return "commontype";
1106 template<
class T>
void eachLVID(T& c) {
1112 constexpr
static const char* opname() {
1118 uint32_t disposelhs;
1119 template<
class T>
void eachLVID(T& c) {
1125 constexpr
static const char* opname() {
1132 template<
class T>
void eachLVID(T& c) {
1137 template<>
struct Operand<
ny::ir::isa::Op::typeisobject> final {
1138 constexpr
static const char* opname() {
1139 return "typeisobject";
1143 template<
class T>
void eachLVID(T& c) {
1148 template<>
struct Operand<
ny::ir::isa::Op::classdefsizeof> final {
1149 constexpr
static const char* opname() {
1150 return "classdefsizeof";
1155 template<
class T>
void eachLVID(T& c) {
1161 constexpr
static const char* opname() {
1166 template<
class T>
void eachLVID(T& c) {
1172 constexpr
static const char* opname() {
1181 uint32_t instanceid;
1183 template<
class T>
void eachLVID(T& c) {
1188 template<>
struct Operand<
ny::ir::isa::Op::allocate> final {
1189 constexpr
static const char* opname() {
1196 template<
class T>
void eachLVID(T& c) {
1202 constexpr
static const char* opname() {
1211 uint32_t instanceid;
1213 template<
class T>
void eachLVID(T& c) {
1222 template<ny::ir::isa::Op O>
1225 return print(sequence, reinterpret_cast<const ny::ir::Instruction&>(operands), map);
1228 void printExtract(YString& out,
const Sequence&, uint32_t offset,
const AtomMap* =
nullptr);
uint32_t name
Blueprint name.
Definition: data.h:1033
uint32_t atomid
Attached atomid (if any)
Definition: data.h:1035
Atoms.
Definition: atom-map.h:17
Definition: instruction.h:12
uint32_t iid
Intrinsic ID (only valid at execution)
Definition: data.h:653
Definition: sequence.h:22