14#ifndef LLVM_TABLEGEN_DIRECTIVEEMITTER_H
15#define LLVM_TABLEGEN_DIRECTIVEEMITTER_H
34 const auto &DirectiveLanguages = getDirectiveLanguages();
35 Def = DirectiveLanguages[0];
41 return Def->getValueAsString(
"cppNamespace");
45 return Def->getValueAsString(
"directivePrefix");
49 return Def->getValueAsString(
"clausePrefix");
53 return Def->getValueAsString(
"clauseEnumSetClass");
57 return Def->getValueAsString(
"flangClauseBaseClass");
61 return Def->getValueAsBit(
"makeEnumAvailableInNamespace");
65 return Def->getValueAsBit(
"enableBitmaskEnumInNamespace");
69 return Records.getAllDerivedDefinitions(
"Association");
73 return Records.getAllDerivedDefinitions(
"Category");
77 return Records.getAllDerivedDefinitions(
"SourceLanguage");
81 return Records.getAllDerivedDefinitions(
"Directive");
85 return Records.getAllDerivedDefinitions(
"Clause");
95 return Records.getAllDerivedDefinitions(
"DirectiveLanguage");
102 int64_t Min = R->getValueAsInt(
"minVersion");
108 int64_t Max = R->getValueAsInt(
"maxVersion");
114 constexpr static int IntWidth = 8 *
sizeof(int);
151 std::vector<Spelling::Value>
List;
153 std::back_inserter(
List),
154 [](
const Record *R) { return Spelling(R).get(); });
179 std::string
N = Name.str();
189 std::string Camel = Name.str();
193 if (Sep.contains(C)) {
194 assert(!Cap &&
"No initial or repeated separators");
204 for (
size_t In = 0, End = Camel.size(); In != End; ++In) {
205 unsigned char C = Camel[In];
206 if (!Sep.contains(
C))
214 if (
auto maybeName =
Def->getValueAsOptionalString(
"name"))
237 return Def->getValueAsListOfDefs(
"allowedClauses");
241 return Def->getValueAsListOfDefs(
"allowedOnceClauses");
245 return Def->getValueAsListOfDefs(
"allowedExclusiveClauses");
249 return Def->getValueAsListOfDefs(
"requiredClauses");
253 return Def->getValueAsListOfDefs(
"leafConstructs");
257 return Def->getValueAsDef(
"association");
263 return Def->getValueAsListOfDefs(
"languages");
271 if (Name ==
"unknown")
286 return Def->getValueAsString(
"clangClass");
291 return Def->getValueAsString(
"flangClass");
308 if (
StringRef ClangSpelling =
Def->getValueAsString(
"clangAccSpelling");
309 !ClangSpelling.empty())
310 return ClangSpelling.str();
318 return Def->getValueAsString(
"enumClauseValue");
322 return Def->getValueAsListOfDefs(
"allowedClauseValues");
326 return Def->getValueAsBit(
"skipFlangUnparser");
334 return Def->getValueAsString(
"defaultValue");
340 return Def->getValueAsListOfStrings(
"aliases");
346 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.