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(
"loopModifierPrefix");
56 return Def->getValueAsString(
"clauseEnumSetClass");
60 return Def->getValueAsString(
"flangClauseBaseClass");
64 return Def->getValueAsBit(
"makeEnumAvailableInNamespace");
68 return Def->getValueAsBit(
"enableBitmaskEnumInNamespace");
72 return Records.getAllDerivedDefinitions(
"Association");
76 return Records.getAllDerivedDefinitions(
"Category");
80 return Records.getAllDerivedDefinitions(
"SourceLanguage");
84 return Records.getAllDerivedDefinitions(
"Directive");
88 return Records.getAllDerivedDefinitions(
"Clause");
92 return Records.getAllDerivedDefinitions(
"LoopModifier");
102 return Records.getAllDerivedDefinitions(
"DirectiveLanguage");
109 int64_t Min = R->getValueAsInt(
"minVersion");
115 int64_t Max = R->getValueAsInt(
"maxVersion");
121 constexpr static int IntWidth = 8 *
sizeof(int);
158 std::vector<Spelling::Value>
List;
160 std::back_inserter(
List),
161 [](
const Record *R) { return Spelling(R).get(); });
186 std::string
N = Name.str();
196 std::string Camel = Name.str();
200 if (Sep.contains(C)) {
201 assert(!Cap &&
"No initial or repeated separators");
211 for (
size_t In = 0, End = Camel.size(); In != End; ++In) {
212 unsigned char C = Camel[In];
213 if (!Sep.contains(
C))
221 if (
auto maybeName =
Def->getValueAsOptionalString(
"name"))
244 return Def->getValueAsListOfDefs(
"allowedClauses");
248 return Def->getValueAsListOfDefs(
"allowedOnceClauses");
252 return Def->getValueAsListOfDefs(
"allowedExclusiveClauses");
256 return Def->getValueAsListOfDefs(
"requiredClauses");
260 return Def->getValueAsListOfDefs(
"leafConstructs");
264 return Def->getValueAsDef(
"association");
270 return Def->getValueAsListOfDefs(
"languages");
274 return Def->getValueAsListOfDefs(
"allowedLoopModifiers");
282 if (Name ==
"unknown")
297 return Def->getValueAsString(
"clangClass");
302 return Def->getValueAsString(
"flangClass");
319 if (
StringRef ClangSpelling =
Def->getValueAsString(
"clangAccSpelling");
320 !ClangSpelling.empty())
321 return ClangSpelling.str();
329 return Def->getValueAsString(
"enumClauseValue");
333 return Def->getValueAsListOfDefs(
"allowedClauseValues");
337 return Def->getValueAsBit(
"skipFlangUnparser");
345 return Def->getValueAsString(
"defaultValue");
351 return Def->getValueAsListOfStrings(
"aliases");
357 return Def->getValueAsBit(
"isPrefixOptional");
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
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
StringRef getLoopModifierPrefix() const
ArrayRef< const Record * > getDirectives() const
ArrayRef< const Record * > getClauses() const
ArrayRef< const Record * > getLoopModifiers() 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::vector< const Record * > getAllowedLoopModifiers() 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
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.