Skip to content

[LLVM][TableGen] Rename Option emitter files #109216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

jurahul
Copy link
Contributor

@jurahul jurahul commented Sep 18, 2024

Rename OptXXXEmitter.cpp to OptionXXXEmitter.cpp to have a less ambiguous
name, as Opt could also mean optimization.

Rename OptXXXEmitter.cpp to OptionXXXEmitter.cpp to have a less
ambiguious name, as `Opt` could also mean optimization.
@@ -572,5 +572,5 @@ static void EmitOptParser(const RecordKeeper &Records, raw_ostream &OS) {
OS << "\n";
}

static TableGen::Emitter::Opt X("gen-opt-parser-defs", EmitOptParser,
static TableGen::Emitter::Opt X("gen-opt-parser-defs", EmitOptionParser,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not renaming the option yet as that can cause lot of changes potentially. I could look into allowing register an alias of the option in the TG backend, but not sure if it's worth it.

@jurahul jurahul marked this pull request as ready for review September 19, 2024 02:53
@jurahul jurahul changed the title [LLVM][TableGen] Rename Option emitter files. [LLVM][TableGen] Rename Option emitter files Sep 19, 2024
@jurahul
Copy link
Contributor Author

jurahul commented Sep 23, 2024

Friendly ping @kazutakahirata and @topperc

@jurahul jurahul requested review from nikic and arsenm September 24, 2024 19:23
@llvmbot
Copy link
Member

llvmbot commented Sep 24, 2024

@llvm/pr-subscribers-tablegen

Author: Rahul Joshi (jurahul)

Changes

Rename OptXXXEmitter.cpp to OptionXXXEmitter.cpp to have a less ambiguous
name, as Opt could also mean optimization.


Full diff: https://github.com/llvm/llvm-project/pull/109216.diff

6 Files Affected:

  • (modified) llvm/include/llvm/Option/OptTable.h (+1-1)
  • (modified) llvm/unittests/Option/OptionMarshallingTest.cpp (+1-1)
  • (modified) llvm/utils/TableGen/CMakeLists.txt (+2-2)
  • (renamed) llvm/utils/TableGen/OptionParserEmitter.cpp (+4-4)
  • (renamed) llvm/utils/TableGen/OptionRSTEmitter.cpp (+5-5)
  • (modified) llvm/utils/gn/secondary/llvm/utils/TableGen/BUILD.gn (+2-2)
diff --git a/llvm/include/llvm/Option/OptTable.h b/llvm/include/llvm/Option/OptTable.h
index d8bf292bac21aa..8fabc78d81aedf 100644
--- a/llvm/include/llvm/Option/OptTable.h
+++ b/llvm/include/llvm/Option/OptTable.h
@@ -64,7 +64,7 @@ class OptTable {
     // the program, HelpText is used instead. This cannot use std::vector
     // because OptTable is used in constexpr contexts. Increase the array sizes
     // here if you need more entries and adjust the constants in
-    // OptParserEmitter::EmitHelpTextsForVariants.
+    // OptionParserEmitter::EmitHelpTextsForVariants.
     std::array<std::pair<std::array<unsigned int, 2 /*MaxVisibilityPerHelp*/>,
                          const char *>,
                1 /*MaxVisibilityHelp*/>
diff --git a/llvm/unittests/Option/OptionMarshallingTest.cpp b/llvm/unittests/Option/OptionMarshallingTest.cpp
index 0464e27d5248a8..2ec422f1a09843 100644
--- a/llvm/unittests/Option/OptionMarshallingTest.cpp
+++ b/llvm/unittests/Option/OptionMarshallingTest.cpp
@@ -1,4 +1,4 @@
-//===- unittest/Support/OptionMarshallingTest.cpp - OptParserEmitter tests ===//
+//===- OptionMarshallingTest.cpp - OptionParserEmitter tests -================//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
diff --git a/llvm/utils/TableGen/CMakeLists.txt b/llvm/utils/TableGen/CMakeLists.txt
index abebb98761d06e..ba1e4aa01b48d6 100644
--- a/llvm/utils/TableGen/CMakeLists.txt
+++ b/llvm/utils/TableGen/CMakeLists.txt
@@ -59,8 +59,8 @@ add_tablegen(llvm-tblgen LLVM
   InstrInfoEmitter.cpp
   IntrinsicEmitter.cpp
   MacroFusionPredicatorEmitter.cpp
-  OptParserEmitter.cpp
-  OptRSTEmitter.cpp
+  OptionParserEmitter.cpp
+  OptionRSTEmitter.cpp
   PseudoLoweringEmitter.cpp
   RegisterBankEmitter.cpp
   RegisterInfoEmitter.cpp
diff --git a/llvm/utils/TableGen/OptParserEmitter.cpp b/llvm/utils/TableGen/OptionParserEmitter.cpp
similarity index 98%
rename from llvm/utils/TableGen/OptParserEmitter.cpp
rename to llvm/utils/TableGen/OptionParserEmitter.cpp
index 79cbf51514ae5c..5ae6f773a3c603 100644
--- a/llvm/utils/TableGen/OptParserEmitter.cpp
+++ b/llvm/utils/TableGen/OptionParserEmitter.cpp
@@ -1,4 +1,4 @@
-//===- OptParserEmitter.cpp - Table Driven Command Line Parsing -----------===//
+//===- OptionParserEmitter.cpp - Table Driven Command Option Line Parsing -===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -247,10 +247,10 @@ static void EmitHelpTextsForVariants(
   OS << " }})";
 }
 
-/// OptParserEmitter - This tablegen backend takes an input .td file
+/// OptionParserEmitter - This tablegen backend takes an input .td file
 /// describing a list of options and emits a data structure for parsing and
 /// working with those options when given an input command line.
-static void EmitOptParser(const RecordKeeper &Records, raw_ostream &OS) {
+static void EmitOptionParser(const RecordKeeper &Records, raw_ostream &OS) {
   // Get the option groups and options.
   ArrayRef<const Record *> Groups =
       Records.getAllDerivedDefinitions("OptionGroup");
@@ -572,5 +572,5 @@ static void EmitOptParser(const RecordKeeper &Records, raw_ostream &OS) {
   OS << "\n";
 }
 
-static TableGen::Emitter::Opt X("gen-opt-parser-defs", EmitOptParser,
+static TableGen::Emitter::Opt X("gen-opt-parser-defs", EmitOptionParser,
                                 "Generate option definitions");
diff --git a/llvm/utils/TableGen/OptRSTEmitter.cpp b/llvm/utils/TableGen/OptionRSTEmitter.cpp
similarity index 89%
rename from llvm/utils/TableGen/OptRSTEmitter.cpp
rename to llvm/utils/TableGen/OptionRSTEmitter.cpp
index 16125198a7c387..b798896a80963e 100644
--- a/llvm/utils/TableGen/OptRSTEmitter.cpp
+++ b/llvm/utils/TableGen/OptionRSTEmitter.cpp
@@ -1,4 +1,4 @@
-//===- OptParserEmitter.cpp - Table Driven Command Line Parsing -----------===//
+//===- OptionRSTEmitter.cpp - Table Driven Command Line Option Parsing ----===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -14,9 +14,9 @@
 
 using namespace llvm;
 
-/// OptParserEmitter - This tablegen backend takes an input .td file
-/// describing a list of options and emits a RST man page.
-static void EmitOptRST(const RecordKeeper &Records, raw_ostream &OS) {
+/// This tablegen backend takes an input .td file describing a list of options
+/// and emits a RST man page.
+static void EmitOptionRST(const RecordKeeper &Records, raw_ostream &OS) {
   llvm::StringMap<std::vector<const Record *>> OptionsByGroup;
   std::vector<Record *> OptionsWithoutGroup;
 
@@ -97,5 +97,5 @@ static void EmitOptRST(const RecordKeeper &Records, raw_ostream &OS) {
   }
 }
 
-static TableGen::Emitter::Opt X("gen-opt-rst", EmitOptRST,
+static TableGen::Emitter::Opt X("gen-opt-rst", EmitOptionRST,
                                 "Generate option RST");
diff --git a/llvm/utils/gn/secondary/llvm/utils/TableGen/BUILD.gn b/llvm/utils/gn/secondary/llvm/utils/TableGen/BUILD.gn
index 2e11d25767cd00..e93250d7f0b7c4 100644
--- a/llvm/utils/gn/secondary/llvm/utils/TableGen/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/utils/TableGen/BUILD.gn
@@ -56,8 +56,8 @@ executable("llvm-tblgen") {
     "InstrDocsEmitter.cpp",
     "InstrInfoEmitter.cpp",
     "MacroFusionPredicatorEmitter.cpp",
-    "OptParserEmitter.cpp",
-    "OptRSTEmitter.cpp",
+    "OptionParserEmitter.cpp",
+    "OptionRSTEmitter.cpp",
     "PseudoLoweringEmitter.cpp",
     "RegisterBankEmitter.cpp",
     "RegisterInfoEmitter.cpp",

@jurahul jurahul merged commit bde2357 into llvm:main Sep 24, 2024
12 checks passed
@jurahul jurahul deleted the nfc_rename_optemitter_files branch September 24, 2024 23:54
@llvm-ci
Copy link
Collaborator

llvm-ci commented Sep 25, 2024

LLVM Buildbot has detected a new failure on builder lld-x86_64-win running on as-worker-93 while building llvm at step 7 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/146/builds/1231

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests.exe/35/87' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe-LLVM-Unit-21020-35-87.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=87 GTEST_SHARD_INDEX=35 C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe
--

Script:
--
C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe --gtest_filter=ProgramEnvTest.CreateProcessLongPath
--
C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp(160): error: Expected equality of these values:
  0
  RC
    Which is: -2

C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp(163): error: fs::remove(Twine(LongPath)): did not return errc::success.
error number: 13
error message: permission denied



C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp:160
Expected equality of these values:
  0
  RC
    Which is: -2

C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp:163
fs::remove(Twine(LongPath)): did not return errc::success.
error number: 13
error message: permission denied




********************


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants