Lines Matching refs:OS

59   void run(raw_ostream &OS);
62 void emitEnums(raw_ostream &OS);
78 void emitTIIHelperMethods(raw_ostream &OS, StringRef TargetName,
83 void emitMCIIHelperMethods(raw_ostream &OS, StringRef TargetName);
86 void emitFeatureVerifier(raw_ostream &OS, const CodeGenTarget &Target);
91 raw_ostream &OS);
93 raw_ostream &OS, const CodeGenTarget &Target,
100 void emitOperandNameMappings(raw_ostream &OS, const CodeGenTarget &Target,
104 raw_ostream &OS, StringRef Namespace,
107 raw_ostream &OS, StringRef Namespace,
111 void EmitOperandInfo(raw_ostream &OS, OperandInfoMapTy &OperandInfoIDs);
118 unsigned Num, raw_ostream &OS) { in PrintDefList() argument
119 OS << "static const MCPhysReg ImplicitList" << Num << "[] = { "; in PrintDefList()
121 OS << getQualifiedName(U) << ", "; in PrintDefList()
122 OS << "0 };\n"; in PrintDefList()
218 void InstrInfoEmitter::EmitOperandInfo(raw_ostream &OS, in EmitOperandInfo() argument
224 OS << "\n"; in EmitOperandInfo()
232 OS << "static const MCOperandInfo OperandInfo" << N << "[] = { "; in EmitOperandInfo()
234 OS << "{ " << Info << " }, "; in EmitOperandInfo()
235 OS << "};\n"; in EmitOperandInfo()
281 void InstrInfoEmitter::emitOperandNameMappings(raw_ostream &OS, in emitOperandNameMappings() argument
293 OS << "#ifdef GET_INSTRINFO_OPERAND_ENUM\n"; in emitOperandNameMappings()
294 OS << "#undef GET_INSTRINFO_OPERAND_ENUM\n"; in emitOperandNameMappings()
295 OS << "namespace llvm {\n"; in emitOperandNameMappings()
296 OS << "namespace " << Namespace << " {\n"; in emitOperandNameMappings()
297 OS << "namespace " << OpNameNS << " {\n"; in emitOperandNameMappings()
298 OS << "enum {\n"; in emitOperandNameMappings()
300 OS << " " << Op.first << " = " << Op.second << ",\n"; in emitOperandNameMappings()
302 OS << " OPERAND_LAST"; in emitOperandNameMappings()
303 OS << "\n};\n"; in emitOperandNameMappings()
304 OS << "} // end namespace OpName\n"; in emitOperandNameMappings()
305 OS << "} // end namespace " << Namespace << "\n"; in emitOperandNameMappings()
306 OS << "} // end namespace llvm\n"; in emitOperandNameMappings()
307 OS << "#endif //GET_INSTRINFO_OPERAND_ENUM\n\n"; in emitOperandNameMappings()
309 OS << "#ifdef GET_INSTRINFO_NAMED_OPS\n"; in emitOperandNameMappings()
310 OS << "#undef GET_INSTRINFO_NAMED_OPS\n"; in emitOperandNameMappings()
311 OS << "namespace llvm {\n"; in emitOperandNameMappings()
312 OS << "namespace " << Namespace << " {\n"; in emitOperandNameMappings()
313 OS << "LLVM_READONLY\n"; in emitOperandNameMappings()
314 OS << "int16_t getNamedOperandIdx(uint16_t Opcode, uint16_t NamedIdx) {\n"; in emitOperandNameMappings()
316 OS << " static const int16_t OperandMap [][" << Operands.size() in emitOperandNameMappings()
320 OS << "{"; in emitOperandNameMappings()
324 OS << (OpList.count(i) == 0 ? -1 : (int)OpList.find(i)->second) << ", "; in emitOperandNameMappings()
326 OS << "},\n"; in emitOperandNameMappings()
328 OS << "};\n"; in emitOperandNameMappings()
330 OS << " switch(Opcode) {\n"; in emitOperandNameMappings()
334 OS << " case " << Name << ":\n"; in emitOperandNameMappings()
336 OS << " return OperandMap[" << TableIndex++ << "][NamedIdx];\n"; in emitOperandNameMappings()
338 OS << " default: return -1;\n"; in emitOperandNameMappings()
339 OS << " }\n"; in emitOperandNameMappings()
342 OS << " return -1;\n"; in emitOperandNameMappings()
344 OS << "}\n"; in emitOperandNameMappings()
345 OS << "} // end namespace " << Namespace << "\n"; in emitOperandNameMappings()
346 OS << "} // end namespace llvm\n"; in emitOperandNameMappings()
347 OS << "#endif //GET_INSTRINFO_NAMED_OPS\n\n"; in emitOperandNameMappings()
354 raw_ostream &OS, const CodeGenTarget &Target, in emitOperandTypeMappings() argument
364 OS << "#ifdef GET_INSTRINFO_OPERAND_TYPES_ENUM\n"; in emitOperandTypeMappings()
365 OS << "#undef GET_INSTRINFO_OPERAND_TYPES_ENUM\n"; in emitOperandTypeMappings()
366 OS << "namespace llvm {\n"; in emitOperandTypeMappings()
367 OS << "namespace " << Namespace << " {\n"; in emitOperandTypeMappings()
368 OS << "namespace OpTypes {\n"; in emitOperandTypeMappings()
369 OS << "enum OperandType {\n"; in emitOperandTypeMappings()
376 OS << " " << Op->getName() << " = " << EnumVal << ",\n"; in emitOperandTypeMappings()
381 OS << " OPERAND_TYPE_LIST_END" << "\n};\n"; in emitOperandTypeMappings()
382 OS << "} // end namespace OpTypes\n"; in emitOperandTypeMappings()
383 OS << "} // end namespace " << Namespace << "\n"; in emitOperandTypeMappings()
384 OS << "} // end namespace llvm\n"; in emitOperandTypeMappings()
385 OS << "#endif // GET_INSTRINFO_OPERAND_TYPES_ENUM\n\n"; in emitOperandTypeMappings()
387 OS << "#ifdef GET_INSTRINFO_OPERAND_TYPE\n"; in emitOperandTypeMappings()
388 OS << "#undef GET_INSTRINFO_OPERAND_TYPE\n"; in emitOperandTypeMappings()
389 OS << "namespace llvm {\n"; in emitOperandTypeMappings()
390 OS << "namespace " << Namespace << " {\n"; in emitOperandTypeMappings()
391 OS << "LLVM_READONLY\n"; in emitOperandTypeMappings()
392 OS << "static int getOperandType(uint16_t Opcode, uint16_t OpIdx) {\n"; in emitOperandTypeMappings()
422 OS << ((OperandRecords.size() <= UINT16_MAX) ? " const uint16_t" in emitOperandTypeMappings()
424 OS << " Offsets[] = {\n"; in emitOperandTypeMappings()
426 OS << " /* " << getInstrName(I) << " */\n"; in emitOperandTypeMappings()
427 OS << " " << OperandOffsets[I] << ",\n"; in emitOperandTypeMappings()
429 OS << " };\n"; in emitOperandTypeMappings()
438 OS << "\n using namespace OpTypes;\n"; in emitOperandTypeMappings()
439 OS << ((EnumVal <= INT8_MAX) ? " const int8_t" : " const int16_t"); in emitOperandTypeMappings()
440 OS << " OpcodeOperandTypes[] = {\n "; in emitOperandTypeMappings()
444 OS << "\n /* " << getInstrName(CurOffset) << " */\n "; in emitOperandTypeMappings()
446 OS << "/* " << getInstrName(CurOffset) << " */\n "; in emitOperandTypeMappings()
453 OS << OpR->getName(); in emitOperandTypeMappings()
455 OS << -1; in emitOperandTypeMappings()
456 OS << ", "; in emitOperandTypeMappings()
458 OS << "\n };\n"; in emitOperandTypeMappings()
460 OS << " return OpcodeOperandTypes[Offsets[Opcode] + OpIdx];\n"; in emitOperandTypeMappings()
462 OS << " llvm_unreachable(\"No instructions defined\");\n"; in emitOperandTypeMappings()
464 OS << "}\n"; in emitOperandTypeMappings()
465 OS << "} // end namespace " << Namespace << "\n"; in emitOperandTypeMappings()
466 OS << "} // end namespace llvm\n"; in emitOperandTypeMappings()
467 OS << "#endif // GET_INSTRINFO_OPERAND_TYPE\n\n"; in emitOperandTypeMappings()
469 OS << "#ifdef GET_INSTRINFO_MEM_OPERAND_SIZE\n"; in emitOperandTypeMappings()
470 OS << "#undef GET_INSTRINFO_MEM_OPERAND_SIZE\n"; in emitOperandTypeMappings()
471 OS << "namespace llvm {\n"; in emitOperandTypeMappings()
472 OS << "namespace " << Namespace << " {\n"; in emitOperandTypeMappings()
473 OS << "LLVM_READONLY\n"; in emitOperandTypeMappings()
474 OS << "static int getMemOperandSize(int OpType) {\n"; in emitOperandTypeMappings()
475 OS << " switch (OpType) {\n"; in emitOperandTypeMappings()
483 OS << " default: return 0;\n"; in emitOperandTypeMappings()
486 OS << " case OpTypes::" << OperandName << ":\n"; in emitOperandTypeMappings()
487 OS << " return " << KV.first << ";\n\n"; in emitOperandTypeMappings()
489 OS << " }\n}\n"; in emitOperandTypeMappings()
490 OS << "} // end namespace " << Namespace << "\n"; in emitOperandTypeMappings()
491 OS << "} // end namespace llvm\n"; in emitOperandTypeMappings()
492 OS << "#endif // GET_INSTRINFO_MEM_OPERAND_SIZE\n\n"; in emitOperandTypeMappings()
496 raw_ostream &OS, StringRef Namespace, in emitLogicalOperandSizeMappings() argument
524 OS << "#ifdef GET_INSTRINFO_LOGICAL_OPERAND_SIZE_MAP\n"; in emitLogicalOperandSizeMappings()
525 OS << "#undef GET_INSTRINFO_LOGICAL_OPERAND_SIZE_MAP\n"; in emitLogicalOperandSizeMappings()
526 OS << "namespace llvm {\n"; in emitLogicalOperandSizeMappings()
527 OS << "namespace " << Namespace << " {\n"; in emitLogicalOperandSizeMappings()
528 OS << "LLVM_READONLY static unsigned\n"; in emitLogicalOperandSizeMappings()
529 OS << "getLogicalOperandSize(uint16_t Opcode, uint16_t LogicalOpIdx) {\n"; in emitLogicalOperandSizeMappings()
536 OS << " static const unsigned SizeMap[][" << LogicalOpListSize in emitLogicalOperandSizeMappings()
540 OS << " {"; in emitLogicalOperandSizeMappings()
543 OS << Row[i] << ", "; in emitLogicalOperandSizeMappings()
546 OS << "0, "; in emitLogicalOperandSizeMappings()
548 OS << "}, "; in emitLogicalOperandSizeMappings()
549 OS << "\n"; in emitLogicalOperandSizeMappings()
551 OS << " };\n"; in emitLogicalOperandSizeMappings()
553 OS << " switch (Opcode) {\n"; in emitLogicalOperandSizeMappings()
554 OS << " default: return LogicalOpIdx;\n"; in emitLogicalOperandSizeMappings()
559 OS << " case " << Inst << ":\n"; in emitLogicalOperandSizeMappings()
561 OS << " return SizeMap[" << OpMapIdx << "][LogicalOpIdx];\n"; in emitLogicalOperandSizeMappings()
563 OS << " }\n"; in emitLogicalOperandSizeMappings()
565 OS << " return LogicalOpIdx;\n"; in emitLogicalOperandSizeMappings()
567 OS << "}\n"; in emitLogicalOperandSizeMappings()
569 OS << "LLVM_READONLY static inline unsigned\n"; in emitLogicalOperandSizeMappings()
570 OS << "getLogicalOperandIdx(uint16_t Opcode, uint16_t LogicalOpIdx) {\n"; in emitLogicalOperandSizeMappings()
571 OS << " auto S = 0U;\n"; in emitLogicalOperandSizeMappings()
572 OS << " for (auto i = 0U; i < LogicalOpIdx; ++i)\n"; in emitLogicalOperandSizeMappings()
573 OS << " S += getLogicalOperandSize(Opcode, i);\n"; in emitLogicalOperandSizeMappings()
574 OS << " return S;\n"; in emitLogicalOperandSizeMappings()
575 OS << "}\n"; in emitLogicalOperandSizeMappings()
577 OS << "} // end namespace " << Namespace << "\n"; in emitLogicalOperandSizeMappings()
578 OS << "} // end namespace llvm\n"; in emitLogicalOperandSizeMappings()
579 OS << "#endif // GET_INSTRINFO_LOGICAL_OPERAND_SIZE_MAP\n\n"; in emitLogicalOperandSizeMappings()
583 raw_ostream &OS, StringRef Namespace, in emitLogicalOperandTypeMappings() argument
617 OS << "#ifdef GET_INSTRINFO_LOGICAL_OPERAND_TYPE_MAP\n"; in emitLogicalOperandTypeMappings()
618 OS << "#undef GET_INSTRINFO_LOGICAL_OPERAND_TYPE_MAP\n"; in emitLogicalOperandTypeMappings()
619 OS << "namespace llvm {\n"; in emitLogicalOperandTypeMappings()
620 OS << "namespace " << Namespace << " {\n"; in emitLogicalOperandTypeMappings()
621 OS << "LLVM_READONLY static int\n"; in emitLogicalOperandTypeMappings()
622 OS << "getLogicalOperandType(uint16_t Opcode, uint16_t LogicalOpIdx) {\n"; in emitLogicalOperandTypeMappings()
629 OS << " static const int TypeMap[][" << OpTypeListSize << "] = {\n"; in emitLogicalOperandTypeMappings()
632 OS << " {"; in emitLogicalOperandTypeMappings()
636 OS << ", "; in emitLogicalOperandTypeMappings()
637 OS << Row[i]; in emitLogicalOperandTypeMappings()
641 OS << ", "; in emitLogicalOperandTypeMappings()
642 OS << "-1"; in emitLogicalOperandTypeMappings()
644 OS << "}"; in emitLogicalOperandTypeMappings()
646 OS << ","; in emitLogicalOperandTypeMappings()
647 OS << "\n"; in emitLogicalOperandTypeMappings()
649 OS << " };\n"; in emitLogicalOperandTypeMappings()
651 OS << " switch (Opcode) {\n"; in emitLogicalOperandTypeMappings()
652 OS << " default: return -1;\n"; in emitLogicalOperandTypeMappings()
657 OS << " case " << Inst << ":\n"; in emitLogicalOperandTypeMappings()
659 OS << " return TypeMap[" << OpMapIdx << "][LogicalOpIdx];\n"; in emitLogicalOperandTypeMappings()
661 OS << " }\n"; in emitLogicalOperandTypeMappings()
663 OS << " return -1;\n"; in emitLogicalOperandTypeMappings()
665 OS << "}\n"; in emitLogicalOperandTypeMappings()
666 OS << "} // end namespace " << Namespace << "\n"; in emitLogicalOperandTypeMappings()
667 OS << "} // end namespace llvm\n"; in emitLogicalOperandTypeMappings()
668 OS << "#endif // GET_INSTRINFO_LOGICAL_OPERAND_TYPE_MAP\n\n"; in emitLogicalOperandTypeMappings()
671 void InstrInfoEmitter::emitMCIIHelperMethods(raw_ostream &OS, in emitMCIIHelperMethods() argument
675 OS << "#ifdef GET_INSTRINFO_MC_HELPER_DECLS\n"; in emitMCIIHelperMethods()
676 OS << "#undef GET_INSTRINFO_MC_HELPER_DECLS\n\n"; in emitMCIIHelperMethods()
678 OS << "namespace llvm {\n"; in emitMCIIHelperMethods()
679 OS << "class MCInst;\n"; in emitMCIIHelperMethods()
680 OS << "class FeatureBitset;\n\n"; in emitMCIIHelperMethods()
682 OS << "namespace " << TargetName << "_MC {\n\n"; in emitMCIIHelperMethods()
685 OS << "bool " << Rec->getValueAsString("FunctionName") in emitMCIIHelperMethods()
689 OS << "void verifyInstructionPredicates(unsigned Opcode, const FeatureBitset " in emitMCIIHelperMethods()
692 OS << "\n} // end namespace " << TargetName << "_MC\n"; in emitMCIIHelperMethods()
693 OS << "} // end namespace llvm\n\n"; in emitMCIIHelperMethods()
695 OS << "#endif // GET_INSTRINFO_MC_HELPER_DECLS\n\n"; in emitMCIIHelperMethods()
697 OS << "#ifdef GET_INSTRINFO_MC_HELPERS\n"; in emitMCIIHelperMethods()
698 OS << "#undef GET_INSTRINFO_MC_HELPERS\n\n"; in emitMCIIHelperMethods()
700 OS << "namespace llvm {\n"; in emitMCIIHelperMethods()
701 OS << "namespace " << TargetName << "_MC {\n\n"; in emitMCIIHelperMethods()
707 OS << "bool " << Rec->getValueAsString("FunctionName"); in emitMCIIHelperMethods()
708 OS << "(const MCInst &MI) {\n"; in emitMCIIHelperMethods()
710 OS.indent(PE.getIndentLevel() * 2); in emitMCIIHelperMethods()
711 PE.expandStatement(OS, Rec->getValueAsDef("Body")); in emitMCIIHelperMethods()
712 OS << "\n}\n\n"; in emitMCIIHelperMethods()
715 OS << "} // end namespace " << TargetName << "_MC\n"; in emitMCIIHelperMethods()
716 OS << "} // end namespace llvm\n\n"; in emitMCIIHelperMethods()
718 OS << "#endif // GET_GENISTRINFO_MC_HELPERS\n\n"; in emitMCIIHelperMethods()
729 void InstrInfoEmitter::emitFeatureVerifier(raw_ostream &OS, in emitFeatureVerifier() argument
735 OS << "#ifdef ENABLE_INSTR_PREDICATE_VERIFIER\n" in emitFeatureVerifier()
739 OS << "namespace llvm {\n"; in emitFeatureVerifier()
740 OS << "namespace " << Target.getName() << "_MC {\n\n"; in emitFeatureVerifier()
744 OS); in emitFeatureVerifier()
747 OS << "#ifndef NDEBUG\n"; in emitFeatureVerifier()
748 SubtargetFeatureInfo::emitNameTable(SubtargetFeatures, OS); in emitFeatureVerifier()
749 OS << "#endif // NDEBUG\n\n"; in emitFeatureVerifier()
753 Target.getName(), "", "computeAvailableFeatures", SubtargetFeatures, OS); in emitFeatureVerifier()
782 OS << "#ifndef NDEBUG\n" in emitFeatureVerifier()
789 OS << " " << getNameForFeatureBitset(FeatureBitset) << ",\n"; in emitFeatureVerifier()
791 OS << "};\n\n" in emitFeatureVerifier()
797 OS << " {"; in emitFeatureVerifier()
801 OS << I->second.getEnumBitName() << ", "; in emitFeatureVerifier()
803 OS << "},\n"; in emitFeatureVerifier()
805 OS << "};\n" in emitFeatureVerifier()
809 OS << "void verifyInstructionPredicates(\n" in emitFeatureVerifier()
816 OS << " CEFBS"; in emitFeatureVerifier()
821 OS << '_' << I->second.TheDef->getName(); in emitFeatureVerifier()
826 OS << "_None"; in emitFeatureVerifier()
827 OS << ", // " << Inst->TheDef->getName() << " = " << InstIdx << "\n"; in emitFeatureVerifier()
830 OS << " };\n\n"; in emitFeatureVerifier()
831 OS << " assert(Opcode < " << InstIdx << ");\n"; in emitFeatureVerifier()
832 OS << " FeatureBitset AvailableFeatures = " in emitFeatureVerifier()
834 OS << " const FeatureBitset &RequiredFeatures = " in emitFeatureVerifier()
836 OS << " FeatureBitset MissingFeatures =\n" in emitFeatureVerifier()
851 OS << "}\n"; in emitFeatureVerifier()
852 OS << "} // end namespace " << Target.getName() << "_MC\n"; in emitFeatureVerifier()
853 OS << "} // end namespace llvm\n"; in emitFeatureVerifier()
854 OS << "#endif // ENABLE_INSTR_PREDICATE_VERIFIER\n\n"; in emitFeatureVerifier()
857 void InstrInfoEmitter::emitTIIHelperMethods(raw_ostream &OS, in emitTIIHelperMethods() argument
868 OS << (ExpandDefinition ? "" : "static ") << "bool "; in emitTIIHelperMethods()
870 OS << TargetName << "InstrInfo::"; in emitTIIHelperMethods()
871 OS << Rec->getValueAsString("FunctionName"); in emitTIIHelperMethods()
872 OS << "(const MachineInstr &MI)"; in emitTIIHelperMethods()
874 OS << ";\n"; in emitTIIHelperMethods()
878 OS << " {\n"; in emitTIIHelperMethods()
879 OS.indent(PE.getIndentLevel() * 2); in emitTIIHelperMethods()
880 PE.expandStatement(OS, Rec->getValueAsDef("Body")); in emitTIIHelperMethods()
881 OS << "\n}\n\n"; in emitTIIHelperMethods()
890 void InstrInfoEmitter::run(raw_ostream &OS) { in run() argument
891 emitSourceFileHeader("Target Instruction Enum Values and Descriptors", OS); in run()
892 emitEnums(OS); in run()
894 OS << "#ifdef GET_INSTRINFO_MC_DESC\n"; in run()
895 OS << "#undef GET_INSTRINFO_MC_DESC\n"; in run()
897 OS << "namespace llvm {\n\n"; in run()
914 if (!IL) PrintDefList(Uses, IL = ++ListNumber, OS); in run()
919 if (!IL) PrintDefList(Defs, IL = ++ListNumber, OS); in run()
927 EmitOperandInfo(OS, OperandInfoIDs); in run()
932 OS << "\nextern const MCInstrDesc " << TargetName << "Insts[] = {\n"; in run()
942 emitRecord(*Inst, Num++, InstrInfo, EmittedLists, OperandInfoIDs, OS); in run()
944 OS << "};\n\n"; in run()
949 InstrNames.emitStringLiteralDef(OS, Twine("extern const char ") + TargetName + in run()
952 OS << "extern const unsigned " << TargetName <<"InstrNameIndices[] = {"; in run()
957 OS << "\n "; in run()
958 OS << InstrNames.get(std::string(Inst->TheDef->getName())) << "U, "; in run()
961 OS << "\n};\n\n"; in run()
969 OS << "extern const uint8_t " << TargetName in run()
974 OS << "\n "; in run()
977 OS << Target.getInstNamespace() << "::" << Inst->DeprecatedReason in run()
980 OS << "uint8_t(-1), "; in run()
983 OS << "\n};\n\n"; in run()
991 OS << "extern const MCInstrInfo::ComplexDeprecationPredicate " << TargetName in run()
996 OS << "\n "; in run()
999 OS << "&get" << Inst->DeprecatedReason << "DeprecationInfo, "; in run()
1001 OS << "nullptr, "; in run()
1004 OS << "\n};\n\n"; in run()
1009 OS << "static inline void Init" << TargetName in run()
1011 OS << " II->InitMCInstrInfo(" << TargetName << "Insts, " << TargetName in run()
1014 OS << TargetName << "InstrDeprecationFeatures, "; in run()
1016 OS << "nullptr, "; in run()
1018 OS << TargetName << "InstrComplexDeprecationInfos, "; in run()
1020 OS << "nullptr, "; in run()
1021 OS << NumberedInstructions.size() << ");\n}\n\n"; in run()
1023 OS << "} // end namespace llvm\n"; in run()
1025 OS << "#endif // GET_INSTRINFO_MC_DESC\n\n"; in run()
1028 OS << "#ifdef GET_INSTRINFO_HEADER\n"; in run()
1029 OS << "#undef GET_INSTRINFO_HEADER\n"; in run()
1032 OS << "namespace llvm {\n"; in run()
1033 OS << "struct " << ClassName << " : public TargetInstrInfo {\n" in run()
1039 OS << "\n};\n} // end namespace llvm\n"; in run()
1041 OS << "#endif // GET_INSTRINFO_HEADER\n\n"; in run()
1043 OS << "#ifdef GET_INSTRINFO_HELPER_DECLS\n"; in run()
1044 OS << "#undef GET_INSTRINFO_HELPER_DECLS\n\n"; in run()
1045 emitTIIHelperMethods(OS, TargetName, /* ExpandDefinition = */ false); in run()
1046 OS << "\n"; in run()
1047 OS << "#endif // GET_INSTRINFO_HELPER_DECLS\n\n"; in run()
1049 OS << "#ifdef GET_INSTRINFO_HELPERS\n"; in run()
1050 OS << "#undef GET_INSTRINFO_HELPERS\n\n"; in run()
1051 emitTIIHelperMethods(OS, TargetName, /* ExpandDefinition = */ true); in run()
1052 OS << "#endif // GET_INSTRINFO_HELPERS\n\n"; in run()
1054 OS << "#ifdef GET_INSTRINFO_CTOR_DTOR\n"; in run()
1055 OS << "#undef GET_INSTRINFO_CTOR_DTOR\n"; in run()
1057 OS << "namespace llvm {\n"; in run()
1058 OS << "extern const MCInstrDesc " << TargetName << "Insts[];\n"; in run()
1059 OS << "extern const unsigned " << TargetName << "InstrNameIndices[];\n"; in run()
1060 OS << "extern const char " << TargetName << "InstrNameData[];\n"; in run()
1062 OS << "extern const uint8_t " << TargetName in run()
1065 OS << "extern const MCInstrInfo::ComplexDeprecationPredicate " << TargetName in run()
1067 OS << ClassName << "::" << ClassName in run()
1075 OS << TargetName << "InstrDeprecationFeatures, "; in run()
1077 OS << "nullptr, "; in run()
1079 OS << TargetName << "InstrComplexDeprecationInfos, "; in run()
1081 OS << "nullptr, "; in run()
1082 OS << NumberedInstructions.size() << ");\n}\n"; in run()
1083 OS << "} // end namespace llvm\n"; in run()
1085 OS << "#endif // GET_INSTRINFO_CTOR_DTOR\n\n"; in run()
1088 emitOperandNameMappings(OS, Target, NumberedInstructions); in run()
1091 emitOperandTypeMappings(OS, Target, NumberedInstructions); in run()
1094 emitLogicalOperandSizeMappings(OS, TargetName, NumberedInstructions); in run()
1097 emitLogicalOperandTypeMappings(OS, TargetName, NumberedInstructions); in run()
1100 emitMCIIHelperMethods(OS, TargetName); in run()
1103 emitFeatureVerifier(OS, Target); in run()
1110 raw_ostream &OS) { in emitRecord() argument
1117 OS << " { "; in emitRecord()
1118 OS << Num << ",\t" << MinOperands << ",\t" in emitRecord()
1126 if (Inst.isPreISelOpcode) OS << "|(1ULL<<MCID::PreISelOpcode)"; in emitRecord()
1127 if (Inst.isPseudo) OS << "|(1ULL<<MCID::Pseudo)"; in emitRecord()
1128 if (Inst.isMeta) OS << "|(1ULL<<MCID::Meta)"; in emitRecord()
1129 if (Inst.isReturn) OS << "|(1ULL<<MCID::Return)"; in emitRecord()
1130 if (Inst.isEHScopeReturn) OS << "|(1ULL<<MCID::EHScopeReturn)"; in emitRecord()
1131 if (Inst.isBranch) OS << "|(1ULL<<MCID::Branch)"; in emitRecord()
1132 if (Inst.isIndirectBranch) OS << "|(1ULL<<MCID::IndirectBranch)"; in emitRecord()
1133 if (Inst.isCompare) OS << "|(1ULL<<MCID::Compare)"; in emitRecord()
1134 if (Inst.isMoveImm) OS << "|(1ULL<<MCID::MoveImm)"; in emitRecord()
1135 if (Inst.isMoveReg) OS << "|(1ULL<<MCID::MoveReg)"; in emitRecord()
1136 if (Inst.isBitcast) OS << "|(1ULL<<MCID::Bitcast)"; in emitRecord()
1137 if (Inst.isAdd) OS << "|(1ULL<<MCID::Add)"; in emitRecord()
1138 if (Inst.isTrap) OS << "|(1ULL<<MCID::Trap)"; in emitRecord()
1139 if (Inst.isSelect) OS << "|(1ULL<<MCID::Select)"; in emitRecord()
1140 if (Inst.isBarrier) OS << "|(1ULL<<MCID::Barrier)"; in emitRecord()
1141 if (Inst.hasDelaySlot) OS << "|(1ULL<<MCID::DelaySlot)"; in emitRecord()
1142 if (Inst.isCall) OS << "|(1ULL<<MCID::Call)"; in emitRecord()
1143 if (Inst.canFoldAsLoad) OS << "|(1ULL<<MCID::FoldableAsLoad)"; in emitRecord()
1144 if (Inst.mayLoad) OS << "|(1ULL<<MCID::MayLoad)"; in emitRecord()
1145 if (Inst.mayStore) OS << "|(1ULL<<MCID::MayStore)"; in emitRecord()
1146 if (Inst.mayRaiseFPException) OS << "|(1ULL<<MCID::MayRaiseFPException)"; in emitRecord()
1147 if (Inst.isPredicable) OS << "|(1ULL<<MCID::Predicable)"; in emitRecord()
1148 if (Inst.isConvertibleToThreeAddress) OS << "|(1ULL<<MCID::ConvertibleTo3Addr)"; in emitRecord()
1149 if (Inst.isCommutable) OS << "|(1ULL<<MCID::Commutable)"; in emitRecord()
1150 if (Inst.isTerminator) OS << "|(1ULL<<MCID::Terminator)"; in emitRecord()
1151 if (Inst.isReMaterializable) OS << "|(1ULL<<MCID::Rematerializable)"; in emitRecord()
1152 if (Inst.isNotDuplicable) OS << "|(1ULL<<MCID::NotDuplicable)"; in emitRecord()
1153 if (Inst.Operands.hasOptionalDef) OS << "|(1ULL<<MCID::HasOptionalDef)"; in emitRecord()
1154 if (Inst.usesCustomInserter) OS << "|(1ULL<<MCID::UsesCustomInserter)"; in emitRecord()
1155 if (Inst.hasPostISelHook) OS << "|(1ULL<<MCID::HasPostISelHook)"; in emitRecord()
1156 if (Inst.Operands.isVariadic)OS << "|(1ULL<<MCID::Variadic)"; in emitRecord()
1157 if (Inst.hasSideEffects) OS << "|(1ULL<<MCID::UnmodeledSideEffects)"; in emitRecord()
1158 if (Inst.isAsCheapAsAMove) OS << "|(1ULL<<MCID::CheapAsAMove)"; in emitRecord()
1160 OS << "|(1ULL<<MCID::ExtraSrcRegAllocReq)"; in emitRecord()
1162 OS << "|(1ULL<<MCID::ExtraDefRegAllocReq)"; in emitRecord()
1163 if (Inst.isRegSequence) OS << "|(1ULL<<MCID::RegSequence)"; in emitRecord()
1164 if (Inst.isExtractSubreg) OS << "|(1ULL<<MCID::ExtractSubreg)"; in emitRecord()
1165 if (Inst.isInsertSubreg) OS << "|(1ULL<<MCID::InsertSubreg)"; in emitRecord()
1166 if (Inst.isConvergent) OS << "|(1ULL<<MCID::Convergent)"; in emitRecord()
1167 if (Inst.variadicOpsAreDefs) OS << "|(1ULL<<MCID::VariadicOpsAreDefs)"; in emitRecord()
1168 if (Inst.isAuthenticated) OS << "|(1ULL<<MCID::Authenticated)"; in emitRecord()
1182 OS << ", 0x"; in emitRecord()
1183 OS.write_hex(Value); in emitRecord()
1184 OS << "ULL, "; in emitRecord()
1189 OS << "nullptr, "; in emitRecord()
1191 OS << "ImplicitList" << EmittedLists[UseList] << ", "; in emitRecord()
1195 OS << "nullptr, "; in emitRecord()
1197 OS << "ImplicitList" << EmittedLists[DefList] << ", "; in emitRecord()
1202 OS << "nullptr"; in emitRecord()
1204 OS << "OperandInfo" << OpInfo.find(OperandInfo)->second; in emitRecord()
1206 OS << " }, // Inst #" << Num << " = " << Inst.TheDef->getName() << "\n"; in emitRecord()
1210 void InstrInfoEmitter::emitEnums(raw_ostream &OS) { in emitEnums() argument
1211 OS << "#ifdef GET_INSTRINFO_ENUM\n"; in emitEnums()
1212 OS << "#undef GET_INSTRINFO_ENUM\n"; in emitEnums()
1214 OS << "namespace llvm {\n\n"; in emitEnums()
1224 OS << "namespace " << Namespace << " {\n"; in emitEnums()
1225 OS << " enum {\n"; in emitEnums()
1228 OS << " " << Inst->TheDef->getName() << "\t= " << Num++ << ",\n"; in emitEnums()
1229 OS << " INSTRUCTION_LIST_END = " << Num << "\n"; in emitEnums()
1230 OS << " };\n\n"; in emitEnums()
1231 OS << "} // end namespace " << Namespace << "\n"; in emitEnums()
1232 OS << "} // end namespace llvm\n"; in emitEnums()
1233 OS << "#endif // GET_INSTRINFO_ENUM\n\n"; in emitEnums()
1235 OS << "#ifdef GET_INSTRINFO_SCHED_ENUM\n"; in emitEnums()
1236 OS << "#undef GET_INSTRINFO_SCHED_ENUM\n"; in emitEnums()
1237 OS << "namespace llvm {\n\n"; in emitEnums()
1238 OS << "namespace " << Namespace << " {\n"; in emitEnums()
1239 OS << "namespace Sched {\n"; in emitEnums()
1240 OS << " enum {\n"; in emitEnums()
1243 OS << " " << Class.Name << "\t= " << Num++ << ",\n"; in emitEnums()
1244 OS << " SCHED_LIST_END = " << Num << "\n"; in emitEnums()
1245 OS << " };\n"; in emitEnums()
1246 OS << "} // end namespace Sched\n"; in emitEnums()
1247 OS << "} // end namespace " << Namespace << "\n"; in emitEnums()
1248 OS << "} // end namespace llvm\n"; in emitEnums()
1250 OS << "#endif // GET_INSTRINFO_SCHED_ENUM\n\n"; in emitEnums()
1255 void EmitInstrInfo(RecordKeeper &RK, raw_ostream &OS) { in EmitInstrInfo() argument
1257 InstrInfoEmitter(RK).run(OS); in EmitInstrInfo()
1259 EmitMapTable(RK, OS); in EmitInstrInfo()