diff options
Diffstat (limited to 'llvm/utils/TableGen')
-rw-r--r-- | llvm/utils/TableGen/Basic/DirectiveEmitter.cpp | 6 | ||||
-rw-r--r-- | llvm/utils/TableGen/Basic/RISCVTargetDefEmitter.cpp | 28 | ||||
-rw-r--r-- | llvm/utils/TableGen/Common/Types.cpp | 8 | ||||
-rw-r--r-- | llvm/utils/TableGen/FastISelEmitter.cpp | 2 |
4 files changed, 21 insertions, 23 deletions
diff --git a/llvm/utils/TableGen/Basic/DirectiveEmitter.cpp b/llvm/utils/TableGen/Basic/DirectiveEmitter.cpp index b4d816e..3c6ff11 100644 --- a/llvm/utils/TableGen/Basic/DirectiveEmitter.cpp +++ b/llvm/utils/TableGen/Basic/DirectiveEmitter.cpp @@ -266,10 +266,9 @@ static void emitDirectivesDecl(const RecordKeeper &Records, raw_ostream &OS) { return; StringRef Lang = DirLang.getName(); + IncludeGuardEmitter IncGuard(OS, (Twine("LLVM_") + Lang + "_INC").str()); - OS << "#ifndef LLVM_" << Lang << "_INC\n"; - OS << "#define LLVM_" << Lang << "_INC\n"; - OS << "\n#include \"llvm/ADT/ArrayRef.h\"\n"; + OS << "#include \"llvm/ADT/ArrayRef.h\"\n"; if (DirLang.hasEnableBitmaskEnumInNamespace()) OS << "#include \"llvm/ADT/BitmaskEnum.h\"\n"; @@ -370,7 +369,6 @@ static void emitDirectivesDecl(const RecordKeeper &Records, raw_ostream &OS) { OS << "};\n"; } LlvmNS.close(); - OS << "#endif // LLVM_" << Lang << "_INC\n"; } // Given a list of spellings (for a given clause/directive), order them diff --git a/llvm/utils/TableGen/Basic/RISCVTargetDefEmitter.cpp b/llvm/utils/TableGen/Basic/RISCVTargetDefEmitter.cpp index df14c77..f795937 100644 --- a/llvm/utils/TableGen/Basic/RISCVTargetDefEmitter.cpp +++ b/llvm/utils/TableGen/Basic/RISCVTargetDefEmitter.cpp @@ -68,13 +68,14 @@ static void emitRISCVExtensions(const RecordKeeper &Records, raw_ostream &OS) { if (!Extensions.empty()) { OS << "\nstatic constexpr ImpliedExtsEntry ImpliedExts[] = {\n"; for (const Record *Ext : Extensions) { - auto ImpliesList = Ext->getValueAsListOfDefs("Implies"); + std::vector<const Record *> ImpliesList = + Ext->getValueAsListOfDefs("Implies"); if (ImpliesList.empty()) continue; StringRef Name = getExtensionName(Ext); - for (auto *ImpliedExt : ImpliesList) { + for (const Record *ImpliedExt : ImpliesList) { if (!ImpliedExt->isSubClassOf("RISCVExtension")) continue; @@ -150,11 +151,12 @@ static void emitRISCVProfiles(const RecordKeeper &Records, raw_ostream &OS) { OS << "#ifdef GET_SUPPORTED_PROFILES\n"; OS << "#undef GET_SUPPORTED_PROFILES\n\n"; - auto Profiles = Records.getAllDerivedDefinitionsIfDefined("RISCVProfile"); + ArrayRef<const Record *> Profiles = + Records.getAllDerivedDefinitionsIfDefined("RISCVProfile"); if (!Profiles.empty()) { printProfileTable(OS, Profiles, /*Experimental=*/false); - bool HasExperimentalProfiles = any_of(Profiles, [&](auto &Rec) { + bool HasExperimentalProfiles = any_of(Profiles, [&](const Record *Rec) { return Rec->getValueAsBit("Experimental"); }); if (HasExperimentalProfiles) @@ -173,15 +175,17 @@ static void emitRISCVProcs(const RecordKeeper &RK, raw_ostream &OS) { // Iterate on all definition records. for (const Record *Rec : RK.getAllDerivedDefinitionsIfDefined("RISCVProcessorModel")) { - const std::vector<const Record *> &Features = + std::vector<const Record *> Features = Rec->getValueAsListOfDefs("Features"); - bool FastScalarUnalignedAccess = any_of(Features, [&](auto &Feature) { - return Feature->getValueAsString("Name") == "unaligned-scalar-mem"; - }); - - bool FastVectorUnalignedAccess = any_of(Features, [&](auto &Feature) { - return Feature->getValueAsString("Name") == "unaligned-vector-mem"; - }); + bool FastScalarUnalignedAccess = + any_of(Features, [&](const Record *Feature) { + return Feature->getValueAsString("Name") == "unaligned-scalar-mem"; + }); + + bool FastVectorUnalignedAccess = + any_of(Features, [&](const Record *Feature) { + return Feature->getValueAsString("Name") == "unaligned-vector-mem"; + }); OS << "PROC(" << Rec->getName() << ", {\"" << Rec->getValueAsString("Name") << "\"}, {\""; diff --git a/llvm/utils/TableGen/Common/Types.cpp b/llvm/utils/TableGen/Common/Types.cpp index 35b79b3..8e8d6f6 100644 --- a/llvm/utils/TableGen/Common/Types.cpp +++ b/llvm/utils/TableGen/Common/Types.cpp @@ -8,16 +8,12 @@ #include "Types.h" -// For LLVM_ATTRIBUTE_UNUSED -#include "llvm/Support/Compiler.h" - #include <cassert> using namespace llvm; -const char * -llvm::getMinimalTypeForRange(uint64_t Range, - unsigned MaxSize LLVM_ATTRIBUTE_UNUSED) { +const char *llvm::getMinimalTypeForRange(uint64_t Range, + [[maybe_unused]] unsigned MaxSize) { // TODO: The original callers only used 32 and 64 so these are the only // values permitted. Rather than widen the supported values we should // allow 64 for the callers that currently use 32 and remove the diff --git a/llvm/utils/TableGen/FastISelEmitter.cpp b/llvm/utils/TableGen/FastISelEmitter.cpp index dba8bde..e0be104 100644 --- a/llvm/utils/TableGen/FastISelEmitter.cpp +++ b/llvm/utils/TableGen/FastISelEmitter.cpp @@ -555,7 +555,7 @@ void FastISelMap::collectPatterns(const CodeGenDAGPatterns &CGP) { raw_string_ostream SuffixOS(ManglingSuffix); Operands.PrintManglingSuffix(SuffixOS, ImmediatePredicates, true); if (!StringSwitch<bool>(ManglingSuffix) - .Cases("", "r", "rr", "ri", "i", "f", true) + .Cases({"", "r", "rr", "ri", "i", "f"}, true) .Default(false)) continue; |