14#ifndef LLVM_TABLEGEN_DIRECTIVEEMITTER_H
15#define LLVM_TABLEGEN_DIRECTIVEEMITTER_H
33 const auto &DirectiveLanguages = getDirectiveLanguages();
34 Def = DirectiveLanguages[0];
40 return Def->getValueAsString(
"cppNamespace");
44 return Def->getValueAsString(
"directivePrefix");
48 return Def->getValueAsString(
"clausePrefix");
52 return Def->getValueAsString(
"clauseEnumSetClass");
56 return Def->getValueAsString(
"flangClauseBaseClass");
60 return Def->getValueAsBit(
"makeEnumAvailableInNamespace");
64 return Def->getValueAsBit(
"enableBitmaskEnumInNamespace");
68 return Records.getAllDerivedDefinitions(
"Association");
72 return Records.getAllDerivedDefinitions(
"Category");
76 return Records.getAllDerivedDefinitions(
"SourceLanguage");
80 return Records.getAllDerivedDefinitions(
"Directive");
84 return Records.getAllDerivedDefinitions(
"Clause");
94 return Records.getAllDerivedDefinitions(
"DirectiveLanguage");
101 int64_t Min = R->getValueAsInt(
"minVersion");
107 int64_t Max = R->getValueAsInt(
"maxVersion");
113 constexpr static int IntWidth = 8 *
sizeof(int);
150 std::vector<Spelling::Value>
List;
152 std::back_inserter(
List),
153 [](
const Record *R) { return Spelling(R).get(); });
178 std::string
N = Name.str();
188 std::string Camel = Name.str();
192 if (Sep.contains(C)) {
193 assert(!Cap &&
"No initial or repeated separators");
203 for (
size_t In = 0, End = Camel.size(); In != End; ++In) {
204 unsigned char C = Camel[In];
205 if (!Sep.contains(
C))
213 if (
auto maybeName =
Def->getValueAsOptionalString(
"name"))
236 return Def->getValueAsListOfDefs(
"allowedClauses");
240 return Def->getValueAsListOfDefs(
"allowedOnceClauses");
244 return Def->getValueAsListOfDefs(
"allowedExclusiveClauses");
248 return Def->getValueAsListOfDefs(
"requiredClauses");
252 return Def->getValueAsListOfDefs(
"leafConstructs");
256 return Def->getValueAsDef(
"association");
262 return Def->getValueAsListOfDefs(
"languages");
270 if (Name ==
"unknown")
285 return Def->getValueAsString(
"clangClass");
290 return Def->getValueAsString(
"flangClass");
307 if (
StringRef ClangSpelling =
Def->getValueAsString(
"clangAccSpelling");
308 !ClangSpelling.empty())
309 return ClangSpelling.str();
317 return Def->getValueAsString(
"enumClauseValue");
321 return Def->getValueAsListOfDefs(
"allowedClauseValues");
325 return Def->getValueAsBit(
"skipFlangUnparser");
333 return Def->getValueAsString(
"defaultValue");
339 return Def->getValueAsListOfStrings(
"aliases");
345 return Def->getValueAsBit(
"isPrefixOptional");
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
StringRef getSpellingForIdentifier() const
static std::string getSnakeName(StringRef Name)
StringRef getRecordName() const
static std::string getUpperCamelName(StringRef Name, StringRef Sep)
std::string getFormattedName() const
std::vector< Spelling::Value > getSpellings() const
BaseRecord(const Record *Def)
const Record * getRecord() const
StringRef getClangClass() const
std::vector< const Record * > getClauseVals() const
bool skipFlangUnparser() const
Clause(const Record *Def)
StringRef getDefaultValue() const
bool isValueOptional() const
StringRef getFlangClass() const
std::vector< StringRef > getAliases() const
std::string getClangAccSpelling() const
StringRef getEnumName() const
bool isPrefixOptional() const
std::string getFormattedParserClassName() const
StringRef getPrefix() const
bool hasMakeEnumAvailableInNamespace() const
bool HasValidityErrors() const
StringRef getClausePrefix() const
StringRef getClauseEnumSetClass() const
DirectiveLanguage(const RecordKeeper &Records)
ArrayRef< const Record * > getAssociations() const
ArrayRef< const Record * > getDirectives() const
ArrayRef< const Record * > getClauses() const
StringRef getName() const
ArrayRef< const Record * > getCategories() const
StringRef getDirectivePrefix() const
bool hasEnableBitmaskEnumInNamespace() const
StringRef getCppNamespace() const
ArrayRef< const Record * > getSourceLanguages() const
StringRef getFlangClauseBaseClass() const
const Record * getAssociation() const
std::vector< const Record * > getLeafConstructs() const
const Record * getCategory() const
std::vector< const Record * > getAllowedClauses() const
Directive(const Record *Def)
std::vector< const Record * > getAllowedOnceClauses() const
std::vector< const Record * > getRequiredClauses() const
std::vector< const Record * > getSourceLanguages() const
std::string getClangAccSpelling() const
std::vector< const Record * > getAllowedExclusiveClauses() const
bool isUserVisible() const
EnumVal(const Record *Def)
Spelling(const Record *Def)
StringRef getText() const
directive::Spelling Value
llvm::directive::VersionRange getVersions() const
StringRef - Represent a constant reference to a string, i.e.
int64_t getMinVersion() const
int64_t getMaxVersion() const
VersionedClause(const Record *Def)
int getMinVersion(const Record *R) const
int getMaxVersion(const Record *R) const
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
constexpr bool isInt(int64_t x)
Checks if an integer fits into the given bit width.
OutputIt transform(R &&Range, OutputIt d_first, UnaryFunction F)
Wrapper function around std::transform to apply a function to a range and store the result elsewhere.
void replace(R &&Range, const T &OldValue, const T &NewValue)
Provide wrappers to std::replace which take ranges instead of having to pass begin/end explicitly.
char toUpper(char x)
Returns the corresponding uppercase character if x is lowercase.