Lines Matching refs:OS
37 void run(raw_ostream &OS);
39 void EmitPrefix(raw_ostream &OS);
42 raw_ostream &OS);
45 raw_ostream &OS);
47 raw_ostream &OS);
49 raw_ostream &OS);
51 raw_ostream &OS);
53 bool IsGCC, raw_ostream &OS);
54 void EmitSuffix(raw_ostream &OS);
62 void IntrinsicEmitter::run(raw_ostream &OS) { in run() argument
63 emitSourceFileHeader("Intrinsic Function Source Fragment", OS); in run()
70 EmitPrefix(OS); in run()
73 EmitEnumInfo(Ints, OS); in run()
76 EmitIntrinsicToNameTable(Ints, OS); in run()
79 EmitIntrinsicToOverloadTable(Ints, OS); in run()
82 EmitGenerator(Ints, OS); in run()
85 EmitAttributes(Ints, OS); in run()
90 EmitIntrinsicToBuiltinMap(Ints, true, OS); in run()
93 EmitIntrinsicToBuiltinMap(Ints, false, OS); in run()
96 EmitSuffix(OS); in run()
99 void IntrinsicEmitter::EmitPrefix(raw_ostream &OS) { in EmitPrefix() argument
100 OS << "// VisualStudio defines setjmp as _setjmp\n" in EmitPrefix()
109 void IntrinsicEmitter::EmitSuffix(raw_ostream &OS) { in EmitSuffix() argument
110 OS << "#if defined(_MSC_VER) && defined(setjmp_undefined_for_msvc)\n" in EmitSuffix()
118 raw_ostream &OS) { in EmitEnumInfo() argument
119 OS << "// Enum values for Intrinsics.h\n"; in EmitEnumInfo()
120 OS << "#ifdef GET_INTRINSIC_ENUM_VALUES\n"; in EmitEnumInfo()
122 OS << " " << Ints[i].EnumName; in EmitEnumInfo()
123 OS << ((i != e-1) ? ", " : " "); in EmitEnumInfo()
125 OS << std::string(40-Ints[i].EnumName.size(), ' '); in EmitEnumInfo()
126 OS << " // " << Ints[i].Name << "\n"; in EmitEnumInfo()
128 OS << "#endif\n\n"; in EmitEnumInfo()
133 raw_ostream &OS) { in EmitIntrinsicToNameTable() argument
134 OS << "// Intrinsic ID to name table\n"; in EmitIntrinsicToNameTable()
135 OS << "#ifdef GET_INTRINSIC_NAME_TABLE\n"; in EmitIntrinsicToNameTable()
136 OS << " // Note that entry #0 is the invalid intrinsic!\n"; in EmitIntrinsicToNameTable()
138 OS << " \"" << Ints[i].Name << "\",\n"; in EmitIntrinsicToNameTable()
139 OS << "#endif\n\n"; in EmitIntrinsicToNameTable()
144 raw_ostream &OS) { in EmitIntrinsicToOverloadTable() argument
145 OS << "// Intrinsic ID to overload bitset\n"; in EmitIntrinsicToOverloadTable()
146 OS << "#ifdef GET_INTRINSIC_OVERLOAD_TABLE\n"; in EmitIntrinsicToOverloadTable()
147 OS << "static const uint8_t OTable[] = {\n"; in EmitIntrinsicToOverloadTable()
148 OS << " 0"; in EmitIntrinsicToOverloadTable()
152 OS << ",\n 0"; in EmitIntrinsicToOverloadTable()
154 OS << " | (1<<" << (i+1)%8 << ')'; in EmitIntrinsicToOverloadTable()
156 OS << "\n};\n\n"; in EmitIntrinsicToOverloadTable()
158 OS << "return (OTable[id/8] & (1 << (id%8))) != 0;\n"; in EmitIntrinsicToOverloadTable()
159 OS << "#endif\n\n"; in EmitIntrinsicToOverloadTable()
362 static void printIITEntry(raw_ostream &OS, unsigned char X) { in printIITEntry() argument
363 OS << (unsigned)X; in printIITEntry()
367 raw_ostream &OS) { in EmitGenerator() argument
413 OS << "// Global intrinsic function declaration type table.\n"; in EmitGenerator()
414 OS << "#ifdef GET_INTRINSIC_GENERATOR_GLOBAL\n"; in EmitGenerator()
416 OS << "static const unsigned IIT_Table[] = {\n "; in EmitGenerator()
420 OS << "\n "; in EmitGenerator()
424 OS << "0x" << utohexstr(FixedEncodings[i]) << ", "; in EmitGenerator()
434 OS << "(1U<<31) | " << LongEncodingTable.get(TypeSig) << ", "; in EmitGenerator()
437 OS << "0\n};\n\n"; in EmitGenerator()
440 OS << "static const unsigned char IIT_LongEncodingTable[] = {\n"; in EmitGenerator()
442 LongEncodingTable.emit(OS, printIITEntry); in EmitGenerator()
443 OS << " 255\n};\n\n"; in EmitGenerator()
445 OS << "#endif\n\n"; // End of GET_INTRINSIC_GENERATOR_GLOBAL in EmitGenerator()
478 EmitAttributes(const std::vector<CodeGenIntrinsic> &Ints, raw_ostream &OS) { in EmitAttributes() argument
479 OS << "// Add parameter attributes that are not common to all intrinsics.\n"; in EmitAttributes()
480 OS << "#ifdef GET_INTRINSIC_ATTRIBUTES\n"; in EmitAttributes()
482 OS << "static AttributeSet getAttributes(LLVMContext &C, " << TargetPrefix in EmitAttributes()
485 OS << "AttributeSet Intrinsic::getAttributes(LLVMContext &C, ID id) {\n"; in EmitAttributes()
505 OS << " static const uint8_t IntrinsicsToAttributesMap[] = {\n"; in EmitAttributes()
510 OS << " " << UniqAttributes[&intrinsic] << ", // " in EmitAttributes()
513 OS << " };\n\n"; in EmitAttributes()
515 OS << " AttributeSet AS[" << maxArgAttrs+1 << "];\n"; in EmitAttributes()
516 OS << " unsigned NumAttrs = 0;\n"; in EmitAttributes()
517 OS << " if (id != 0) {\n"; in EmitAttributes()
518 OS << " switch(IntrinsicsToAttributesMap[id - "; in EmitAttributes()
520 OS << "Intrinsic::num_intrinsics"; in EmitAttributes()
522 OS << "1"; in EmitAttributes()
523 OS << "]) {\n"; in EmitAttributes()
524 OS << " default: llvm_unreachable(\"Invalid attribute number\");\n"; in EmitAttributes()
527 OS << " case " << I->second << ": {\n"; in EmitAttributes()
540 OS << " const Attribute::AttrKind AttrParam" << argNo + 1 <<"[]= {"; in EmitAttributes()
547 OS << ","; in EmitAttributes()
548 OS << "Attribute::NoCapture"; in EmitAttributes()
553 OS << ","; in EmitAttributes()
554 OS << "Attribute::Returned"; in EmitAttributes()
559 OS << ","; in EmitAttributes()
560 OS << "Attribute::ReadOnly"; in EmitAttributes()
565 OS << ","; in EmitAttributes()
566 OS << "Attribute::WriteOnly"; in EmitAttributes()
571 OS << ","; in EmitAttributes()
572 OS << "Attribute::ReadNone"; in EmitAttributes()
579 OS << "};\n"; in EmitAttributes()
580 OS << " AS[" << numAttrs++ << "] = AttributeSet::get(C, " in EmitAttributes()
589 OS << " const Attribute::AttrKind Atts[] = {"; in EmitAttributes()
592 OS << "Attribute::NoUnwind"; in EmitAttributes()
597 OS << ","; in EmitAttributes()
598 OS << "Attribute::NoReturn"; in EmitAttributes()
603 OS << ","; in EmitAttributes()
604 OS << "Attribute::NoDuplicate"; in EmitAttributes()
609 OS << ","; in EmitAttributes()
610 OS << "Attribute::Convergent"; in EmitAttributes()
617 OS << ","; in EmitAttributes()
618 OS << "Attribute::ReadNone"; in EmitAttributes()
622 OS << ","; in EmitAttributes()
623 OS << "Attribute::ReadOnly,"; in EmitAttributes()
624 OS << "Attribute::ArgMemOnly"; in EmitAttributes()
628 OS << ","; in EmitAttributes()
629 OS << "Attribute::ReadOnly"; in EmitAttributes()
633 OS << ","; in EmitAttributes()
634 OS << "Attribute::WriteOnly,"; in EmitAttributes()
635 OS << "Attribute::ArgMemOnly"; in EmitAttributes()
639 OS << ","; in EmitAttributes()
640 OS << "Attribute::WriteOnly"; in EmitAttributes()
644 OS << ","; in EmitAttributes()
645 OS << "Attribute::ArgMemOnly"; in EmitAttributes()
650 OS << "};\n"; in EmitAttributes()
651 OS << " AS[" << numAttrs++ << "] = AttributeSet::get(C, " in EmitAttributes()
656 OS << " NumAttrs = " << numAttrs << ";\n"; in EmitAttributes()
657 OS << " break;\n"; in EmitAttributes()
658 OS << " }\n"; in EmitAttributes()
660 OS << " return AttributeSet();\n"; in EmitAttributes()
661 OS << " }\n"; in EmitAttributes()
665 OS << " }\n"; in EmitAttributes()
666 OS << " }\n"; in EmitAttributes()
667 OS << " return AttributeSet::get(C, makeArrayRef(AS, NumAttrs));\n"; in EmitAttributes()
668 OS << "}\n"; in EmitAttributes()
669 OS << "#endif // GET_INTRINSIC_ATTRIBUTES\n\n"; in EmitAttributes()
673 const std::vector<CodeGenIntrinsic> &Ints, bool IsGCC, raw_ostream &OS) { in EmitIntrinsicToBuiltinMap() argument
693 OS << "// Get the LLVM intrinsic that corresponds to a builtin.\n"; in EmitIntrinsicToBuiltinMap()
694 OS << "// This is used by the C front-end. The builtin name is passed\n"; in EmitIntrinsicToBuiltinMap()
695 OS << "// in as BuiltinName, and a target prefix (e.g. 'ppc') is passed\n"; in EmitIntrinsicToBuiltinMap()
696 OS << "// in as TargetPrefix. The result is assigned to 'IntrinsicID'.\n"; in EmitIntrinsicToBuiltinMap()
697 OS << "#ifdef GET_LLVM_INTRINSIC_FOR_" << CompilerName << "_BUILTIN\n"; in EmitIntrinsicToBuiltinMap()
700 OS << "static " << TargetPrefix << "Intrinsic::ID " in EmitIntrinsicToBuiltinMap()
704 OS << "Intrinsic::ID Intrinsic::getIntrinsicFor" << CompilerName in EmitIntrinsicToBuiltinMap()
708 OS << " static const char BuiltinNames[] = {\n"; in EmitIntrinsicToBuiltinMap()
709 Table.EmitCharArray(OS); in EmitIntrinsicToBuiltinMap()
710 OS << " };\n\n"; in EmitIntrinsicToBuiltinMap()
712 OS << " struct BuiltinEntry {\n"; in EmitIntrinsicToBuiltinMap()
713 OS << " Intrinsic::ID IntrinID;\n"; in EmitIntrinsicToBuiltinMap()
714 OS << " unsigned StrTabOffset;\n"; in EmitIntrinsicToBuiltinMap()
715 OS << " const char *getName() const {\n"; in EmitIntrinsicToBuiltinMap()
716 OS << " return &BuiltinNames[StrTabOffset];\n"; in EmitIntrinsicToBuiltinMap()
717 OS << " }\n"; in EmitIntrinsicToBuiltinMap()
718 OS << " bool operator<(const char *RHS) const {\n"; in EmitIntrinsicToBuiltinMap()
719 OS << " return strcmp(getName(), RHS) < 0;\n"; in EmitIntrinsicToBuiltinMap()
720 OS << " }\n"; in EmitIntrinsicToBuiltinMap()
721 OS << " };\n"; in EmitIntrinsicToBuiltinMap()
724 OS << " StringRef BuiltinName(BuiltinNameStr);\n"; in EmitIntrinsicToBuiltinMap()
725 OS << " StringRef TargetPrefix(TargetPrefixStr);\n\n"; in EmitIntrinsicToBuiltinMap()
729 OS << " "; in EmitIntrinsicToBuiltinMap()
731 OS << "if (TargetPrefix == \"" << I->first << "\") "; in EmitIntrinsicToBuiltinMap()
733 OS << "/* Target Independent Builtins */ "; in EmitIntrinsicToBuiltinMap()
734 OS << "{\n"; in EmitIntrinsicToBuiltinMap()
737 OS << " static const BuiltinEntry " << I->first << "Names[] = {\n"; in EmitIntrinsicToBuiltinMap()
739 OS << " {Intrinsic::" << P.second << ", " in EmitIntrinsicToBuiltinMap()
742 OS << " };\n"; in EmitIntrinsicToBuiltinMap()
743 OS << " auto I = std::lower_bound(std::begin(" << I->first << "Names),\n"; in EmitIntrinsicToBuiltinMap()
744 OS << " std::end(" << I->first << "Names),\n"; in EmitIntrinsicToBuiltinMap()
745 OS << " BuiltinNameStr);\n"; in EmitIntrinsicToBuiltinMap()
746 OS << " if (I != std::end(" << I->first << "Names) &&\n"; in EmitIntrinsicToBuiltinMap()
747 OS << " strcmp(I->getName(), BuiltinNameStr) == 0)\n"; in EmitIntrinsicToBuiltinMap()
748 OS << " return I->IntrinID;\n"; in EmitIntrinsicToBuiltinMap()
749 OS << " }\n"; in EmitIntrinsicToBuiltinMap()
751 OS << " return "; in EmitIntrinsicToBuiltinMap()
753 OS << "(" << TargetPrefix << "Intrinsic::ID)"; in EmitIntrinsicToBuiltinMap()
754 OS << "Intrinsic::not_intrinsic;\n"; in EmitIntrinsicToBuiltinMap()
755 OS << "}\n"; in EmitIntrinsicToBuiltinMap()
756 OS << "#endif\n\n"; in EmitIntrinsicToBuiltinMap()
759 void llvm::EmitIntrinsics(RecordKeeper &RK, raw_ostream &OS, bool TargetOnly) { in EmitIntrinsics() argument
760 IntrinsicEmitter(RK, TargetOnly).run(OS); in EmitIntrinsics()