1 //===- Attributes.cpp - Generate attributes -------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "llvm/Support/SourceMgr.h"
11 #include "llvm/Support/MemoryBuffer.h"
12 #include "llvm/TableGen/Error.h"
13 #include "llvm/TableGen/Record.h"
19 #define DEBUG_TYPE "attr-enum"
25 Attributes(RecordKeeper &R) : Records(R) {}
26 void emit(raw_ostream &OS);
29 void emitTargetIndependentEnums(raw_ostream &OS);
31 RecordKeeper &Records;
34 } // End anonymous namespace.
36 void Attributes::emitTargetIndependentEnums(raw_ostream &OS) {
37 OS << "#ifdef GET_ATTR_ENUM\n";
38 OS << "#undef GET_ATTR_ENUM\n";
40 const std::vector<Record*> &Attrs =
41 Records.getAllDerivedDefinitions("EnumAttr");
44 OS << A->getName() << ",\n";
49 void Attributes::emit(raw_ostream &OS) {
50 emitTargetIndependentEnums(OS);
55 void EmitAttributes(RecordKeeper &RK, raw_ostream &OS) {
56 Attributes(RK).emit(OS);
59 } // End llvm namespace.