• Home
  • Raw
  • Download

Lines Matching refs:OS

26   void emit(raw_ostream &OS);
29 void emitTargetIndependentEnums(raw_ostream &OS);
30 void emitConversionFn(raw_ostream &OS);
31 void emitFnAttrCompatCheck(raw_ostream &OS, bool IsStringAttr);
33 void printEnumAttrClasses(raw_ostream &OS,
35 void printStrBoolAttrClasses(raw_ostream &OS,
43 void Attributes::emitTargetIndependentEnums(raw_ostream &OS) { in emitTargetIndependentEnums() argument
44 OS << "#ifdef GET_ATTR_ENUM\n"; in emitTargetIndependentEnums()
45 OS << "#undef GET_ATTR_ENUM\n"; in emitTargetIndependentEnums()
51 OS << A->getName() << ",\n"; in emitTargetIndependentEnums()
53 OS << "#endif\n"; in emitTargetIndependentEnums()
56 void Attributes::emitConversionFn(raw_ostream &OS) { in emitConversionFn() argument
57 OS << "#ifdef GET_ATTR_KIND_FROM_NAME\n"; in emitConversionFn()
58 OS << "#undef GET_ATTR_KIND_FROM_NAME\n"; in emitConversionFn()
63 OS << "static Attribute::AttrKind getAttrKindFromName(StringRef AttrName) {\n"; in emitConversionFn()
64 OS << " return StringSwitch<Attribute::AttrKind>(AttrName)\n"; in emitConversionFn()
67 OS << " .Case(\"" << A->getValueAsString("AttrString"); in emitConversionFn()
68 OS << "\", Attribute::" << A->getName() << ")\n"; in emitConversionFn()
71 OS << " .Default(Attribute::None);\n"; in emitConversionFn()
72 OS << "}\n\n"; in emitConversionFn()
74 OS << "#endif\n"; in emitConversionFn()
77 void Attributes::emitFnAttrCompatCheck(raw_ostream &OS, bool IsStringAttr) { in emitFnAttrCompatCheck() argument
78 OS << "#ifdef GET_ATTR_COMPAT_FUNC\n"; in emitFnAttrCompatCheck()
79 OS << "#undef GET_ATTR_COMPAT_FUNC\n"; in emitFnAttrCompatCheck()
81 OS << "struct EnumAttr {\n"; in emitFnAttrCompatCheck()
82 OS << " static bool isSet(const Function &Fn,\n"; in emitFnAttrCompatCheck()
83 OS << " Attribute::AttrKind Kind) {\n"; in emitFnAttrCompatCheck()
84 OS << " return Fn.hasFnAttribute(Kind);\n"; in emitFnAttrCompatCheck()
85 OS << " }\n\n"; in emitFnAttrCompatCheck()
86 OS << " static void set(Function &Fn,\n"; in emitFnAttrCompatCheck()
87 OS << " Attribute::AttrKind Kind, bool Val) {\n"; in emitFnAttrCompatCheck()
88 OS << " if (Val)\n"; in emitFnAttrCompatCheck()
89 OS << " Fn.addFnAttr(Kind);\n"; in emitFnAttrCompatCheck()
90 OS << " else\n"; in emitFnAttrCompatCheck()
91 OS << " Fn.removeFnAttr(Kind);\n"; in emitFnAttrCompatCheck()
92 OS << " }\n"; in emitFnAttrCompatCheck()
93 OS << "};\n\n"; in emitFnAttrCompatCheck()
95 OS << "struct StrBoolAttr {\n"; in emitFnAttrCompatCheck()
96 OS << " static bool isSet(const Function &Fn,\n"; in emitFnAttrCompatCheck()
97 OS << " StringRef Kind) {\n"; in emitFnAttrCompatCheck()
98 OS << " auto A = Fn.getFnAttribute(Kind);\n"; in emitFnAttrCompatCheck()
99 OS << " return A.getValueAsString().equals(\"true\");\n"; in emitFnAttrCompatCheck()
100 OS << " }\n\n"; in emitFnAttrCompatCheck()
101 OS << " static void set(Function &Fn,\n"; in emitFnAttrCompatCheck()
102 OS << " StringRef Kind, bool Val) {\n"; in emitFnAttrCompatCheck()
103 OS << " Fn.addFnAttr(Kind, Val ? \"true\" : \"false\");\n"; in emitFnAttrCompatCheck()
104 OS << " }\n"; in emitFnAttrCompatCheck()
105 OS << "};\n\n"; in emitFnAttrCompatCheck()
107 printEnumAttrClasses(OS ,Records.getAllDerivedDefinitions("EnumAttr")); in emitFnAttrCompatCheck()
108 printStrBoolAttrClasses(OS , Records.getAllDerivedDefinitions("StrBoolAttr")); in emitFnAttrCompatCheck()
110 OS << "static inline bool hasCompatibleFnAttrs(const Function &Caller,\n" in emitFnAttrCompatCheck()
112 OS << " bool Ret = true;\n\n"; in emitFnAttrCompatCheck()
119 OS << " Ret &= " << FuncName << "(Caller, Callee);\n"; in emitFnAttrCompatCheck()
122 OS << "\n"; in emitFnAttrCompatCheck()
123 OS << " return Ret;\n"; in emitFnAttrCompatCheck()
124 OS << "}\n\n"; in emitFnAttrCompatCheck()
128 OS << "static inline void mergeFnAttrs(Function &Caller,\n" in emitFnAttrCompatCheck()
133 OS << " " << FuncName << "(Caller, Callee);\n"; in emitFnAttrCompatCheck()
136 OS << "}\n\n"; in emitFnAttrCompatCheck()
138 OS << "#endif\n"; in emitFnAttrCompatCheck()
141 void Attributes::printEnumAttrClasses(raw_ostream &OS, in printEnumAttrClasses() argument
143 OS << "// EnumAttr classes\n"; in printEnumAttrClasses()
145 OS << "struct " << R->getName() << "Attr : EnumAttr {\n"; in printEnumAttrClasses()
146 OS << " static enum Attribute::AttrKind getKind() {\n"; in printEnumAttrClasses()
147 OS << " return llvm::Attribute::" << R->getName() << ";\n"; in printEnumAttrClasses()
148 OS << " }\n"; in printEnumAttrClasses()
149 OS << "};\n"; in printEnumAttrClasses()
151 OS << "\n"; in printEnumAttrClasses()
154 void Attributes::printStrBoolAttrClasses(raw_ostream &OS, in printStrBoolAttrClasses() argument
156 OS << "// StrBoolAttr classes\n"; in printStrBoolAttrClasses()
158 OS << "struct " << R->getName() << "Attr : StrBoolAttr {\n"; in printStrBoolAttrClasses()
159 OS << " static const char *getKind() {\n"; in printStrBoolAttrClasses()
160 OS << " return \"" << R->getValueAsString("AttrString") << "\";\n"; in printStrBoolAttrClasses()
161 OS << " }\n"; in printStrBoolAttrClasses()
162 OS << "};\n"; in printStrBoolAttrClasses()
164 OS << "\n"; in printStrBoolAttrClasses()
167 void Attributes::emit(raw_ostream &OS) { in emit() argument
168 emitTargetIndependentEnums(OS); in emit()
169 emitConversionFn(OS); in emit()
170 emitFnAttrCompatCheck(OS, false); in emit()
175 void EmitAttributes(RecordKeeper &RK, raw_ostream &OS) { in EmitAttributes() argument
176 Attributes(RK).emit(OS); in EmitAttributes()