[PATCH] D77894: [WebAssembly] Minor cleanup to WebAssemblySubtarget. NFC.

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 10 13:26:48 PDT 2020


sbc100 created this revision.
Herald added subscribers: llvm-commits, sunfish, aheejin, hiraditya, jgravelle-google, dschuff.
Herald added a project: LLVM.
sbc100 added a reviewer: tlively.
sbc100 retitled this revision from "[WebAssembly] Minor claanup to WebAssemblySubtarget. NFC." to "[WebAssembly] Minor cleanup to WebAssemblySubtarget. NFC.".
sbc100 edited the summary of this revision.

Pretty much all other platforms pass CPU string as arg0 of
initializeSubtargetDependencies.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77894

Files:
  llvm/lib/Target/WebAssembly/WebAssemblySubtarget.cpp
  llvm/lib/Target/WebAssembly/WebAssemblySubtarget.h


Index: llvm/lib/Target/WebAssembly/WebAssemblySubtarget.h
===================================================================
--- llvm/lib/Target/WebAssembly/WebAssemblySubtarget.h
+++ llvm/lib/Target/WebAssembly/WebAssemblySubtarget.h
@@ -49,9 +49,6 @@
   bool HasTailCall = false;
   bool HasReferenceTypes = false;
 
-  /// String name of used CPU.
-  std::string CPUString;
-
   /// What processor and OS we're targeting.
   Triple TargetTriple;
 
@@ -60,9 +57,8 @@
   WebAssemblySelectionDAGInfo TSInfo;
   WebAssemblyTargetLowering TLInfo;
 
-  /// Initializes using CPUString and the passed in feature string so that we
-  /// can use initializer lists for subtarget initialization.
-  WebAssemblySubtarget &initializeSubtargetDependencies(StringRef FS);
+  WebAssemblySubtarget &initializeSubtargetDependencies(StringRef CPU,
+                                                        StringRef FS);
 
 public:
   /// This constructor initializes the data members to match that
Index: llvm/lib/Target/WebAssembly/WebAssemblySubtarget.cpp
===================================================================
--- llvm/lib/Target/WebAssembly/WebAssemblySubtarget.cpp
+++ llvm/lib/Target/WebAssembly/WebAssemblySubtarget.cpp
@@ -25,13 +25,15 @@
 #include "WebAssemblyGenSubtargetInfo.inc"
 
 WebAssemblySubtarget &
-WebAssemblySubtarget::initializeSubtargetDependencies(StringRef FS) {
+WebAssemblySubtarget::initializeSubtargetDependencies(StringRef CPU,
+                                                      StringRef FS) {
   // Determine default and user-specified characteristics
+  LLVM_DEBUG(llvm::dbgs() << "initializeSubtargetDependencies\n");
 
-  if (CPUString.empty())
-    CPUString = "generic";
+  if (CPU.empty())
+    CPU = "generic";
 
-  ParseSubtargetFeatures(CPUString, FS);
+  ParseSubtargetFeatures(CPU, FS);
   return *this;
 }
 
@@ -39,10 +41,9 @@
                                            const std::string &CPU,
                                            const std::string &FS,
                                            const TargetMachine &TM)
-    : WebAssemblyGenSubtargetInfo(TT, CPU, FS), CPUString(CPU),
-      TargetTriple(TT), FrameLowering(),
-      InstrInfo(initializeSubtargetDependencies(FS)), TSInfo(),
-      TLInfo(TM, *this) {}
+    : WebAssemblyGenSubtargetInfo(TT, CPU, FS), TargetTriple(TT),
+      FrameLowering(), InstrInfo(initializeSubtargetDependencies(CPU, FS)),
+      TSInfo(), TLInfo(TM, *this) {}
 
 bool WebAssemblySubtarget::enableAtomicExpand() const {
   // If atomics are disabled, atomic ops are lowered instead of expanded


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77894.256641.patch
Type: text/x-patch
Size: 2593 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200410/5dd46528/attachment.bin>


More information about the llvm-commits mailing list