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

Dan Gohman via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 17 05:06:13 PST 2016


sunfish added a comment.

I assume the purpose here is debugging compiler output, however -O0 is generally meant for debugging source code. For example, LLVM's normal CodeGen path does do (limited) register allocation at -O0. User variables are generally stored in allocas, so they aren't affected by register allocation. Consequently, disabling register stackifying and coloring at -O0 isn't obviously the right thing to do.

Some of our tests do use -disable-block-placement, for example, to reduce uninteresting optimizer churn when it's a problem. Using -disable-wasm-register-coloring seems like it would be useful in some cases as well. A flag to disable register stackifying could be similarly useful.


================
Comment at: lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.cpp:48
@@ +47,3 @@
+  if (RM != Reloc::Default && RM != Reloc::Static)
+    report_fatal_error("Non-static relocation models are not supported yet");
+  if (CM != CodeModel::Default)
----------------
I agree with being conservative for such things in general, however WebAssembly code is always PIC, so we already do support all the reloc modes. Accepting all the modes is useful because user build scripts sometimes add -fPIC in target-insensitive ways, for example. I propose we unconditionally override the mode to PIC_, as Darwin does on newer architectures.


================
Comment at: lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.cpp:50
@@ +49,3 @@
+  if (CM != CodeModel::Default)
+    report_fatal_error("Non-default code models are not supported yet");
+  MCCodeGenInfo *CGI = new MCCodeGenInfo();
----------------
WebAssembly doesn't have offset restrictions, so it technically supports the "large" model by default. I propose we map Default and JITDefault to Large, and then accept only Large (rejecting Small, Medium, and Kernel in case we want to make those mean something some day).


http://reviews.llvm.org/D17327





More information about the llvm-commits mailing list