Lines Matching refs:OS

36   void run(raw_ostream &OS);
38 void EmitPrefix(raw_ostream &OS);
41 raw_ostream &OS);
44 raw_ostream &OS);
46 raw_ostream &OS);
48 raw_ostream &OS);
50 raw_ostream &OS);
52 raw_ostream &OS);
54 raw_ostream &OS);
56 raw_ostream &OS);
57 void EmitSuffix(raw_ostream &OS);
65 void IntrinsicEmitter::run(raw_ostream &OS) { in run() argument
66 emitSourceFileHeader("Intrinsic Function Source Fragment", OS); in run()
73 EmitPrefix(OS); in run()
76 EmitEnumInfo(Ints, OS); in run()
79 EmitIntrinsicToNameTable(Ints, OS); in run()
82 EmitIntrinsicToOverloadTable(Ints, OS); in run()
85 EmitFnNameRecognizer(Ints, OS); in run()
88 EmitGenerator(Ints, OS); in run()
91 EmitAttributes(Ints, OS); in run()
94 EmitIntrinsicToGCCBuiltinMap(Ints, OS); in run()
97 EmitIntrinsicToMSBuiltinMap(Ints, OS); in run()
99 EmitSuffix(OS); in run()
102 void IntrinsicEmitter::EmitPrefix(raw_ostream &OS) { in EmitPrefix() argument
103 OS << "// VisualStudio defines setjmp as _setjmp\n" in EmitPrefix()
112 void IntrinsicEmitter::EmitSuffix(raw_ostream &OS) { in EmitSuffix() argument
113 OS << "#if defined(_MSC_VER) && defined(setjmp_undefined_for_msvc)\n" in EmitSuffix()
121 raw_ostream &OS) { in EmitEnumInfo() argument
122 OS << "// Enum values for Intrinsics.h\n"; in EmitEnumInfo()
123 OS << "#ifdef GET_INTRINSIC_ENUM_VALUES\n"; in EmitEnumInfo()
125 OS << " " << Ints[i].EnumName; in EmitEnumInfo()
126 OS << ((i != e-1) ? ", " : " "); in EmitEnumInfo()
128 OS << std::string(40-Ints[i].EnumName.size(), ' '); in EmitEnumInfo()
129 OS << " // " << Ints[i].Name << "\n"; in EmitEnumInfo()
131 OS << "#endif\n\n"; in EmitEnumInfo()
136 raw_ostream &OS) { in EmitFnNameRecognizer() argument
142 OS << "// Function name -> enum value recognizer code.\n"; in EmitFnNameRecognizer()
143 OS << "#ifdef GET_FUNCTION_RECOGNIZER\n"; in EmitFnNameRecognizer()
144 OS << " StringRef NameR(Name+6, Len-6); // Skip over 'llvm.'\n"; in EmitFnNameRecognizer()
145 OS << " switch (Name[5]) { // Dispatch on first letter.\n"; in EmitFnNameRecognizer()
146 OS << " default: break;\n"; in EmitFnNameRecognizer()
150 OS << " case '" << I->first << "':\n"; in EmitFnNameRecognizer()
176 OS << " if (NameR.startswith(\"" << TheStr << "\")) " in EmitFnNameRecognizer()
181 StringMatcher("NameR", MatchTable, OS).Emit(1); in EmitFnNameRecognizer()
182 OS << " break; // end of '" << I->first << "' case.\n"; in EmitFnNameRecognizer()
185 OS << " }\n"; in EmitFnNameRecognizer()
186 OS << "#endif\n\n"; in EmitFnNameRecognizer()
191 raw_ostream &OS) { in EmitIntrinsicToNameTable() argument
192 OS << "// Intrinsic ID to name table\n"; in EmitIntrinsicToNameTable()
193 OS << "#ifdef GET_INTRINSIC_NAME_TABLE\n"; in EmitIntrinsicToNameTable()
194 OS << " // Note that entry #0 is the invalid intrinsic!\n"; in EmitIntrinsicToNameTable()
196 OS << " \"" << Ints[i].Name << "\",\n"; in EmitIntrinsicToNameTable()
197 OS << "#endif\n\n"; in EmitIntrinsicToNameTable()
202 raw_ostream &OS) { in EmitIntrinsicToOverloadTable() argument
203 OS << "// Intrinsic ID to overload bitset\n"; in EmitIntrinsicToOverloadTable()
204 OS << "#ifdef GET_INTRINSIC_OVERLOAD_TABLE\n"; in EmitIntrinsicToOverloadTable()
205 OS << "static const uint8_t OTable[] = {\n"; in EmitIntrinsicToOverloadTable()
206 OS << " 0"; in EmitIntrinsicToOverloadTable()
210 OS << ",\n 0"; in EmitIntrinsicToOverloadTable()
212 OS << " | (1<<" << (i+1)%8 << ')'; in EmitIntrinsicToOverloadTable()
214 OS << "\n};\n\n"; in EmitIntrinsicToOverloadTable()
216 OS << "return (OTable[id/8] & (1 << (id%8))) != 0;\n"; in EmitIntrinsicToOverloadTable()
217 OS << "#endif\n\n"; in EmitIntrinsicToOverloadTable()
420 static void printIITEntry(raw_ostream &OS, unsigned char X) { in printIITEntry() argument
421 OS << (unsigned)X; in printIITEntry()
425 raw_ostream &OS) { in EmitGenerator() argument
471 OS << "// Global intrinsic function declaration type table.\n"; in EmitGenerator()
472 OS << "#ifdef GET_INTRINSIC_GENERATOR_GLOBAL\n"; in EmitGenerator()
474 OS << "static const unsigned IIT_Table[] = {\n "; in EmitGenerator()
478 OS << "\n "; in EmitGenerator()
482 OS << "0x" << utohexstr(FixedEncodings[i]) << ", "; in EmitGenerator()
492 OS << "(1U<<31) | " << LongEncodingTable.get(TypeSig) << ", "; in EmitGenerator()
495 OS << "0\n};\n\n"; in EmitGenerator()
498 OS << "static const unsigned char IIT_LongEncodingTable[] = {\n"; in EmitGenerator()
500 LongEncodingTable.emit(OS, printIITEntry); in EmitGenerator()
501 OS << " 255\n};\n\n"; in EmitGenerator()
503 OS << "#endif\n\n"; // End of GET_INTRINSIC_GENERATOR_GLOBAL in EmitGenerator()
536 EmitAttributes(const std::vector<CodeGenIntrinsic> &Ints, raw_ostream &OS) { in EmitAttributes() argument
537 OS << "// Add parameter attributes that are not common to all intrinsics.\n"; in EmitAttributes()
538 OS << "#ifdef GET_INTRINSIC_ATTRIBUTES\n"; in EmitAttributes()
540 OS << "static AttributeSet getAttributes(LLVMContext &C, " << TargetPrefix in EmitAttributes()
543 OS << "AttributeSet Intrinsic::getAttributes(LLVMContext &C, ID id) {\n"; in EmitAttributes()
563 OS << " static const uint8_t IntrinsicsToAttributesMap[] = {\n"; in EmitAttributes()
568 OS << " " << UniqAttributes[&intrinsic] << ", // " in EmitAttributes()
571 OS << " };\n\n"; in EmitAttributes()
573 OS << " AttributeSet AS[" << maxArgAttrs+1 << "];\n"; in EmitAttributes()
574 OS << " unsigned NumAttrs = 0;\n"; in EmitAttributes()
575 OS << " if (id != 0) {\n"; in EmitAttributes()
576 OS << " switch(IntrinsicsToAttributesMap[id - "; in EmitAttributes()
578 OS << "Intrinsic::num_intrinsics"; in EmitAttributes()
580 OS << "1"; in EmitAttributes()
581 OS << "]) {\n"; in EmitAttributes()
582 OS << " default: llvm_unreachable(\"Invalid attribute number\");\n"; in EmitAttributes()
585 OS << " case " << I->second << ": {\n"; in EmitAttributes()
598 OS << " const Attribute::AttrKind AttrParam" << argNo + 1 <<"[]= {"; in EmitAttributes()
605 OS << ","; in EmitAttributes()
606 OS << "Attribute::NoCapture"; in EmitAttributes()
611 OS << ","; in EmitAttributes()
612 OS << "Attribute::ReadOnly"; in EmitAttributes()
617 OS << ","; in EmitAttributes()
618 OS << "Attribute::ReadNone"; in EmitAttributes()
625 OS << "};\n"; in EmitAttributes()
626 OS << " AS[" << numAttrs++ << "] = AttributeSet::get(C, " in EmitAttributes()
635 OS << " const Attribute::AttrKind Atts[] = {"; in EmitAttributes()
638 OS << "Attribute::NoUnwind"; in EmitAttributes()
643 OS << ","; in EmitAttributes()
644 OS << "Attribute::NoReturn"; in EmitAttributes()
649 OS << ","; in EmitAttributes()
650 OS << "Attribute::NoDuplicate"; in EmitAttributes()
655 OS << ","; in EmitAttributes()
656 OS << "Attribute::Convergent"; in EmitAttributes()
663 OS << ","; in EmitAttributes()
664 OS << "Attribute::ReadNone"; in EmitAttributes()
668 OS << ","; in EmitAttributes()
669 OS << "Attribute::ReadOnly,"; in EmitAttributes()
670 OS << "Attribute::ArgMemOnly"; in EmitAttributes()
674 OS << ","; in EmitAttributes()
675 OS << "Attribute::ReadOnly"; in EmitAttributes()
679 OS << ","; in EmitAttributes()
680 OS << "Attribute::ArgMemOnly"; in EmitAttributes()
685 OS << "};\n"; in EmitAttributes()
686 OS << " AS[" << numAttrs++ << "] = AttributeSet::get(C, " in EmitAttributes()
691 OS << " NumAttrs = " << numAttrs << ";\n"; in EmitAttributes()
692 OS << " break;\n"; in EmitAttributes()
693 OS << " }\n"; in EmitAttributes()
695 OS << " return AttributeSet();\n"; in EmitAttributes()
696 OS << " }\n"; in EmitAttributes()
700 OS << " }\n"; in EmitAttributes()
701 OS << " }\n"; in EmitAttributes()
702 OS << " return AttributeSet::get(C, makeArrayRef(AS, NumAttrs));\n"; in EmitAttributes()
703 OS << "}\n"; in EmitAttributes()
704 OS << "#endif // GET_INTRINSIC_ATTRIBUTES\n\n"; in EmitAttributes()
711 raw_ostream &OS) { in EmitTargetBuiltins() argument
722 StringMatcher("BuiltinName", Results, OS).Emit(); in EmitTargetBuiltins()
728 raw_ostream &OS) { in EmitIntrinsicToGCCBuiltinMap() argument
743 OS << "// Get the LLVM intrinsic that corresponds to a GCC builtin.\n"; in EmitIntrinsicToGCCBuiltinMap()
744 OS << "// This is used by the C front-end. The GCC builtin name is passed\n"; in EmitIntrinsicToGCCBuiltinMap()
745 OS << "// in as BuiltinName, and a target prefix (e.g. 'ppc') is passed\n"; in EmitIntrinsicToGCCBuiltinMap()
746 OS << "// in as TargetPrefix. The result is assigned to 'IntrinsicID'.\n"; in EmitIntrinsicToGCCBuiltinMap()
747 OS << "#ifdef GET_LLVM_INTRINSIC_FOR_GCC_BUILTIN\n"; in EmitIntrinsicToGCCBuiltinMap()
750 OS << "static " << TargetPrefix << "Intrinsic::ID " in EmitIntrinsicToGCCBuiltinMap()
754 OS << "Intrinsic::ID Intrinsic::getIntrinsicForGCCBuiltin(const char " in EmitIntrinsicToGCCBuiltinMap()
758 OS << " StringRef BuiltinName(BuiltinNameStr);\n"; in EmitIntrinsicToGCCBuiltinMap()
759 OS << " StringRef TargetPrefix(TargetPrefixStr);\n\n"; in EmitIntrinsicToGCCBuiltinMap()
763 OS << " "; in EmitIntrinsicToGCCBuiltinMap()
765 OS << "if (TargetPrefix == \"" << I->first << "\") "; in EmitIntrinsicToGCCBuiltinMap()
767 OS << "/* Target Independent Builtins */ "; in EmitIntrinsicToGCCBuiltinMap()
768 OS << "{\n"; in EmitIntrinsicToGCCBuiltinMap()
771 EmitTargetBuiltins(I->second, TargetPrefix, OS); in EmitIntrinsicToGCCBuiltinMap()
772 OS << " }\n"; in EmitIntrinsicToGCCBuiltinMap()
774 OS << " return "; in EmitIntrinsicToGCCBuiltinMap()
776 OS << "(" << TargetPrefix << "Intrinsic::ID)"; in EmitIntrinsicToGCCBuiltinMap()
777 OS << "Intrinsic::not_intrinsic;\n"; in EmitIntrinsicToGCCBuiltinMap()
778 OS << "}\n"; in EmitIntrinsicToGCCBuiltinMap()
779 OS << "#endif\n\n"; in EmitIntrinsicToGCCBuiltinMap()
784 raw_ostream &OS) { in EmitIntrinsicToMSBuiltinMap() argument
798 OS << "// Get the LLVM intrinsic that corresponds to a MS builtin.\n" in EmitIntrinsicToMSBuiltinMap()
804 OS << (TargetOnly ? "static " + TargetPrefix : "") << "Intrinsic::ID " in EmitIntrinsicToMSBuiltinMap()
807 OS << " StringRef BuiltinName(BN);\n" in EmitIntrinsicToMSBuiltinMap()
812 OS << " "; in EmitIntrinsicToMSBuiltinMap()
814 OS << "/* Target Independent Builtins */ "; in EmitIntrinsicToMSBuiltinMap()
816 OS << "if (TargetPrefix == \"" << Builtins.first << "\") "; in EmitIntrinsicToMSBuiltinMap()
817 OS << "{\n"; in EmitIntrinsicToMSBuiltinMap()
818 EmitTargetBuiltins(Builtins.second, TargetPrefix, OS); in EmitIntrinsicToMSBuiltinMap()
819 OS << "}"; in EmitIntrinsicToMSBuiltinMap()
822 OS << " return "; in EmitIntrinsicToMSBuiltinMap()
824 OS << "(" << TargetPrefix << "Intrinsic::ID)"; in EmitIntrinsicToMSBuiltinMap()
825 OS << "Intrinsic::not_intrinsic;\n"; in EmitIntrinsicToMSBuiltinMap()
826 OS << "}\n"; in EmitIntrinsicToMSBuiltinMap()
828 OS << "#endif\n\n"; in EmitIntrinsicToMSBuiltinMap()
831 void llvm::EmitIntrinsics(RecordKeeper &RK, raw_ostream &OS, bool TargetOnly) { in EmitIntrinsics() argument
832 IntrinsicEmitter(RK, TargetOnly).run(OS); in EmitIntrinsics()