summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/Attributes.cpp
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@apple.com>2015-11-13 01:44:32 +0000
committerAkira Hatanaka <ahatanaka@apple.com>2015-11-13 01:44:32 +0000
commit5af7ace4ee9397fe9e1738a144b196fd23868cef (patch)
treec98b569b0836eabbe96ec20661dffdd5a6e15688 /llvm/utils/TableGen/Attributes.cpp
parent560a5faab099c45cead32faf03c825c30ff1e9c8 (diff)
downloadbcm5719-llvm-5af7ace4ee9397fe9e1738a144b196fd23868cef.tar.gz
bcm5719-llvm-5af7ace4ee9397fe9e1738a144b196fd23868cef.zip
Revert r252990.
Some of the buildbots are still failing. llvm-svn: 252999
Diffstat (limited to 'llvm/utils/TableGen/Attributes.cpp')
-rw-r--r--llvm/utils/TableGen/Attributes.cpp95
1 files changed, 0 insertions, 95 deletions
diff --git a/llvm/utils/TableGen/Attributes.cpp b/llvm/utils/TableGen/Attributes.cpp
index 892457a90e9..385a244d74d 100644
--- a/llvm/utils/TableGen/Attributes.cpp
+++ b/llvm/utils/TableGen/Attributes.cpp
@@ -27,12 +27,6 @@ public:
private:
void emitTargetIndependentEnums(raw_ostream &OS);
- void emitFnAttrCompatCheck(raw_ostream &OS, bool IsStringAttr);
-
- void printEnumAttrClasses(raw_ostream &OS,
- const std::vector<Record *> &Records);
- void printStrBoolAttrClasses(raw_ostream &OS,
- const std::vector<Record *> &Records);
RecordKeeper &Records;
};
@@ -52,97 +46,8 @@ void Attributes::emitTargetIndependentEnums(raw_ostream &OS) {
OS << "#endif\n";
}
-void Attributes::emitFnAttrCompatCheck(raw_ostream &OS, bool IsStringAttr) {
- OS << "#ifdef GET_ATTR_COMPAT_FUNC\n";
- OS << "#undef GET_ATTR_COMPAT_FUNC\n";
-
- OS << "struct EnumAttr {\n";
- OS << " static bool isSet(const Function &Fn,\n";
- OS << " Attribute::AttrKind Kind) {\n";
- OS << " return Fn.hasFnAttribute(Kind);\n";
- OS << " }\n\n";
- OS << " static void set(Function &Fn,\n";
- OS << " Attribute::AttrKind Kind, bool Val) {\n";
- OS << " if (Val)\n";
- OS << " Fn.addFnAttr(Kind);\n";
- OS << " else\n";
- OS << " Fn.removeFnAttr(Kind);\n";
- OS << " }\n";
- OS << "};\n\n";
-
- OS << "struct StrBoolAttr {\n";
- OS << " static bool isSet(const Function &Fn,\n";
- OS << " StringRef Kind) {\n";
- OS << " auto A = Fn.getFnAttribute(Kind);\n";
- OS << " return A.getValueAsString().equals(\"true\");\n";
- OS << " }\n\n";
- OS << " static void set(Function &Fn,\n";
- OS << " StringRef Kind, bool Val) {\n";
- OS << " Fn.addFnAttr(Kind, Val ? \"true\" : \"false\");\n";
- OS << " }\n";
- OS << "};\n\n";
-
- printEnumAttrClasses(OS ,Records.getAllDerivedDefinitions("EnumAttr"));
- printStrBoolAttrClasses(OS , Records.getAllDerivedDefinitions("StrBoolAttr"));
-
- OS << "static inline bool hasCompatibleFnAttrs(const Function &Caller,\n"
- << " const Function &Callee) {\n";
- OS << " bool Ret = true;\n\n";
-
- const std::vector<Record *> &CompatRules =
- Records.getAllDerivedDefinitions("CompatRule");
-
- for (auto *Rule : CompatRules) {
- std::string FuncName = Rule->getValueAsString("CompatFunc");
- OS << " Ret &= " << FuncName << "(Caller, Callee);\n";
- }
-
- OS << "\n";
- OS << " return Ret;\n";
- OS << "}\n\n";
-
- const std::vector<Record *> &MergeRules =
- Records.getAllDerivedDefinitions("MergeRule");
- OS << "static inline void mergeFnAttrs(Function &Caller,\n"
- << " const Function &Callee) {\n";
-
- for (auto *Rule : MergeRules) {
- std::string FuncName = Rule->getValueAsString("MergeFunc");
- OS << " " << FuncName << "(Caller, Callee);\n";
- }
-
- OS << "}\n\n";
-
- OS << "#endif\n";
-}
-
-void Attributes::printEnumAttrClasses(raw_ostream &OS,
- const std::vector<Record *> &Records) {
- OS << "// EnumAttr classes\n";
- for (const auto *R : Records) {
- OS << "struct " << R->getName() << "Attr : EnumAttr {\n";
- OS << " constexpr static const enum Attribute::AttrKind Kind = ";
- OS << "Attribute::" << R->getName() << ";\n";
- OS << "};\n";
- }
- OS << "\n";
-}
-
-void Attributes::printStrBoolAttrClasses(raw_ostream &OS,
- const std::vector<Record *> &Records) {
- OS << "// StrBoolAttr classes\n";
- for (const auto *R : Records) {
- OS << "struct " << R->getName() << "Attr : StrBoolAttr {\n";
- OS << " constexpr static const char * const Kind = \"";
- OS << R->getValueAsString("AttrString") << "\";\n";
- OS << "};\n";
- }
- OS << "\n";
-}
-
void Attributes::emit(raw_ostream &OS) {
emitTargetIndependentEnums(OS);
- emitFnAttrCompatCheck(OS, false);
}
namespace llvm {
OpenPOWER on IntegriCloud