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 uint16_t ImplicitList" << Num << "[] = { "; in PrintDefList()
79 OS << getQualifiedName(Uses[i]) << ", "; 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()
236 void InstrInfoEmitter::emitOperandNameMappings(raw_ostream &OS, in emitOperandNameMappings() argument
249 OS << "#ifdef GET_INSTRINFO_OPERAND_ENUM\n"; in emitOperandNameMappings()
250 OS << "#undef GET_INSTRINFO_OPERAND_ENUM\n"; in emitOperandNameMappings()
251 OS << "namespace llvm {"; in emitOperandNameMappings()
252 OS << "namespace " << Namespace << " {\n"; in emitOperandNameMappings()
253 OS << "namespace " << OpNameNS << " { \n"; in emitOperandNameMappings()
254 OS << "enum {\n"; in emitOperandNameMappings()
256 OS << " " << Op.first << " = " << Op.second << ",\n"; in emitOperandNameMappings()
258 OS << "OPERAND_LAST"; in emitOperandNameMappings()
259 OS << "\n};\n"; in emitOperandNameMappings()
260 OS << "} // End namespace OpName\n"; in emitOperandNameMappings()
261 OS << "} // End namespace " << Namespace << "\n"; in emitOperandNameMappings()
262 OS << "} // End namespace llvm\n"; in emitOperandNameMappings()
263 OS << "#endif //GET_INSTRINFO_OPERAND_ENUM\n"; in emitOperandNameMappings()
265 OS << "#ifdef GET_INSTRINFO_NAMED_OPS\n"; in emitOperandNameMappings()
266 OS << "#undef GET_INSTRINFO_NAMED_OPS\n"; in emitOperandNameMappings()
267 OS << "namespace llvm {"; in emitOperandNameMappings()
268 OS << "namespace " << Namespace << " {\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"; in emitOperandNameMappings()
309 void InstrInfoEmitter::emitOperandTypesEnum(raw_ostream &OS, in emitOperandTypesEnum() argument
315 OS << "\n#ifdef GET_INSTRINFO_OPERAND_TYPES_ENUM\n"; in emitOperandTypesEnum()
316 OS << "#undef GET_INSTRINFO_OPERAND_TYPES_ENUM\n"; in emitOperandTypesEnum()
317 OS << "namespace llvm {"; 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"; in emitOperandTypesEnum()
341 void InstrInfoEmitter::run(raw_ostream &OS) { in run() argument
342 emitSourceFileHeader("Target Instruction Enum Values", OS); in run()
343 emitEnums(OS); in run()
345 emitSourceFileHeader("Target Instruction Descriptors", OS); in run()
347 OS << "\n#ifdef GET_INSTRINFO_MC_DESC\n"; in run()
348 OS << "#undef GET_INSTRINFO_MC_DESC\n"; in run()
350 OS << "namespace llvm {\n\n"; in run()
366 if (!IL) PrintDefList(Uses, IL = ++ListNumber, OS); in run()
371 if (!IL) PrintDefList(Defs, IL = ++ListNumber, OS); in run()
378 EmitOperandInfo(OS, OperandInfoIDs); in run()
382 OS << "\nextern const MCInstrDesc " << TargetName << "Insts[] = {\n"; in run()
392 emitRecord(*Inst, Num++, InstrInfo, EmittedLists, OperandInfoIDs, OS); in run()
394 OS << "};\n\n"; in run()
398 OS << "extern const char " << TargetName << "InstrNameData[] = {\n"; in run()
399 InstrNames.emit(OS, printChar); in run()
400 OS << "};\n\n"; in run()
402 OS << "extern const unsigned " << TargetName <<"InstrNameIndices[] = {"; in run()
407 OS << "\n "; in run()
408 OS << InstrNames.get(Inst->TheDef->getName()) << "U, "; in run()
412 OS << "\n};\n\n"; in run()
415 OS << "static inline void Init" << TargetName in run()
417 OS << " II->InitMCInstrInfo(" << TargetName << "Insts, " in run()
421 OS << "} // End llvm namespace \n"; in run()
423 OS << "#endif // GET_INSTRINFO_MC_DESC\n\n"; in run()
426 OS << "\n#ifdef GET_INSTRINFO_HEADER\n"; in run()
427 OS << "#undef GET_INSTRINFO_HEADER\n"; in run()
430 OS << "namespace llvm {\n"; in run()
431 OS << "struct " << ClassName << " : public TargetInstrInfo {\n" in run()
435 OS << "} // End llvm namespace \n"; in run()
437 OS << "#endif // GET_INSTRINFO_HEADER\n\n"; in run()
439 OS << "\n#ifdef GET_INSTRINFO_CTOR_DTOR\n"; in run()
440 OS << "#undef GET_INSTRINFO_CTOR_DTOR\n"; in run()
442 OS << "namespace llvm {\n"; in run()
443 OS << "extern const MCInstrDesc " << TargetName << "Insts[];\n"; in run()
444 OS << "extern const unsigned " << TargetName << "InstrNameIndices[];\n"; in run()
445 OS << "extern const char " << TargetName << "InstrNameData[];\n"; in run()
446 OS << ClassName << "::" << ClassName << "(int SO, int DO)\n" in run()
452 OS << "} // End llvm namespace \n"; in run()
454 OS << "#endif // GET_INSTRINFO_CTOR_DTOR\n\n"; in run()
456 emitOperandNameMappings(OS, Target, NumberedInstructions); in run()
458 emitOperandTypesEnum(OS, Target); in run()
465 raw_ostream &OS) { in emitRecord() argument
472 OS << " { "; in emitRecord()
473 OS << Num << ",\t" << MinOperands << ",\t" in emitRecord()
479 if (Inst.isPseudo) OS << "|(1<<MCID::Pseudo)"; in emitRecord()
480 if (Inst.isReturn) OS << "|(1<<MCID::Return)"; in emitRecord()
481 if (Inst.isBranch) OS << "|(1<<MCID::Branch)"; in emitRecord()
482 if (Inst.isIndirectBranch) OS << "|(1<<MCID::IndirectBranch)"; in emitRecord()
483 if (Inst.isCompare) OS << "|(1<<MCID::Compare)"; in emitRecord()
484 if (Inst.isMoveImm) OS << "|(1<<MCID::MoveImm)"; in emitRecord()
485 if (Inst.isBitcast) OS << "|(1<<MCID::Bitcast)"; in emitRecord()
486 if (Inst.isSelect) OS << "|(1<<MCID::Select)"; in emitRecord()
487 if (Inst.isBarrier) OS << "|(1<<MCID::Barrier)"; in emitRecord()
488 if (Inst.hasDelaySlot) OS << "|(1<<MCID::DelaySlot)"; in emitRecord()
489 if (Inst.isCall) OS << "|(1<<MCID::Call)"; in emitRecord()
490 if (Inst.canFoldAsLoad) OS << "|(1<<MCID::FoldableAsLoad)"; in emitRecord()
491 if (Inst.mayLoad) OS << "|(1<<MCID::MayLoad)"; in emitRecord()
492 if (Inst.mayStore) OS << "|(1<<MCID::MayStore)"; in emitRecord()
493 if (Inst.isPredicable) OS << "|(1<<MCID::Predicable)"; in emitRecord()
494 if (Inst.isConvertibleToThreeAddress) OS << "|(1<<MCID::ConvertibleTo3Addr)"; in emitRecord()
495 if (Inst.isCommutable) OS << "|(1<<MCID::Commutable)"; in emitRecord()
496 if (Inst.isTerminator) OS << "|(1<<MCID::Terminator)"; in emitRecord()
497 if (Inst.isReMaterializable) OS << "|(1<<MCID::Rematerializable)"; in emitRecord()
498 if (Inst.isNotDuplicable) OS << "|(1<<MCID::NotDuplicable)"; in emitRecord()
499 if (Inst.Operands.hasOptionalDef) OS << "|(1<<MCID::HasOptionalDef)"; in emitRecord()
500 if (Inst.usesCustomInserter) OS << "|(1<<MCID::UsesCustomInserter)"; in emitRecord()
501 if (Inst.hasPostISelHook) OS << "|(1<<MCID::HasPostISelHook)"; in emitRecord()
502 if (Inst.Operands.isVariadic)OS << "|(1<<MCID::Variadic)"; in emitRecord()
503 if (Inst.hasSideEffects) OS << "|(1<<MCID::UnmodeledSideEffects)"; in emitRecord()
504 if (Inst.isAsCheapAsAMove) OS << "|(1<<MCID::CheapAsAMove)"; in emitRecord()
505 if (Inst.hasExtraSrcRegAllocReq) OS << "|(1<<MCID::ExtraSrcRegAllocReq)"; in emitRecord()
506 if (Inst.hasExtraDefRegAllocReq) OS << "|(1<<MCID::ExtraDefRegAllocReq)"; in emitRecord()
519 OS << ", 0x"; in emitRecord()
520 OS.write_hex(Value); in emitRecord()
521 OS << "ULL, "; in emitRecord()
526 OS << "nullptr, "; in emitRecord()
528 OS << "ImplicitList" << EmittedLists[UseList] << ", "; in emitRecord()
532 OS << "nullptr, "; in emitRecord()
534 OS << "ImplicitList" << EmittedLists[DefList] << ", "; in emitRecord()
539 OS << "nullptr"; in emitRecord()
541 OS << "OperandInfo" << OpInfo.find(OperandInfo)->second; in emitRecord()
546 OS << ",0" in emitRecord()
550 OS << "," << Target.getInstNamespace() << "::" << Inst.DeprecatedReason in emitRecord()
554 OS << ",0,nullptr"; in emitRecord()
556 OS << " }, // Inst #" << Num << " = " << Inst.TheDef->getName() << "\n"; in emitRecord()
560 void InstrInfoEmitter::emitEnums(raw_ostream &OS) { in emitEnums() argument
562 OS << "\n#ifdef GET_INSTRINFO_ENUM\n"; in emitEnums()
563 OS << "#undef GET_INSTRINFO_ENUM\n"; in emitEnums()
565 OS << "namespace llvm {\n\n"; in emitEnums()
580 OS << "namespace " << Namespace << " {\n"; in emitEnums()
581 OS << " enum {\n"; in emitEnums()
584 OS << " " << Inst->TheDef->getName() << "\t= " << Num++ << ",\n"; in emitEnums()
585 OS << " INSTRUCTION_LIST_END = " << NumberedInstructions.size() << "\n"; in emitEnums()
586 OS << " };\n"; in emitEnums()
587 OS << "namespace Sched {\n"; in emitEnums()
588 OS << " enum {\n"; in emitEnums()
591 OS << " " << Class.Name << "\t= " << Num++ << ",\n"; in emitEnums()
592 OS << " SCHED_LIST_END = " << SchedModels.numInstrSchedClasses() << "\n"; in emitEnums()
593 OS << " };\n}\n}\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()