[llvm] [LLVM][TableGen] Rename Option emitter files. (PR #109216)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 18 16:00:03 PDT 2024


https://github.com/jurahul created https://github.com/llvm/llvm-project/pull/109216

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

>From 9b2bdfeaa613b67d2ae8f260f92de5a9ac3d320c Mon Sep 17 00:00:00 2001
From: Rahul Joshi <rjoshi at nvidia.com>
Date: Wed, 18 Sep 2024 15:57:31 -0700
Subject: [PATCH] [LLVM][TableGen] Rename Option emitter files.

Rename OptXXXEmitter.cpp to OptionXXXEmitter.cpp to have a less
ambiguious name, as `Opt` could also mean optimization.
---
 llvm/include/llvm/Option/OptTable.h                    |  2 +-
 llvm/unittests/Option/OptionMarshallingTest.cpp        |  2 +-
 llvm/utils/TableGen/CMakeLists.txt                     |  4 ++--
 .../{OptParserEmitter.cpp => OptionParserEmitter.cpp}  |  8 ++++----
 .../{OptRSTEmitter.cpp => OptionRSTEmitter.cpp}        | 10 +++++-----
 llvm/utils/gn/secondary/llvm/utils/TableGen/BUILD.gn   |  4 ++--
 6 files changed, 15 insertions(+), 15 deletions(-)
 rename llvm/utils/TableGen/{OptParserEmitter.cpp => OptionParserEmitter.cpp} (98%)
 rename llvm/utils/TableGen/{OptRSTEmitter.cpp => OptionRSTEmitter.cpp} (89%)

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",



More information about the llvm-commits mailing list