Lines Matching refs:OS
42 void run(raw_ostream &OS);
45 void emitEnums(raw_ostream &OS);
59 raw_ostream &OS);
60 void emitOperandTypesEnum(raw_ostream &OS, const CodeGenTarget &Target);
66 void emitOperandNameMappings(raw_ostream &OS, const CodeGenTarget &Target,
70 void EmitOperandInfo(raw_ostream &OS, OperandInfoMapTy &OperandInfoIDs);
76 unsigned Num, raw_ostream &OS) { in PrintDefList() argument
77 OS << "static const MCPhysReg ImplicitList" << Num << "[] = { "; in PrintDefList()
79 OS << getQualifiedName(U) << ", "; in PrintDefList()
80 OS << "0 };\n"; in PrintDefList()
172 void InstrInfoEmitter::EmitOperandInfo(raw_ostream &OS, in EmitOperandInfo() argument
178 OS << "\n"; in EmitOperandInfo()
186 OS << "static const MCOperandInfo OperandInfo" << N << "[] = { "; in EmitOperandInfo()
188 OS << "{ " << Info << " }, "; in EmitOperandInfo()
189 OS << "};\n"; in EmitOperandInfo()
235 void InstrInfoEmitter::emitOperandNameMappings(raw_ostream &OS, in emitOperandNameMappings() argument
248 OS << "#ifdef GET_INSTRINFO_OPERAND_ENUM\n"; in emitOperandNameMappings()
249 OS << "#undef GET_INSTRINFO_OPERAND_ENUM\n"; in emitOperandNameMappings()
250 OS << "namespace llvm {\n"; in emitOperandNameMappings()
251 OS << "namespace " << Namespace << " {\n"; in emitOperandNameMappings()
252 OS << "namespace " << OpNameNS << " {\n"; in emitOperandNameMappings()
253 OS << "enum {\n"; in emitOperandNameMappings()
255 OS << " " << Op.first << " = " << Op.second << ",\n"; in emitOperandNameMappings()
257 OS << "OPERAND_LAST"; in emitOperandNameMappings()
258 OS << "\n};\n"; in emitOperandNameMappings()
259 OS << "} // end namespace OpName\n"; in emitOperandNameMappings()
260 OS << "} // end namespace " << Namespace << "\n"; in emitOperandNameMappings()
261 OS << "} // end namespace llvm\n"; in emitOperandNameMappings()
262 OS << "#endif //GET_INSTRINFO_OPERAND_ENUM\n\n"; in emitOperandNameMappings()
264 OS << "#ifdef GET_INSTRINFO_NAMED_OPS\n"; in emitOperandNameMappings()
265 OS << "#undef GET_INSTRINFO_NAMED_OPS\n"; in emitOperandNameMappings()
266 OS << "namespace llvm {\n"; in emitOperandNameMappings()
267 OS << "namespace " << Namespace << " {\n"; in emitOperandNameMappings()
268 OS << "LLVM_READONLY\n"; in emitOperandNameMappings()
269 OS << "int16_t getNamedOperandIdx(uint16_t Opcode, uint16_t NamedIdx) {\n"; in emitOperandNameMappings()
271 OS << " static const int16_t OperandMap [][" << Operands.size() in emitOperandNameMappings()
275 OS << "{"; in emitOperandNameMappings()
279 OS << (OpList.count(i) == 0 ? -1 : (int)OpList.find(i)->second) << ", "; in emitOperandNameMappings()
281 OS << "},\n"; in emitOperandNameMappings()
283 OS << "};\n"; in emitOperandNameMappings()
285 OS << " switch(Opcode) {\n"; in emitOperandNameMappings()
289 OS << " case " << Name << ":\n"; in emitOperandNameMappings()
291 OS << " return OperandMap[" << TableIndex++ << "][NamedIdx];\n"; in emitOperandNameMappings()
293 OS << " default: return -1;\n"; in emitOperandNameMappings()
294 OS << " }\n"; in emitOperandNameMappings()
297 OS << " return -1;\n"; in emitOperandNameMappings()
299 OS << "}\n"; in emitOperandNameMappings()
300 OS << "} // end namespace " << Namespace << "\n"; in emitOperandNameMappings()
301 OS << "} // end namespace llvm\n"; in emitOperandNameMappings()
302 OS << "#endif //GET_INSTRINFO_NAMED_OPS\n\n"; in emitOperandNameMappings()
309 void InstrInfoEmitter::emitOperandTypesEnum(raw_ostream &OS, in emitOperandTypesEnum() argument
315 OS << "#ifdef GET_INSTRINFO_OPERAND_TYPES_ENUM\n"; in emitOperandTypesEnum()
316 OS << "#undef GET_INSTRINFO_OPERAND_TYPES_ENUM\n"; in emitOperandTypesEnum()
317 OS << "namespace llvm {\n"; in emitOperandTypesEnum()
318 OS << "namespace " << Namespace << " {\n"; in emitOperandTypesEnum()
319 OS << "namespace OpTypes {\n"; in emitOperandTypesEnum()
320 OS << "enum OperandType {\n"; in emitOperandTypesEnum()
325 OS << " " << Op->getName() << " = " << EnumVal << ",\n"; in emitOperandTypesEnum()
329 OS << " OPERAND_TYPE_LIST_END" << "\n};\n"; in emitOperandTypesEnum()
330 OS << "} // end namespace OpTypes\n"; in emitOperandTypesEnum()
331 OS << "} // end namespace " << Namespace << "\n"; in emitOperandTypesEnum()
332 OS << "} // end namespace llvm\n"; in emitOperandTypesEnum()
333 OS << "#endif // GET_INSTRINFO_OPERAND_TYPES_ENUM\n\n"; in emitOperandTypesEnum()
341 void InstrInfoEmitter::run(raw_ostream &OS) { in run() argument
342 emitSourceFileHeader("Target Instruction Enum Values and Descriptors", OS); in run()
343 emitEnums(OS); in run()
345 OS << "#ifdef GET_INSTRINFO_MC_DESC\n"; in run()
346 OS << "#undef GET_INSTRINFO_MC_DESC\n"; in run()
348 OS << "namespace llvm {\n\n"; in run()
364 if (!IL) PrintDefList(Uses, IL = ++ListNumber, OS); in run()
369 if (!IL) PrintDefList(Defs, IL = ++ListNumber, OS); in run()
376 EmitOperandInfo(OS, OperandInfoIDs); in run()
380 OS << "\nextern const MCInstrDesc " << TargetName << "Insts[] = {\n"; in run()
390 emitRecord(*Inst, Num++, InstrInfo, EmittedLists, OperandInfoIDs, OS); in run()
392 OS << "};\n\n"; in run()
396 OS << "extern const char " << TargetName << "InstrNameData[] = {\n"; in run()
397 InstrNames.emit(OS, printChar); in run()
398 OS << "};\n\n"; in run()
400 OS << "extern const unsigned " << TargetName <<"InstrNameIndices[] = {"; in run()
405 OS << "\n "; in run()
406 OS << InstrNames.get(Inst->TheDef->getName()) << "U, "; in run()
410 OS << "\n};\n\n"; in run()
413 OS << "static inline void Init" << TargetName in run()
415 OS << " II->InitMCInstrInfo(" << TargetName << "Insts, " in run()
419 OS << "} // end llvm namespace\n"; in run()
421 OS << "#endif // GET_INSTRINFO_MC_DESC\n\n"; in run()
424 OS << "#ifdef GET_INSTRINFO_HEADER\n"; in run()
425 OS << "#undef GET_INSTRINFO_HEADER\n"; in run()
428 OS << "namespace llvm {\n"; in run()
429 OS << "struct " << ClassName << " : public TargetInstrInfo {\n" in run()
434 OS << "} // end llvm namespace\n"; in run()
436 OS << "#endif // GET_INSTRINFO_HEADER\n\n"; in run()
438 OS << "#ifdef GET_INSTRINFO_CTOR_DTOR\n"; in run()
439 OS << "#undef GET_INSTRINFO_CTOR_DTOR\n"; in run()
441 OS << "namespace llvm {\n"; in run()
442 OS << "extern const MCInstrDesc " << TargetName << "Insts[];\n"; in run()
443 OS << "extern const unsigned " << TargetName << "InstrNameIndices[];\n"; in run()
444 OS << "extern const char " << TargetName << "InstrNameData[];\n"; in run()
445 OS << ClassName << "::" << ClassName in run()
451 OS << "} // end llvm namespace\n"; in run()
453 OS << "#endif // GET_INSTRINFO_CTOR_DTOR\n\n"; in run()
455 emitOperandNameMappings(OS, Target, NumberedInstructions); in run()
457 emitOperandTypesEnum(OS, Target); in run()
464 raw_ostream &OS) { in emitRecord() argument
471 OS << " { "; in emitRecord()
472 OS << Num << ",\t" << MinOperands << ",\t" in emitRecord()
478 if (Inst.isPseudo) OS << "|(1ULL<<MCID::Pseudo)"; in emitRecord()
479 if (Inst.isReturn) OS << "|(1ULL<<MCID::Return)"; in emitRecord()
480 if (Inst.isBranch) OS << "|(1ULL<<MCID::Branch)"; in emitRecord()
481 if (Inst.isIndirectBranch) OS << "|(1ULL<<MCID::IndirectBranch)"; in emitRecord()
482 if (Inst.isCompare) OS << "|(1ULL<<MCID::Compare)"; in emitRecord()
483 if (Inst.isMoveImm) OS << "|(1ULL<<MCID::MoveImm)"; in emitRecord()
484 if (Inst.isBitcast) OS << "|(1ULL<<MCID::Bitcast)"; in emitRecord()
485 if (Inst.isSelect) OS << "|(1ULL<<MCID::Select)"; in emitRecord()
486 if (Inst.isBarrier) OS << "|(1ULL<<MCID::Barrier)"; in emitRecord()
487 if (Inst.hasDelaySlot) OS << "|(1ULL<<MCID::DelaySlot)"; in emitRecord()
488 if (Inst.isCall) OS << "|(1ULL<<MCID::Call)"; in emitRecord()
489 if (Inst.canFoldAsLoad) OS << "|(1ULL<<MCID::FoldableAsLoad)"; in emitRecord()
490 if (Inst.mayLoad) OS << "|(1ULL<<MCID::MayLoad)"; in emitRecord()
491 if (Inst.mayStore) OS << "|(1ULL<<MCID::MayStore)"; in emitRecord()
492 if (Inst.isPredicable) OS << "|(1ULL<<MCID::Predicable)"; in emitRecord()
493 if (Inst.isConvertibleToThreeAddress) OS << "|(1ULL<<MCID::ConvertibleTo3Addr)"; in emitRecord()
494 if (Inst.isCommutable) OS << "|(1ULL<<MCID::Commutable)"; in emitRecord()
495 if (Inst.isTerminator) OS << "|(1ULL<<MCID::Terminator)"; in emitRecord()
496 if (Inst.isReMaterializable) OS << "|(1ULL<<MCID::Rematerializable)"; in emitRecord()
497 if (Inst.isNotDuplicable) OS << "|(1ULL<<MCID::NotDuplicable)"; in emitRecord()
498 if (Inst.Operands.hasOptionalDef) OS << "|(1ULL<<MCID::HasOptionalDef)"; in emitRecord()
499 if (Inst.usesCustomInserter) OS << "|(1ULL<<MCID::UsesCustomInserter)"; in emitRecord()
500 if (Inst.hasPostISelHook) OS << "|(1ULL<<MCID::HasPostISelHook)"; in emitRecord()
501 if (Inst.Operands.isVariadic)OS << "|(1ULL<<MCID::Variadic)"; in emitRecord()
502 if (Inst.hasSideEffects) OS << "|(1ULL<<MCID::UnmodeledSideEffects)"; in emitRecord()
503 if (Inst.isAsCheapAsAMove) OS << "|(1ULL<<MCID::CheapAsAMove)"; in emitRecord()
504 if (Inst.hasExtraSrcRegAllocReq) OS << "|(1ULL<<MCID::ExtraSrcRegAllocReq)"; in emitRecord()
505 if (Inst.hasExtraDefRegAllocReq) OS << "|(1ULL<<MCID::ExtraDefRegAllocReq)"; in emitRecord()
506 if (Inst.isRegSequence) OS << "|(1ULL<<MCID::RegSequence)"; in emitRecord()
507 if (Inst.isExtractSubreg) OS << "|(1ULL<<MCID::ExtractSubreg)"; in emitRecord()
508 if (Inst.isInsertSubreg) OS << "|(1ULL<<MCID::InsertSubreg)"; in emitRecord()
509 if (Inst.isConvergent) OS << "|(1ULL<<MCID::Convergent)"; in emitRecord()
522 OS << ", 0x"; in emitRecord()
523 OS.write_hex(Value); in emitRecord()
524 OS << "ULL, "; in emitRecord()
529 OS << "nullptr, "; in emitRecord()
531 OS << "ImplicitList" << EmittedLists[UseList] << ", "; in emitRecord()
535 OS << "nullptr, "; in emitRecord()
537 OS << "ImplicitList" << EmittedLists[DefList] << ", "; in emitRecord()
542 OS << "nullptr"; in emitRecord()
544 OS << "OperandInfo" << OpInfo.find(OperandInfo)->second; in emitRecord()
549 OS << ", -1 " in emitRecord()
553 OS << ", " << Target.getInstNamespace() << "::" << Inst.DeprecatedReason in emitRecord()
557 OS << ", -1 ,nullptr"; in emitRecord()
559 OS << " }, // Inst #" << Num << " = " << Inst.TheDef->getName() << "\n"; in emitRecord()
563 void InstrInfoEmitter::emitEnums(raw_ostream &OS) { in emitEnums() argument
565 OS << "#ifdef GET_INSTRINFO_ENUM\n"; in emitEnums()
566 OS << "#undef GET_INSTRINFO_ENUM\n"; in emitEnums()
568 OS << "namespace llvm {\n\n"; in emitEnums()
578 OS << "namespace " << Namespace << " {\n"; in emitEnums()
579 OS << " enum {\n"; in emitEnums()
582 OS << " " << Inst->TheDef->getName() << "\t= " << Num++ << ",\n"; in emitEnums()
583 OS << " INSTRUCTION_LIST_END = " << Num << "\n"; in emitEnums()
584 OS << " };\n\n"; in emitEnums()
585 OS << "namespace Sched {\n"; in emitEnums()
586 OS << " enum {\n"; in emitEnums()
589 OS << " " << Class.Name << "\t= " << Num++ << ",\n"; in emitEnums()
590 OS << " SCHED_LIST_END = " << Num << "\n"; in emitEnums()
591 OS << " };\n"; in emitEnums()
592 OS << "} // end Sched namespace\n"; in emitEnums()
593 OS << "} // end " << Namespace << " namespace\n"; in emitEnums()
594 OS << "} // end llvm namespace\n"; in emitEnums()
596 OS << "#endif // GET_INSTRINFO_ENUM\n\n"; in emitEnums()
601 void EmitInstrInfo(RecordKeeper &RK, raw_ostream &OS) { in EmitInstrInfo() argument
602 InstrInfoEmitter(RK).run(OS); in EmitInstrInfo()
603 EmitMapTable(RK, OS); in EmitInstrInfo()