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);
58 raw_ostream &OS);
59 void EmitSuffix(raw_ostream &OS);
67 void IntrinsicEmitter::run(raw_ostream &OS) { in run() argument
68 emitSourceFileHeader("Intrinsic Function Source Fragment", OS); in run()
75 EmitPrefix(OS); in run()
78 EmitEnumInfo(Ints, OS); in run()
81 EmitIntrinsicToNameTable(Ints, OS); in run()
84 EmitIntrinsicToOverloadTable(Ints, OS); in run()
87 EmitFnNameRecognizer(Ints, OS); in run()
90 EmitGenerator(Ints, OS); in run()
93 EmitAttributes(Ints, OS); in run()
96 EmitModRefBehavior(Ints, OS); in run()
99 EmitIntrinsicToGCCBuiltinMap(Ints, OS); in run()
102 EmitIntrinsicToMSBuiltinMap(Ints, OS); in run()
104 EmitSuffix(OS); in run()
107 void IntrinsicEmitter::EmitPrefix(raw_ostream &OS) { in EmitPrefix() argument
108 OS << "// VisualStudio defines setjmp as _setjmp\n" in EmitPrefix()
117 void IntrinsicEmitter::EmitSuffix(raw_ostream &OS) { in EmitSuffix() argument
118 OS << "#if defined(_MSC_VER) && defined(setjmp_undefined_for_msvc)\n" in EmitSuffix()
126 raw_ostream &OS) { in EmitEnumInfo() argument
127 OS << "// Enum values for Intrinsics.h\n"; in EmitEnumInfo()
128 OS << "#ifdef GET_INTRINSIC_ENUM_VALUES\n"; in EmitEnumInfo()
130 OS << " " << Ints[i].EnumName; in EmitEnumInfo()
131 OS << ((i != e-1) ? ", " : " "); in EmitEnumInfo()
132 OS << std::string(40-Ints[i].EnumName.size(), ' ') in EmitEnumInfo()
135 OS << "#endif\n\n"; in EmitEnumInfo()
140 raw_ostream &OS) { in EmitFnNameRecognizer() argument
146 OS << "// Function name -> enum value recognizer code.\n"; in EmitFnNameRecognizer()
147 OS << "#ifdef GET_FUNCTION_RECOGNIZER\n"; in EmitFnNameRecognizer()
148 OS << " StringRef NameR(Name+6, Len-6); // Skip over 'llvm.'\n"; in EmitFnNameRecognizer()
149 OS << " switch (Name[5]) { // Dispatch on first letter.\n"; in EmitFnNameRecognizer()
150 OS << " default: break;\n"; in EmitFnNameRecognizer()
154 OS << " case '" << I->first << "':\n"; in EmitFnNameRecognizer()
180 OS << " if (NameR.startswith(\"" << TheStr << "\")) " in EmitFnNameRecognizer()
185 StringMatcher("NameR", MatchTable, OS).Emit(1); in EmitFnNameRecognizer()
186 OS << " break; // end of '" << I->first << "' case.\n"; in EmitFnNameRecognizer()
189 OS << " }\n"; in EmitFnNameRecognizer()
190 OS << "#endif\n\n"; in EmitFnNameRecognizer()
195 raw_ostream &OS) { in EmitIntrinsicToNameTable() argument
196 OS << "// Intrinsic ID to name table\n"; in EmitIntrinsicToNameTable()
197 OS << "#ifdef GET_INTRINSIC_NAME_TABLE\n"; in EmitIntrinsicToNameTable()
198 OS << " // Note that entry #0 is the invalid intrinsic!\n"; in EmitIntrinsicToNameTable()
200 OS << " \"" << Ints[i].Name << "\",\n"; in EmitIntrinsicToNameTable()
201 OS << "#endif\n\n"; in EmitIntrinsicToNameTable()
206 raw_ostream &OS) { in EmitIntrinsicToOverloadTable() argument
207 OS << "// Intrinsic ID to overload bitset\n"; in EmitIntrinsicToOverloadTable()
208 OS << "#ifdef GET_INTRINSIC_OVERLOAD_TABLE\n"; in EmitIntrinsicToOverloadTable()
209 OS << "static const uint8_t OTable[] = {\n"; in EmitIntrinsicToOverloadTable()
210 OS << " 0"; in EmitIntrinsicToOverloadTable()
214 OS << ",\n 0"; in EmitIntrinsicToOverloadTable()
216 OS << " | (1<<" << (i+1)%8 << ')'; in EmitIntrinsicToOverloadTable()
218 OS << "\n};\n\n"; in EmitIntrinsicToOverloadTable()
220 OS << "return (OTable[id/8] & (1 << (id%8))) != 0;\n"; in EmitIntrinsicToOverloadTable()
221 OS << "#endif\n\n"; in EmitIntrinsicToOverloadTable()
399 static void printIITEntry(raw_ostream &OS, unsigned char X) { in printIITEntry() argument
400 OS << (unsigned)X; in printIITEntry()
404 raw_ostream &OS) { in EmitGenerator() argument
450 OS << "// Global intrinsic function declaration type table.\n"; in EmitGenerator()
451 OS << "#ifdef GET_INTRINSIC_GENERATOR_GLOBAL\n"; in EmitGenerator()
453 OS << "static const unsigned IIT_Table[] = {\n "; in EmitGenerator()
457 OS << "\n "; in EmitGenerator()
461 OS << "0x" << utohexstr(FixedEncodings[i]) << ", "; in EmitGenerator()
471 OS << "(1U<<31) | " << LongEncodingTable.get(TypeSig) << ", "; in EmitGenerator()
474 OS << "0\n};\n\n"; in EmitGenerator()
477 OS << "static const unsigned char IIT_LongEncodingTable[] = {\n"; in EmitGenerator()
479 LongEncodingTable.emit(OS, printIITEntry); in EmitGenerator()
480 OS << " 255\n};\n\n"; in EmitGenerator()
482 OS << "#endif\n\n"; // End of GET_INTRINSIC_GENERATOR_GLOBAL in EmitGenerator()
534 EmitAttributes(const std::vector<CodeGenIntrinsic> &Ints, raw_ostream &OS) { in EmitAttributes() argument
535 OS << "// Add parameter attributes that are not common to all intrinsics.\n"; in EmitAttributes()
536 OS << "#ifdef GET_INTRINSIC_ATTRIBUTES\n"; in EmitAttributes()
538 OS << "static AttributeSet getAttributes(LLVMContext &C, " << TargetPrefix in EmitAttributes()
541 OS << "AttributeSet Intrinsic::getAttributes(LLVMContext &C, ID id) {\n"; in EmitAttributes()
561 OS << " static const uint8_t IntrinsicsToAttributesMap[] = {\n"; in EmitAttributes()
566 OS << " " << UniqAttributes[&intrinsic] << ", // " in EmitAttributes()
569 OS << " };\n\n"; in EmitAttributes()
571 OS << " AttributeSet AS[" << maxArgAttrs+1 << "];\n"; in EmitAttributes()
572 OS << " unsigned NumAttrs = 0;\n"; in EmitAttributes()
573 OS << " if (id != 0) {\n"; in EmitAttributes()
574 OS << " switch(IntrinsicsToAttributesMap[id - "; in EmitAttributes()
576 OS << "Intrinsic::num_intrinsics"; in EmitAttributes()
578 OS << "1"; in EmitAttributes()
579 OS << "]) {\n"; in EmitAttributes()
580 OS << " default: llvm_unreachable(\"Invalid attribute number\");\n"; in EmitAttributes()
583 OS << " case " << I->second << ": {\n"; in EmitAttributes()
596 OS << " const Attribute::AttrKind AttrParam" << argNo + 1 <<"[]= {"; in EmitAttributes()
603 OS << ","; in EmitAttributes()
604 OS << "Attribute::NoCapture"; in EmitAttributes()
609 OS << ","; in EmitAttributes()
610 OS << "Attribute::ReadOnly"; in EmitAttributes()
615 OS << ","; in EmitAttributes()
616 OS << "Attributes::ReadNone"; in EmitAttributes()
623 OS << "};\n"; in EmitAttributes()
624 OS << " AS[" << numAttrs++ << "] = AttributeSet::get(C, " in EmitAttributes()
633 OS << " const Attribute::AttrKind Atts[] = {"; in EmitAttributes()
636 OS << "Attribute::NoUnwind"; in EmitAttributes()
641 OS << ","; in EmitAttributes()
642 OS << "Attribute::NoReturn"; in EmitAttributes()
647 OS << ","; in EmitAttributes()
648 OS << "Attribute::NoDuplicate"; in EmitAttributes()
656 OS << ","; in EmitAttributes()
657 OS << "Attribute::ReadOnly"; in EmitAttributes()
661 OS << ","; in EmitAttributes()
662 OS << "Attribute::ReadNone"; in EmitAttributes()
665 OS << "};\n"; in EmitAttributes()
666 OS << " AS[" << numAttrs++ << "] = AttributeSet::get(C, " in EmitAttributes()
671 OS << " NumAttrs = " << numAttrs << ";\n"; in EmitAttributes()
672 OS << " break;\n"; in EmitAttributes()
673 OS << " }\n"; in EmitAttributes()
675 OS << " return AttributeSet();\n"; in EmitAttributes()
676 OS << " }\n"; in EmitAttributes()
680 OS << " }\n"; in EmitAttributes()
681 OS << " }\n"; in EmitAttributes()
682 OS << " return AttributeSet::get(C, ArrayRef<AttributeSet>(AS, " in EmitAttributes()
684 OS << "}\n"; in EmitAttributes()
685 OS << "#endif // GET_INTRINSIC_ATTRIBUTES\n\n"; in EmitAttributes()
690 EmitModRefBehavior(const std::vector<CodeGenIntrinsic> &Ints, raw_ostream &OS){ in EmitModRefBehavior() argument
691 OS << "// Determine intrinsic alias analysis mod/ref behavior.\n" in EmitModRefBehavior()
696 OS << "static const uint8_t IntrinsicModRefBehavior[] = {\n" in EmitModRefBehavior()
699 OS << " /* " << TargetPrefix << Ints[i].EnumName << " */ "; in EmitModRefBehavior()
702 OS << "DoesNotAccessMemory,\n"; in EmitModRefBehavior()
705 OS << "OnlyReadsArgumentPointees,\n"; in EmitModRefBehavior()
708 OS << "OnlyReadsMemory,\n"; in EmitModRefBehavior()
711 OS << "OnlyAccessesArgumentPointees,\n"; in EmitModRefBehavior()
714 OS << "UnknownModRefBehavior,\n"; in EmitModRefBehavior()
718 OS << "};\n\n" in EmitModRefBehavior()
727 raw_ostream &OS) { in EmitTargetBuiltins() argument
738 StringMatcher("BuiltinName", Results, OS).Emit(); in EmitTargetBuiltins()
744 raw_ostream &OS) { in EmitIntrinsicToGCCBuiltinMap() argument
759 OS << "// Get the LLVM intrinsic that corresponds to a GCC builtin.\n"; in EmitIntrinsicToGCCBuiltinMap()
760 OS << "// This is used by the C front-end. The GCC builtin name is passed\n"; in EmitIntrinsicToGCCBuiltinMap()
761 OS << "// in as BuiltinName, and a target prefix (e.g. 'ppc') is passed\n"; in EmitIntrinsicToGCCBuiltinMap()
762 OS << "// in as TargetPrefix. The result is assigned to 'IntrinsicID'.\n"; in EmitIntrinsicToGCCBuiltinMap()
763 OS << "#ifdef GET_LLVM_INTRINSIC_FOR_GCC_BUILTIN\n"; in EmitIntrinsicToGCCBuiltinMap()
766 OS << "static " << TargetPrefix << "Intrinsic::ID " in EmitIntrinsicToGCCBuiltinMap()
770 OS << "Intrinsic::ID Intrinsic::getIntrinsicForGCCBuiltin(const char " in EmitIntrinsicToGCCBuiltinMap()
774 OS << " StringRef BuiltinName(BuiltinNameStr);\n"; in EmitIntrinsicToGCCBuiltinMap()
775 OS << " StringRef TargetPrefix(TargetPrefixStr);\n\n"; in EmitIntrinsicToGCCBuiltinMap()
779 OS << " "; in EmitIntrinsicToGCCBuiltinMap()
781 OS << "if (TargetPrefix == \"" << I->first << "\") "; in EmitIntrinsicToGCCBuiltinMap()
783 OS << "/* Target Independent Builtins */ "; in EmitIntrinsicToGCCBuiltinMap()
784 OS << "{\n"; in EmitIntrinsicToGCCBuiltinMap()
787 EmitTargetBuiltins(I->second, TargetPrefix, OS); in EmitIntrinsicToGCCBuiltinMap()
788 OS << " }\n"; in EmitIntrinsicToGCCBuiltinMap()
790 OS << " return "; in EmitIntrinsicToGCCBuiltinMap()
792 OS << "(" << TargetPrefix << "Intrinsic::ID)"; in EmitIntrinsicToGCCBuiltinMap()
793 OS << "Intrinsic::not_intrinsic;\n"; in EmitIntrinsicToGCCBuiltinMap()
794 OS << "}\n"; in EmitIntrinsicToGCCBuiltinMap()
795 OS << "#endif\n\n"; in EmitIntrinsicToGCCBuiltinMap()
800 raw_ostream &OS) { in EmitIntrinsicToMSBuiltinMap() argument
814 OS << "// Get the LLVM intrinsic that corresponds to a MS builtin.\n" in EmitIntrinsicToMSBuiltinMap()
820 OS << (TargetOnly ? "static " + TargetPrefix : "") << "Intrinsic::ID " in EmitIntrinsicToMSBuiltinMap()
823 OS << " StringRef BuiltinName(BN);\n" in EmitIntrinsicToMSBuiltinMap()
828 OS << " "; in EmitIntrinsicToMSBuiltinMap()
830 OS << "/* Target Independent Builtins */ "; in EmitIntrinsicToMSBuiltinMap()
832 OS << "if (TargetPrefix == \"" << Builtins.first << "\") "; in EmitIntrinsicToMSBuiltinMap()
833 OS << "{\n"; in EmitIntrinsicToMSBuiltinMap()
834 EmitTargetBuiltins(Builtins.second, TargetPrefix, OS); in EmitIntrinsicToMSBuiltinMap()
835 OS << "}"; in EmitIntrinsicToMSBuiltinMap()
838 OS << " return "; in EmitIntrinsicToMSBuiltinMap()
840 OS << "(" << TargetPrefix << "Intrinsic::ID)"; in EmitIntrinsicToMSBuiltinMap()
841 OS << "Intrinsic::not_intrinsic;\n"; in EmitIntrinsicToMSBuiltinMap()
842 OS << "}\n"; in EmitIntrinsicToMSBuiltinMap()
844 OS << "#endif\n\n"; in EmitIntrinsicToMSBuiltinMap()
847 void llvm::EmitIntrinsics(RecordKeeper &RK, raw_ostream &OS, bool TargetOnly) { in EmitIntrinsics() argument
848 IntrinsicEmitter(RK, TargetOnly).run(OS); in EmitIntrinsics()