Lines Matching refs:OS
60 void run(raw_ostream &OS);
63 void emitEnums(raw_ostream &OS);
81 void emitTIIHelperMethods(raw_ostream &OS, StringRef TargetName,
86 void emitMCIIHelperMethods(raw_ostream &OS, StringRef TargetName);
89 void emitFeatureVerifier(raw_ostream &OS, const CodeGenTarget &Target);
93 const OperandInfoMapTy &OperandInfo, raw_ostream &OS);
95 raw_ostream &OS, const CodeGenTarget &Target,
102 void emitOperandNameMappings(raw_ostream &OS, const CodeGenTarget &Target,
106 raw_ostream &OS, StringRef Namespace,
109 raw_ostream &OS, StringRef Namespace,
115 void EmitOperandInfo(raw_ostream &OS, OperandInfoListTy &OperandInfoList);
229 void InstrInfoEmitter::EmitOperandInfo(raw_ostream &OS, in EmitOperandInfo() argument
233 OS << " /* " << Offset << " */"; in EmitOperandInfo()
235 OS << " { " << Info << " },"; in EmitOperandInfo()
236 OS << '\n'; in EmitOperandInfo()
283 void InstrInfoEmitter::emitOperandNameMappings(raw_ostream &OS, in emitOperandNameMappings() argument
295 OS << "#ifdef GET_INSTRINFO_OPERAND_ENUM\n"; in emitOperandNameMappings()
296 OS << "#undef GET_INSTRINFO_OPERAND_ENUM\n"; in emitOperandNameMappings()
297 OS << "namespace llvm {\n"; in emitOperandNameMappings()
298 OS << "namespace " << Namespace << " {\n"; in emitOperandNameMappings()
299 OS << "namespace " << OpNameNS << " {\n"; in emitOperandNameMappings()
300 OS << "enum {\n"; in emitOperandNameMappings()
302 OS << " " << Op.first << " = " << Op.second << ",\n"; in emitOperandNameMappings()
304 OS << " OPERAND_LAST"; in emitOperandNameMappings()
305 OS << "\n};\n"; in emitOperandNameMappings()
306 OS << "} // end namespace OpName\n"; in emitOperandNameMappings()
307 OS << "} // end namespace " << Namespace << "\n"; in emitOperandNameMappings()
308 OS << "} // end namespace llvm\n"; in emitOperandNameMappings()
309 OS << "#endif //GET_INSTRINFO_OPERAND_ENUM\n\n"; in emitOperandNameMappings()
311 OS << "#ifdef GET_INSTRINFO_NAMED_OPS\n"; in emitOperandNameMappings()
312 OS << "#undef GET_INSTRINFO_NAMED_OPS\n"; in emitOperandNameMappings()
313 OS << "namespace llvm {\n"; in emitOperandNameMappings()
314 OS << "namespace " << Namespace << " {\n"; in emitOperandNameMappings()
315 OS << "LLVM_READONLY\n"; in emitOperandNameMappings()
316 OS << "int16_t getNamedOperandIdx(uint16_t Opcode, uint16_t NamedIdx) {\n"; in emitOperandNameMappings()
318 OS << " static const int16_t OperandMap [][" << Operands.size() in emitOperandNameMappings()
322 OS << "{"; in emitOperandNameMappings()
326 OS << (OpList.count(i) == 0 ? -1 : (int)OpList.find(i)->second) << ", "; in emitOperandNameMappings()
328 OS << "},\n"; in emitOperandNameMappings()
330 OS << "};\n"; in emitOperandNameMappings()
332 OS << " switch(Opcode) {\n"; in emitOperandNameMappings()
336 OS << " case " << Name << ":\n"; in emitOperandNameMappings()
338 OS << " return OperandMap[" << TableIndex++ << "][NamedIdx];\n"; in emitOperandNameMappings()
340 OS << " default: return -1;\n"; in emitOperandNameMappings()
341 OS << " }\n"; in emitOperandNameMappings()
344 OS << " return -1;\n"; in emitOperandNameMappings()
346 OS << "}\n"; in emitOperandNameMappings()
347 OS << "} // end namespace " << Namespace << "\n"; in emitOperandNameMappings()
348 OS << "} // end namespace llvm\n"; in emitOperandNameMappings()
349 OS << "#endif //GET_INSTRINFO_NAMED_OPS\n\n"; in emitOperandNameMappings()
356 raw_ostream &OS, const CodeGenTarget &Target, in emitOperandTypeMappings() argument
366 OS << "#ifdef GET_INSTRINFO_OPERAND_TYPES_ENUM\n"; in emitOperandTypeMappings()
367 OS << "#undef GET_INSTRINFO_OPERAND_TYPES_ENUM\n"; in emitOperandTypeMappings()
368 OS << "namespace llvm {\n"; in emitOperandTypeMappings()
369 OS << "namespace " << Namespace << " {\n"; in emitOperandTypeMappings()
370 OS << "namespace OpTypes {\n"; in emitOperandTypeMappings()
371 OS << "enum OperandType {\n"; in emitOperandTypeMappings()
378 OS << " " << Op->getName() << " = " << EnumVal << ",\n"; in emitOperandTypeMappings()
383 OS << " OPERAND_TYPE_LIST_END" << "\n};\n"; in emitOperandTypeMappings()
384 OS << "} // end namespace OpTypes\n"; in emitOperandTypeMappings()
385 OS << "} // end namespace " << Namespace << "\n"; in emitOperandTypeMappings()
386 OS << "} // end namespace llvm\n"; in emitOperandTypeMappings()
387 OS << "#endif // GET_INSTRINFO_OPERAND_TYPES_ENUM\n\n"; in emitOperandTypeMappings()
389 OS << "#ifdef GET_INSTRINFO_OPERAND_TYPE\n"; in emitOperandTypeMappings()
390 OS << "#undef GET_INSTRINFO_OPERAND_TYPE\n"; in emitOperandTypeMappings()
391 OS << "namespace llvm {\n"; in emitOperandTypeMappings()
392 OS << "namespace " << Namespace << " {\n"; in emitOperandTypeMappings()
393 OS << "LLVM_READONLY\n"; in emitOperandTypeMappings()
394 OS << "static int getOperandType(uint16_t Opcode, uint16_t OpIdx) {\n"; in emitOperandTypeMappings()
424 OS << " static const " << getMinimalTypeForRange(OperandRecords.size()); in emitOperandTypeMappings()
425 OS << " Offsets[] = {\n"; in emitOperandTypeMappings()
427 OS << " /* " << getInstrName(I) << " */\n"; in emitOperandTypeMappings()
428 OS << " " << OperandOffsets[I] << ",\n"; in emitOperandTypeMappings()
430 OS << " };\n"; in emitOperandTypeMappings()
439 OS << "\n using namespace OpTypes;\n"; in emitOperandTypeMappings()
440 OS << " static"; in emitOperandTypeMappings()
441 OS << ((EnumVal <= INT8_MAX) ? " const int8_t" : " const int16_t"); in emitOperandTypeMappings()
442 OS << " OpcodeOperandTypes[] = {\n "; in emitOperandTypeMappings()
446 OS << "\n /* " << getInstrName(CurOffset) << " */\n "; in emitOperandTypeMappings()
448 OS << "/* " << getInstrName(CurOffset) << " */\n "; in emitOperandTypeMappings()
455 OS << OpR->getName(); in emitOperandTypeMappings()
457 OS << -1; in emitOperandTypeMappings()
458 OS << ", "; in emitOperandTypeMappings()
460 OS << "\n };\n"; in emitOperandTypeMappings()
462 OS << " return OpcodeOperandTypes[Offsets[Opcode] + OpIdx];\n"; in emitOperandTypeMappings()
464 OS << " llvm_unreachable(\"No instructions defined\");\n"; in emitOperandTypeMappings()
466 OS << "}\n"; in emitOperandTypeMappings()
467 OS << "} // end namespace " << Namespace << "\n"; in emitOperandTypeMappings()
468 OS << "} // end namespace llvm\n"; in emitOperandTypeMappings()
469 OS << "#endif // GET_INSTRINFO_OPERAND_TYPE\n\n"; in emitOperandTypeMappings()
471 OS << "#ifdef GET_INSTRINFO_MEM_OPERAND_SIZE\n"; in emitOperandTypeMappings()
472 OS << "#undef GET_INSTRINFO_MEM_OPERAND_SIZE\n"; in emitOperandTypeMappings()
473 OS << "namespace llvm {\n"; in emitOperandTypeMappings()
474 OS << "namespace " << Namespace << " {\n"; in emitOperandTypeMappings()
475 OS << "LLVM_READONLY\n"; in emitOperandTypeMappings()
476 OS << "static int getMemOperandSize(int OpType) {\n"; in emitOperandTypeMappings()
477 OS << " switch (OpType) {\n"; in emitOperandTypeMappings()
485 OS << " default: return 0;\n"; in emitOperandTypeMappings()
488 OS << " case OpTypes::" << OperandName << ":\n"; in emitOperandTypeMappings()
489 OS << " return " << KV.first << ";\n\n"; in emitOperandTypeMappings()
491 OS << " }\n}\n"; in emitOperandTypeMappings()
492 OS << "} // end namespace " << Namespace << "\n"; in emitOperandTypeMappings()
493 OS << "} // end namespace llvm\n"; in emitOperandTypeMappings()
494 OS << "#endif // GET_INSTRINFO_MEM_OPERAND_SIZE\n\n"; in emitOperandTypeMappings()
498 raw_ostream &OS, StringRef Namespace, in emitLogicalOperandSizeMappings() argument
526 OS << "#ifdef GET_INSTRINFO_LOGICAL_OPERAND_SIZE_MAP\n"; in emitLogicalOperandSizeMappings()
527 OS << "#undef GET_INSTRINFO_LOGICAL_OPERAND_SIZE_MAP\n"; in emitLogicalOperandSizeMappings()
528 OS << "namespace llvm {\n"; in emitLogicalOperandSizeMappings()
529 OS << "namespace " << Namespace << " {\n"; in emitLogicalOperandSizeMappings()
530 OS << "LLVM_READONLY static unsigned\n"; in emitLogicalOperandSizeMappings()
531 OS << "getLogicalOperandSize(uint16_t Opcode, uint16_t LogicalOpIdx) {\n"; in emitLogicalOperandSizeMappings()
538 OS << " static const unsigned SizeMap[][" << LogicalOpListSize in emitLogicalOperandSizeMappings()
542 OS << " {"; in emitLogicalOperandSizeMappings()
545 OS << Row[i] << ", "; in emitLogicalOperandSizeMappings()
548 OS << "0, "; in emitLogicalOperandSizeMappings()
550 OS << "}, "; in emitLogicalOperandSizeMappings()
551 OS << "\n"; in emitLogicalOperandSizeMappings()
553 OS << " };\n"; in emitLogicalOperandSizeMappings()
555 OS << " switch (Opcode) {\n"; in emitLogicalOperandSizeMappings()
556 OS << " default: return LogicalOpIdx;\n"; in emitLogicalOperandSizeMappings()
561 OS << " case " << Inst << ":\n"; in emitLogicalOperandSizeMappings()
563 OS << " return SizeMap[" << OpMapIdx << "][LogicalOpIdx];\n"; in emitLogicalOperandSizeMappings()
565 OS << " }\n"; in emitLogicalOperandSizeMappings()
567 OS << " return LogicalOpIdx;\n"; in emitLogicalOperandSizeMappings()
569 OS << "}\n"; in emitLogicalOperandSizeMappings()
571 OS << "LLVM_READONLY static inline unsigned\n"; in emitLogicalOperandSizeMappings()
572 OS << "getLogicalOperandIdx(uint16_t Opcode, uint16_t LogicalOpIdx) {\n"; in emitLogicalOperandSizeMappings()
573 OS << " auto S = 0U;\n"; in emitLogicalOperandSizeMappings()
574 OS << " for (auto i = 0U; i < LogicalOpIdx; ++i)\n"; in emitLogicalOperandSizeMappings()
575 OS << " S += getLogicalOperandSize(Opcode, i);\n"; in emitLogicalOperandSizeMappings()
576 OS << " return S;\n"; in emitLogicalOperandSizeMappings()
577 OS << "}\n"; in emitLogicalOperandSizeMappings()
579 OS << "} // end namespace " << Namespace << "\n"; in emitLogicalOperandSizeMappings()
580 OS << "} // end namespace llvm\n"; in emitLogicalOperandSizeMappings()
581 OS << "#endif // GET_INSTRINFO_LOGICAL_OPERAND_SIZE_MAP\n\n"; in emitLogicalOperandSizeMappings()
585 raw_ostream &OS, StringRef Namespace, in emitLogicalOperandTypeMappings() argument
619 OS << "#ifdef GET_INSTRINFO_LOGICAL_OPERAND_TYPE_MAP\n"; in emitLogicalOperandTypeMappings()
620 OS << "#undef GET_INSTRINFO_LOGICAL_OPERAND_TYPE_MAP\n"; in emitLogicalOperandTypeMappings()
621 OS << "namespace llvm {\n"; in emitLogicalOperandTypeMappings()
622 OS << "namespace " << Namespace << " {\n"; in emitLogicalOperandTypeMappings()
623 OS << "LLVM_READONLY static int\n"; in emitLogicalOperandTypeMappings()
624 OS << "getLogicalOperandType(uint16_t Opcode, uint16_t LogicalOpIdx) {\n"; in emitLogicalOperandTypeMappings()
631 OS << " static const int TypeMap[][" << OpTypeListSize << "] = {\n"; in emitLogicalOperandTypeMappings()
634 OS << " {"; in emitLogicalOperandTypeMappings()
638 OS << ", "; in emitLogicalOperandTypeMappings()
639 OS << Row[i]; in emitLogicalOperandTypeMappings()
643 OS << ", "; in emitLogicalOperandTypeMappings()
644 OS << "-1"; in emitLogicalOperandTypeMappings()
646 OS << "}"; in emitLogicalOperandTypeMappings()
648 OS << ","; in emitLogicalOperandTypeMappings()
649 OS << "\n"; in emitLogicalOperandTypeMappings()
651 OS << " };\n"; in emitLogicalOperandTypeMappings()
653 OS << " switch (Opcode) {\n"; in emitLogicalOperandTypeMappings()
654 OS << " default: return -1;\n"; in emitLogicalOperandTypeMappings()
659 OS << " case " << Inst << ":\n"; in emitLogicalOperandTypeMappings()
661 OS << " return TypeMap[" << OpMapIdx << "][LogicalOpIdx];\n"; in emitLogicalOperandTypeMappings()
663 OS << " }\n"; in emitLogicalOperandTypeMappings()
665 OS << " return -1;\n"; in emitLogicalOperandTypeMappings()
667 OS << "}\n"; in emitLogicalOperandTypeMappings()
668 OS << "} // end namespace " << Namespace << "\n"; in emitLogicalOperandTypeMappings()
669 OS << "} // end namespace llvm\n"; in emitLogicalOperandTypeMappings()
670 OS << "#endif // GET_INSTRINFO_LOGICAL_OPERAND_TYPE_MAP\n\n"; in emitLogicalOperandTypeMappings()
673 void InstrInfoEmitter::emitMCIIHelperMethods(raw_ostream &OS, in emitMCIIHelperMethods() argument
677 OS << "#ifdef GET_INSTRINFO_MC_HELPER_DECLS\n"; in emitMCIIHelperMethods()
678 OS << "#undef GET_INSTRINFO_MC_HELPER_DECLS\n\n"; in emitMCIIHelperMethods()
680 OS << "namespace llvm {\n"; in emitMCIIHelperMethods()
681 OS << "class MCInst;\n"; in emitMCIIHelperMethods()
682 OS << "class FeatureBitset;\n\n"; in emitMCIIHelperMethods()
684 OS << "namespace " << TargetName << "_MC {\n\n"; in emitMCIIHelperMethods()
687 OS << "bool " << Rec->getValueAsString("FunctionName") in emitMCIIHelperMethods()
691 OS << "void verifyInstructionPredicates(unsigned Opcode, const FeatureBitset " in emitMCIIHelperMethods()
694 OS << "\n} // end namespace " << TargetName << "_MC\n"; in emitMCIIHelperMethods()
695 OS << "} // end namespace llvm\n\n"; in emitMCIIHelperMethods()
697 OS << "#endif // GET_INSTRINFO_MC_HELPER_DECLS\n\n"; in emitMCIIHelperMethods()
699 OS << "#ifdef GET_INSTRINFO_MC_HELPERS\n"; in emitMCIIHelperMethods()
700 OS << "#undef GET_INSTRINFO_MC_HELPERS\n\n"; in emitMCIIHelperMethods()
702 OS << "namespace llvm {\n"; in emitMCIIHelperMethods()
703 OS << "namespace " << TargetName << "_MC {\n\n"; in emitMCIIHelperMethods()
709 OS << "bool " << Rec->getValueAsString("FunctionName"); in emitMCIIHelperMethods()
710 OS << "(const MCInst &MI) {\n"; in emitMCIIHelperMethods()
712 OS.indent(PE.getIndentLevel() * 2); in emitMCIIHelperMethods()
713 PE.expandStatement(OS, Rec->getValueAsDef("Body")); in emitMCIIHelperMethods()
714 OS << "\n}\n\n"; in emitMCIIHelperMethods()
717 OS << "} // end namespace " << TargetName << "_MC\n"; in emitMCIIHelperMethods()
718 OS << "} // end namespace llvm\n\n"; in emitMCIIHelperMethods()
720 OS << "#endif // GET_GENISTRINFO_MC_HELPERS\n\n"; in emitMCIIHelperMethods()
731 void InstrInfoEmitter::emitFeatureVerifier(raw_ostream &OS, in emitFeatureVerifier() argument
737 OS << "#if (defined(ENABLE_INSTR_PREDICATE_VERIFIER) && !defined(NDEBUG)) " in emitFeatureVerifier()
742 OS << "#ifdef GET_COMPUTE_FEATURES\n" in emitFeatureVerifier()
749 OS); in emitFeatureVerifier()
751 OS << "inline "; in emitFeatureVerifier()
753 Target.getName(), "", "computeAvailableFeatures", SubtargetFeatures, OS); in emitFeatureVerifier()
782 OS << "inline FeatureBitset computeRequiredFeatures(unsigned Opcode) {\n" in emitFeatureVerifier()
788 OS << " " << getNameForFeatureBitset(FeatureBitset) << ",\n"; in emitFeatureVerifier()
790 OS << " };\n\n" in emitFeatureVerifier()
796 OS << " {"; in emitFeatureVerifier()
800 OS << I->second.getEnumBitName() << ", "; in emitFeatureVerifier()
802 OS << "},\n"; in emitFeatureVerifier()
804 OS << " };\n" in emitFeatureVerifier()
809 OS << " CEFBS"; in emitFeatureVerifier()
814 OS << '_' << I->second.TheDef->getName(); in emitFeatureVerifier()
819 OS << "_None"; in emitFeatureVerifier()
820 OS << ", // " << Inst->TheDef->getName() << " = " << InstIdx << "\n"; in emitFeatureVerifier()
823 OS << " };\n\n" in emitFeatureVerifier()
828 OS << "} // end namespace " << Target.getName() << "_MC\n" in emitFeatureVerifier()
832 OS << "#ifdef GET_AVAILABLE_OPCODE_CHECKER\n" in emitFeatureVerifier()
836 OS << "bool isOpcodeAvailable(" in emitFeatureVerifier()
847 OS << "} // end namespace " << Target.getName() << "_MC\n" in emitFeatureVerifier()
851 OS << "#ifdef ENABLE_INSTR_PREDICATE_VERIFIER\n" in emitFeatureVerifier()
855 OS << "namespace llvm {\n"; in emitFeatureVerifier()
856 OS << "namespace " << Target.getName() << "_MC {\n\n"; in emitFeatureVerifier()
859 OS << "#ifndef NDEBUG\n"; in emitFeatureVerifier()
860 SubtargetFeatureInfo::emitNameTable(SubtargetFeatures, OS); in emitFeatureVerifier()
861 OS << "#endif // NDEBUG\n\n"; in emitFeatureVerifier()
864 OS << "void verifyInstructionPredicates(\n" in emitFeatureVerifier()
867 OS << " FeatureBitset AvailableFeatures = " in emitFeatureVerifier()
869 OS << " FeatureBitset RequiredFeatures = " in emitFeatureVerifier()
871 OS << " FeatureBitset MissingFeatures =\n" in emitFeatureVerifier()
886 OS << "}\n"; in emitFeatureVerifier()
887 OS << "} // end namespace " << Target.getName() << "_MC\n"; in emitFeatureVerifier()
888 OS << "} // end namespace llvm\n"; in emitFeatureVerifier()
889 OS << "#endif // ENABLE_INSTR_PREDICATE_VERIFIER\n\n"; in emitFeatureVerifier()
892 void InstrInfoEmitter::emitTIIHelperMethods(raw_ostream &OS, in emitTIIHelperMethods() argument
903 OS << (ExpandDefinition ? "" : "static ") << "bool "; in emitTIIHelperMethods()
905 OS << TargetName << "InstrInfo::"; in emitTIIHelperMethods()
906 OS << Rec->getValueAsString("FunctionName"); in emitTIIHelperMethods()
907 OS << "(const MachineInstr &MI)"; in emitTIIHelperMethods()
909 OS << ";\n"; in emitTIIHelperMethods()
913 OS << " {\n"; in emitTIIHelperMethods()
914 OS.indent(PE.getIndentLevel() * 2); in emitTIIHelperMethods()
915 PE.expandStatement(OS, Rec->getValueAsDef("Body")); in emitTIIHelperMethods()
916 OS << "\n}\n\n"; in emitTIIHelperMethods()
925 void InstrInfoEmitter::run(raw_ostream &OS) { in run() argument
926 emitSourceFileHeader("Target Instruction Enum Values and Descriptors", OS); in run()
927 emitEnums(OS); in run()
956 OS << "#if defined(GET_INSTRINFO_MC_DESC) || " in run()
958 OS << "namespace llvm {\n\n"; in run()
960 OS << "struct " << TargetName << "InstrTable {\n"; in run()
961 OS << " MCInstrDesc Insts[" << NumberedInstructions.size() << "];\n"; in run()
962 OS << " static_assert(alignof(MCInstrDesc) >= alignof(MCOperandInfo), " in run()
964 OS << " MCOperandInfo OperandInfo[" << OperandInfoSize << "];\n"; in run()
965 OS << " static_assert(alignof(MCOperandInfo) >= alignof(MCPhysReg), " in run()
967 OS << " MCPhysReg ImplicitOps[" << std::max(ImplicitListSize, 1U) << "];\n"; in run()
968 OS << "};\n\n"; in run()
970 OS << "} // end namespace llvm\n"; in run()
971 OS << "#endif // defined(GET_INSTRINFO_MC_DESC) || " in run()
974 OS << "#ifdef GET_INSTRINFO_MC_DESC\n"; in run()
975 OS << "#undef GET_INSTRINFO_MC_DESC\n"; in run()
976 OS << "namespace llvm {\n\n"; in run()
980 OS << "static_assert(sizeof(MCOperandInfo) % sizeof(MCPhysReg) == 0);\n"; in run()
981 OS << "static constexpr unsigned " << TargetName << "ImpOpBase = sizeof " in run()
984 OS << "extern const " << TargetName << "InstrTable " << TargetName in run()
992 emitRecord(*Inst, --Num, InstrInfo, EmittedLists, OperandInfoMap, OS); in run()
995 OS << " }, {\n"; in run()
999 EmitOperandInfo(OS, OperandInfoList); in run()
1001 OS << " }, {\n"; in run()
1006 OS << " /* " << EmittedLists[List] << " */"; in run()
1008 OS << ' ' << getQualifiedName(Reg) << ','; in run()
1009 OS << '\n'; in run()
1012 OS << " }\n};\n\n"; in run()
1017 InstrNames.emitStringLiteralDef(OS, Twine("extern const char ") + TargetName + in run()
1020 OS << "extern const unsigned " << TargetName <<"InstrNameIndices[] = {"; in run()
1025 OS << "\n "; in run()
1026 OS << InstrNames.get(std::string(Inst->TheDef->getName())) << "U, "; in run()
1029 OS << "\n};\n\n"; in run()
1037 OS << "extern const uint8_t " << TargetName in run()
1042 OS << "\n "; in run()
1045 OS << Target.getInstNamespace() << "::" << Inst->DeprecatedReason in run()
1048 OS << "uint8_t(-1), "; in run()
1051 OS << "\n};\n\n"; in run()
1059 OS << "extern const MCInstrInfo::ComplexDeprecationPredicate " << TargetName in run()
1064 OS << "\n "; in run()
1067 OS << "&get" << Inst->DeprecatedReason << "DeprecationInfo, "; in run()
1069 OS << "nullptr, "; in run()
1072 OS << "\n};\n\n"; in run()
1077 OS << "static inline void Init" << TargetName in run()
1079 OS << " II->InitMCInstrInfo(" << TargetName << "Descs.Insts, " << TargetName in run()
1082 OS << TargetName << "InstrDeprecationFeatures, "; in run()
1084 OS << "nullptr, "; in run()
1086 OS << TargetName << "InstrComplexDeprecationInfos, "; in run()
1088 OS << "nullptr, "; in run()
1089 OS << NumberedInstructions.size() << ");\n}\n\n"; in run()
1091 OS << "} // end namespace llvm\n"; in run()
1093 OS << "#endif // GET_INSTRINFO_MC_DESC\n\n"; in run()
1096 OS << "#ifdef GET_INSTRINFO_HEADER\n"; in run()
1097 OS << "#undef GET_INSTRINFO_HEADER\n"; in run()
1100 OS << "namespace llvm {\n"; in run()
1101 OS << "struct " << ClassName << " : public TargetInstrInfo {\n" in run()
1108 OS << "\n};\n} // end namespace llvm\n"; in run()
1110 OS << "#endif // GET_INSTRINFO_HEADER\n\n"; in run()
1112 OS << "#ifdef GET_INSTRINFO_HELPER_DECLS\n"; in run()
1113 OS << "#undef GET_INSTRINFO_HELPER_DECLS\n\n"; in run()
1114 emitTIIHelperMethods(OS, TargetName, /* ExpandDefinition = */ false); in run()
1115 OS << "\n"; in run()
1116 OS << "#endif // GET_INSTRINFO_HELPER_DECLS\n\n"; in run()
1118 OS << "#ifdef GET_INSTRINFO_HELPERS\n"; in run()
1119 OS << "#undef GET_INSTRINFO_HELPERS\n\n"; in run()
1120 emitTIIHelperMethods(OS, TargetName, /* ExpandDefinition = */ true); in run()
1121 OS << "#endif // GET_INSTRINFO_HELPERS\n\n"; in run()
1123 OS << "#ifdef GET_INSTRINFO_CTOR_DTOR\n"; in run()
1124 OS << "#undef GET_INSTRINFO_CTOR_DTOR\n"; in run()
1126 OS << "namespace llvm {\n"; in run()
1127 OS << "extern const " << TargetName << "InstrTable " << TargetName in run()
1129 OS << "extern const unsigned " << TargetName << "InstrNameIndices[];\n"; in run()
1130 OS << "extern const char " << TargetName << "InstrNameData[];\n"; in run()
1132 OS << "extern const uint8_t " << TargetName in run()
1135 OS << "extern const MCInstrInfo::ComplexDeprecationPredicate " << TargetName in run()
1137 OS << ClassName << "::" << ClassName in run()
1145 OS << TargetName << "InstrDeprecationFeatures, "; in run()
1147 OS << "nullptr, "; in run()
1149 OS << TargetName << "InstrComplexDeprecationInfos, "; in run()
1151 OS << "nullptr, "; in run()
1152 OS << NumberedInstructions.size() << ");\n}\n"; in run()
1153 OS << "} // end namespace llvm\n"; in run()
1155 OS << "#endif // GET_INSTRINFO_CTOR_DTOR\n\n"; in run()
1158 emitOperandNameMappings(OS, Target, NumberedInstructions); in run()
1161 emitOperandTypeMappings(OS, Target, NumberedInstructions); in run()
1164 emitLogicalOperandSizeMappings(OS, TargetName, NumberedInstructions); in run()
1167 emitLogicalOperandTypeMappings(OS, TargetName, NumberedInstructions); in run()
1170 emitMCIIHelperMethods(OS, TargetName); in run()
1173 emitFeatureVerifier(OS, Target); in run()
1179 const OperandInfoMapTy &OperandInfoMap, raw_ostream &OS) { in emitRecord() argument
1186 OS << " { "; in emitRecord()
1187 OS << Num << ",\t" << MinOperands << ",\t" << Inst.Operands.NumDefs << ",\t" in emitRecord()
1194 OS << Inst.ImplicitUses.size() << ",\t" << Inst.ImplicitDefs.size() << ",\t"; in emitRecord()
1197 OS << Target.getName() << "ImpOpBase + " << EmittedLists[ImplicitOps] in emitRecord()
1202 OS << OperandInfoMap.find(OperandInfo)->second << ",\t0"; in emitRecord()
1205 if (Inst.isPreISelOpcode) OS << "|(1ULL<<MCID::PreISelOpcode)"; in emitRecord()
1206 if (Inst.isPseudo) OS << "|(1ULL<<MCID::Pseudo)"; in emitRecord()
1207 if (Inst.isMeta) OS << "|(1ULL<<MCID::Meta)"; in emitRecord()
1208 if (Inst.isReturn) OS << "|(1ULL<<MCID::Return)"; in emitRecord()
1209 if (Inst.isEHScopeReturn) OS << "|(1ULL<<MCID::EHScopeReturn)"; in emitRecord()
1210 if (Inst.isBranch) OS << "|(1ULL<<MCID::Branch)"; in emitRecord()
1211 if (Inst.isIndirectBranch) OS << "|(1ULL<<MCID::IndirectBranch)"; in emitRecord()
1212 if (Inst.isCompare) OS << "|(1ULL<<MCID::Compare)"; in emitRecord()
1213 if (Inst.isMoveImm) OS << "|(1ULL<<MCID::MoveImm)"; in emitRecord()
1214 if (Inst.isMoveReg) OS << "|(1ULL<<MCID::MoveReg)"; in emitRecord()
1215 if (Inst.isBitcast) OS << "|(1ULL<<MCID::Bitcast)"; in emitRecord()
1216 if (Inst.isAdd) OS << "|(1ULL<<MCID::Add)"; in emitRecord()
1217 if (Inst.isTrap) OS << "|(1ULL<<MCID::Trap)"; in emitRecord()
1218 if (Inst.isSelect) OS << "|(1ULL<<MCID::Select)"; in emitRecord()
1219 if (Inst.isBarrier) OS << "|(1ULL<<MCID::Barrier)"; in emitRecord()
1220 if (Inst.hasDelaySlot) OS << "|(1ULL<<MCID::DelaySlot)"; in emitRecord()
1221 if (Inst.isCall) OS << "|(1ULL<<MCID::Call)"; in emitRecord()
1222 if (Inst.canFoldAsLoad) OS << "|(1ULL<<MCID::FoldableAsLoad)"; in emitRecord()
1223 if (Inst.mayLoad) OS << "|(1ULL<<MCID::MayLoad)"; in emitRecord()
1224 if (Inst.mayStore) OS << "|(1ULL<<MCID::MayStore)"; in emitRecord()
1225 if (Inst.mayRaiseFPException) OS << "|(1ULL<<MCID::MayRaiseFPException)"; in emitRecord()
1226 if (Inst.isPredicable) OS << "|(1ULL<<MCID::Predicable)"; in emitRecord()
1227 if (Inst.isConvertibleToThreeAddress) OS << "|(1ULL<<MCID::ConvertibleTo3Addr)"; in emitRecord()
1228 if (Inst.isCommutable) OS << "|(1ULL<<MCID::Commutable)"; in emitRecord()
1229 if (Inst.isTerminator) OS << "|(1ULL<<MCID::Terminator)"; in emitRecord()
1230 if (Inst.isReMaterializable) OS << "|(1ULL<<MCID::Rematerializable)"; in emitRecord()
1231 if (Inst.isNotDuplicable) OS << "|(1ULL<<MCID::NotDuplicable)"; in emitRecord()
1232 if (Inst.Operands.hasOptionalDef) OS << "|(1ULL<<MCID::HasOptionalDef)"; in emitRecord()
1233 if (Inst.usesCustomInserter) OS << "|(1ULL<<MCID::UsesCustomInserter)"; in emitRecord()
1234 if (Inst.hasPostISelHook) OS << "|(1ULL<<MCID::HasPostISelHook)"; in emitRecord()
1235 if (Inst.Operands.isVariadic)OS << "|(1ULL<<MCID::Variadic)"; in emitRecord()
1236 if (Inst.hasSideEffects) OS << "|(1ULL<<MCID::UnmodeledSideEffects)"; in emitRecord()
1237 if (Inst.isAsCheapAsAMove) OS << "|(1ULL<<MCID::CheapAsAMove)"; in emitRecord()
1239 OS << "|(1ULL<<MCID::ExtraSrcRegAllocReq)"; in emitRecord()
1241 OS << "|(1ULL<<MCID::ExtraDefRegAllocReq)"; in emitRecord()
1242 if (Inst.isRegSequence) OS << "|(1ULL<<MCID::RegSequence)"; in emitRecord()
1243 if (Inst.isExtractSubreg) OS << "|(1ULL<<MCID::ExtractSubreg)"; in emitRecord()
1244 if (Inst.isInsertSubreg) OS << "|(1ULL<<MCID::InsertSubreg)"; in emitRecord()
1245 if (Inst.isConvergent) OS << "|(1ULL<<MCID::Convergent)"; in emitRecord()
1246 if (Inst.variadicOpsAreDefs) OS << "|(1ULL<<MCID::VariadicOpsAreDefs)"; in emitRecord()
1247 if (Inst.isAuthenticated) OS << "|(1ULL<<MCID::Authenticated)"; in emitRecord()
1261 OS << ", 0x"; in emitRecord()
1262 OS.write_hex(Value); in emitRecord()
1263 OS << "ULL"; in emitRecord()
1265 OS << " }, // Inst #" << Num << " = " << Inst.TheDef->getName() << "\n"; in emitRecord()
1269 void InstrInfoEmitter::emitEnums(raw_ostream &OS) { in emitEnums() argument
1270 OS << "#ifdef GET_INSTRINFO_ENUM\n"; in emitEnums()
1271 OS << "#undef GET_INSTRINFO_ENUM\n"; in emitEnums()
1273 OS << "namespace llvm {\n\n"; in emitEnums()
1283 OS << "namespace " << Namespace << " {\n"; in emitEnums()
1284 OS << " enum {\n"; in emitEnums()
1287 OS << " " << Inst->TheDef->getName() << "\t= " << Num++ << ",\n"; in emitEnums()
1288 OS << " INSTRUCTION_LIST_END = " << Num << "\n"; in emitEnums()
1289 OS << " };\n\n"; in emitEnums()
1290 OS << "} // end namespace " << Namespace << "\n"; in emitEnums()
1291 OS << "} // end namespace llvm\n"; in emitEnums()
1292 OS << "#endif // GET_INSTRINFO_ENUM\n\n"; in emitEnums()
1294 OS << "#ifdef GET_INSTRINFO_SCHED_ENUM\n"; in emitEnums()
1295 OS << "#undef GET_INSTRINFO_SCHED_ENUM\n"; in emitEnums()
1296 OS << "namespace llvm {\n\n"; in emitEnums()
1297 OS << "namespace " << Namespace << " {\n"; in emitEnums()
1298 OS << "namespace Sched {\n"; in emitEnums()
1299 OS << " enum {\n"; in emitEnums()
1302 OS << " " << Class.Name << "\t= " << Num++ << ",\n"; in emitEnums()
1303 OS << " SCHED_LIST_END = " << Num << "\n"; in emitEnums()
1304 OS << " };\n"; in emitEnums()
1305 OS << "} // end namespace Sched\n"; in emitEnums()
1306 OS << "} // end namespace " << Namespace << "\n"; in emitEnums()
1307 OS << "} // end namespace llvm\n"; in emitEnums()
1309 OS << "#endif // GET_INSTRINFO_SCHED_ENUM\n\n"; in emitEnums()
1312 static void EmitInstrInfo(RecordKeeper &RK, raw_ostream &OS) { in EmitInstrInfo() argument
1314 InstrInfoEmitter(RK).run(OS); in EmitInstrInfo()
1316 EmitMapTable(RK, OS); in EmitInstrInfo()