[PATCH] D17327: [WebAssembly] Disable register stackification and coloring when not optimizing

Derek Schuff via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 17 15:25:17 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL261176: [WebAssembly] Disable register stackification and coloring when not optimizing (authored by dschuff).

Changed prior to commit:
  http://reviews.llvm.org/D17327?vs=48198&id=48250#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D17327

Files:
  llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.cpp
  llvm/trunk/lib/Target/WebAssembly/WebAssemblyRegColoring.cpp
  llvm/trunk/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp

Index: llvm/trunk/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
===================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
@@ -185,11 +185,13 @@
   // Fails with: should be run after register allocation.
   disablePass(&MachineCopyPropagationID);
 
-  // Mark registers as representing wasm's expression stack.
-  addPass(createWebAssemblyRegStackify());
+  if (getOptLevel() != CodeGenOpt::None) {
+    // Mark registers as representing wasm's expression stack.
+    addPass(createWebAssemblyRegStackify());
 
-  // Run the register coloring pass to reduce the total number of registers.
-  addPass(createWebAssemblyRegColoring());
+    // Run the register coloring pass to reduce the total number of registers.
+    addPass(createWebAssemblyRegColoring());
+  }
 
   TargetPassConfig::addPostRegAlloc();
 
Index: llvm/trunk/lib/Target/WebAssembly/WebAssemblyRegColoring.cpp
===================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyRegColoring.cpp
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyRegColoring.cpp
@@ -29,10 +29,6 @@
 
 #define DEBUG_TYPE "wasm-reg-coloring"
 
-static cl::opt<bool>
-    DisableRegColoring("disable-wasm-reg-coloring", cl::Hidden, cl::init(false),
-                       cl::desc("Disable WebAssembly register coloring"));
-
 namespace {
 class WebAssemblyRegColoring final : public MachineFunctionPass {
 public:
@@ -80,9 +76,6 @@
            << "********** Function: " << MF.getName() << '\n';
   });
 
-  if (DisableRegColoring)
-    return false;
-
   // If there are calls to setjmp or sigsetjmp, don't perform coloring. Virtual
   // registers could be modified before the longjmp is executed, resulting in
   // the wrong value being used afterwards. (See <rdar://problem/8007500>.)
Index: llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.cpp
===================================================================
--- llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.cpp
+++ llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.cpp
@@ -40,6 +40,20 @@
   return new WebAssemblyMCAsmInfo(TT);
 }
 
+static MCCodeGenInfo *createMCCodeGenInfo(const Triple & /*TT*/,
+                                          Reloc::Model /*RM*/,
+                                          CodeModel::Model CM,
+                                          CodeGenOpt::Level OL) {
+  CodeModel::Model M = (CM == CodeModel::Default || CM == CodeModel::JITDefault)
+                           ? CodeModel::Large
+                           : CM;
+  if (M != CodeModel::Large)
+    report_fatal_error("Non-large code models are not supported yet");
+  MCCodeGenInfo *CGI = new MCCodeGenInfo();
+  CGI->initMCCodeGenInfo(Reloc::PIC_, CM, OL);
+  return CGI;
+}
+
 static MCInstrInfo *createMCInstrInfo() {
   MCInstrInfo *X = new MCInstrInfo();
   InitWebAssemblyMCInstrInfo(X);
@@ -99,6 +113,9 @@
     // Register the MC instruction info.
     TargetRegistry::RegisterMCInstrInfo(*T, createMCInstrInfo);
 
+    // Register the MC codegen info.
+    TargetRegistry::RegisterMCCodeGenInfo(*T, createMCCodeGenInfo);
+
     // Register the MC register info.
     TargetRegistry::RegisterMCRegInfo(*T, createMCRegisterInfo);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17327.48250.patch
Type: text/x-patch
Size: 3404 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160217/5f1d08fa/attachment-0001.bin>


More information about the llvm-commits mailing list