[llvm] r260840 - [TableGen] Remove constant string argument from a method that's only called once. We can just hardcode the string inside. There already other things that make the method not reusable. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 13 21:22:02 PST 2016


Author: ctopper
Date: Sat Feb 13 23:22:01 2016
New Revision: 260840

URL: http://llvm.org/viewvc/llvm-project?rev=260840&view=rev
Log:
[TableGen] Remove constant string argument from a method that's only called once. We can just hardcode the string inside. There already other things that make the method not reusable. NFC

Modified:
    llvm/trunk/utils/TableGen/SubtargetEmitter.cpp

Modified: llvm/trunk/utils/TableGen/SubtargetEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/SubtargetEmitter.cpp?rev=260840&r1=260839&r2=260840&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/SubtargetEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/SubtargetEmitter.cpp Sat Feb 13 23:22:01 2016
@@ -64,7 +64,7 @@ class SubtargetEmitter {
   CodeGenSchedModels &SchedModels;
   std::string Target;
 
-  void Enumeration(raw_ostream &OS, const char *ClassName);
+  void Enumeration(raw_ostream &OS);
   unsigned FeatureKeyValues(raw_ostream &OS);
   unsigned CPUKeyValues(raw_ostream &OS);
   void FormItineraryStageString(const std::string &Names,
@@ -112,10 +112,10 @@ public:
 //
 // Enumeration - Emit the specified class as an enumeration.
 //
-void SubtargetEmitter::Enumeration(raw_ostream &OS,
-                                   const char *ClassName) {
+void SubtargetEmitter::Enumeration(raw_ostream &OS) {
   // Get all records of class and sort
-  std::vector<Record*> DefList = Records.getAllDerivedDefinitions(ClassName);
+  std::vector<Record*> DefList =
+    Records.getAllDerivedDefinitions("SubtargetFeature");
   std::sort(DefList.begin(), DefList.end(), LessRecord());
 
   unsigned N = DefList.size();
@@ -1379,7 +1379,7 @@ void SubtargetEmitter::run(raw_ostream &
   OS << "#undef GET_SUBTARGETINFO_ENUM\n";
 
   OS << "namespace llvm {\n";
-  Enumeration(OS, "SubtargetFeature");
+  Enumeration(OS);
   OS << "} // end llvm namespace\n";
   OS << "#endif // GET_SUBTARGETINFO_ENUM\n\n";
 




More information about the llvm-commits mailing list