aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xemcc2
-rw-r--r--tools/js-optimizer.js7
2 files changed, 8 insertions, 1 deletions
diff --git a/emcc b/emcc
index eface9b7..fce02ef2 100755
--- a/emcc
+++ b/emcc
@@ -1185,6 +1185,8 @@ try:
if DEBUG: print >> sys.stderr, 'emcc: running closure'
final = shared.Building.closure_compiler(final)
if DEBUG: save_intermediate('closure')
+ elif shared.settings.ASM_JS and shared.settings.RELOOP:
+ js_optimizer_queue += ['registerizeAsm'] # we can't use closure in asm, but this does much of the same
if opt_level >= 1:
if DEBUG: print >> sys.stderr, 'emcc: running post-closure post-opts'
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js
index 53d1bb31..166843a9 100644
--- a/tools/js-optimizer.js
+++ b/tools/js-optimizer.js
@@ -1203,7 +1203,7 @@ function loopOptimizer(ast) {
// TODO: Consider how this fits in with the rest of the optimization toolchain. Do
// we still need the eliminator? Closure? And in what order? Perhaps just
// closure simple?
-function registerize(ast) {
+function registerize(ast, asm) {
traverseGeneratedFunctions(ast, function(fun) {
// Replace all var definitions with assignments; we will add var definitions at the top after we registerize
// We also mark local variables - i.e., having a var definition
@@ -1371,6 +1371,10 @@ function registerize(ast) {
});
}
+function registerizeAsm(ast) {
+ registerizeAsm(ast, true);
+}
+
// Eliminator aka Expressionizer
//
// The goal of this pass is to eliminate unneeded variables (which represent one of the infinite registers in the LLVM
@@ -1894,6 +1898,7 @@ var passes = {
hoistMultiples: hoistMultiples,
loopOptimizer: loopOptimizer,
registerize: registerize,
+ registerizeAsm: registerizeAsm,
eliminate: eliminate,
eliminateMemSafe: eliminateMemSafe,
eliminateAsm: eliminateAsm,