#include "llvm/TableGen/DirectiveEmitter.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/TableGen/Error.h"
#include "llvm/TableGen/Record.h"
#include "llvm/TableGen/TableGenBackend.h"
#include <numeric>
#include <vector>
usingnamespacellvm;
namespace {
class IfDefScope { … };
}
static void GenerateEnumClass(ArrayRef<const Record *> Records, raw_ostream &OS,
StringRef Enum, StringRef Prefix,
const DirectiveLanguage &DirLang,
bool ExportEnums) { … }
static void GenerateEnumClauseVal(ArrayRef<const Record *> Records,
raw_ostream &OS,
const DirectiveLanguage &DirLang,
std::string &EnumHelperFuncs) { … }
static bool HasDuplicateClauses(ArrayRef<const Record *> Clauses,
const Directive &Directive,
StringSet<> &CrtClauses) { … }
static bool
HasDuplicateClausesInDirectives(ArrayRef<const Record *> Directives) { … }
bool DirectiveLanguage::HasValidityErrors() const { … }
static size_t GetMaxLeafCount(const DirectiveLanguage &DirLang) { … }
static void EmitDirectivesDecl(const RecordKeeper &Records, raw_ostream &OS) { … }
static void GenerateGetName(ArrayRef<const Record *> Records, raw_ostream &OS,
StringRef Enum, const DirectiveLanguage &DirLang,
StringRef Prefix) { … }
static void GenerateGetKind(ArrayRef<const Record *> Records, raw_ostream &OS,
StringRef Enum, const DirectiveLanguage &DirLang,
StringRef Prefix, bool ImplicitAsUnknown) { … }
static void GenerateGetKindClauseVal(const DirectiveLanguage &DirLang,
raw_ostream &OS) { … }
static void GenerateCaseForVersionedClauses(ArrayRef<const Record *> Clauses,
raw_ostream &OS,
StringRef DirectiveName,
const DirectiveLanguage &DirLang,
StringSet<> &Cases) { … }
static std::string GetDirectiveName(const DirectiveLanguage &DirLang,
const Record *Rec) { … }
static std::string GetDirectiveType(const DirectiveLanguage &DirLang) { … }
static void GenerateIsAllowedClause(const DirectiveLanguage &DirLang,
raw_ostream &OS) { … }
static void EmitLeafTable(const DirectiveLanguage &DirLang, raw_ostream &OS,
StringRef TableName) { … }
static void GenerateGetDirectiveAssociation(const DirectiveLanguage &DirLang,
raw_ostream &OS) { … }
static void GenerateGetDirectiveCategory(const DirectiveLanguage &DirLang,
raw_ostream &OS) { … }
static void GenerateClauseSet(ArrayRef<const Record *> Clauses, raw_ostream &OS,
StringRef ClauseSetPrefix, const Directive &Dir,
const DirectiveLanguage &DirLang) { … }
static void GenerateDirectiveClauseSets(const DirectiveLanguage &DirLang,
raw_ostream &OS) { … }
static void GenerateDirectiveClauseMap(const DirectiveLanguage &DirLang,
raw_ostream &OS) { … }
static void GenerateFlangClauseParserClass(const DirectiveLanguage &DirLang,
raw_ostream &OS) { … }
static void GenerateFlangClauseParserClassList(const DirectiveLanguage &DirLang,
raw_ostream &OS) { … }
static void GenerateFlangClauseDump(const DirectiveLanguage &DirLang,
raw_ostream &OS) { … }
static void GenerateFlangClauseUnparse(const DirectiveLanguage &DirLang,
raw_ostream &OS) { … }
static void GenerateFlangClauseCheckPrototypes(const DirectiveLanguage &DirLang,
raw_ostream &OS) { … }
static void GenerateFlangClauseParserKindMap(const DirectiveLanguage &DirLang,
raw_ostream &OS) { … }
static bool compareClauseName(const Record *R1, const Record *R2) { … }
static void GenerateFlangClausesParser(const DirectiveLanguage &DirLang,
raw_ostream &OS) { … }
static void EmitDirectivesFlangImpl(const DirectiveLanguage &DirLang,
raw_ostream &OS) { … }
static void GenerateClauseClassMacro(const DirectiveLanguage &DirLang,
raw_ostream &OS) { … }
void EmitDirectivesBasicImpl(const DirectiveLanguage &DirLang,
raw_ostream &OS) { … }
static void EmitDirectivesImpl(const RecordKeeper &Records, raw_ostream &OS) { … }
static TableGen::Emitter::Opt
X("gen-directive-decl", EmitDirectivesDecl,
"Generate directive related declaration code (header file)");
static TableGen::Emitter::Opt
Y("gen-directive-impl", EmitDirectivesImpl,
"Generate directive related implementation code");