diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-12-13 12:20:45 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-12-13 12:20:45 -0800 |
commit | 9071942043abc0000a3fa1a68f34887657275a2c (patch) | |
tree | 605bfa623e8293341b5102a2ef6020c50d542d87 /tools/shared.py | |
parent | 09f3e4c41358e74b34b06a755372847577dce34f (diff) |
llvm opts in emcc (untested)
Diffstat (limited to 'tools/shared.py')
-rw-r--r-- | tools/shared.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/shared.py b/tools/shared.py index dcca2707..8cf6e1fd 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -196,6 +196,7 @@ class Settings: class Settings2: reset = Settings.reset load_defaults = Settings.load_defaults + QUANTUM_SIZE = 4 Settings = Settings2 @classmethod @@ -203,6 +204,7 @@ class Settings: ''' Load the JS settings into Python ''' settings = open(path_from_root('src', 'settings.js')).read().replace('var ', 'Settings.').replace('//', '#') exec(settings) +Settings.reset() # Building @@ -296,7 +298,13 @@ class Building: # Optional LLVM optimizations @staticmethod - def llvm_opts(filename): + def llvm_opt(filename, level, safe=True): + output = Popen([LLVM_OPT, filename] + Building.pick_llvm_opts(level, safe) + ['-o=' + filename + '.opt.bc'], stdout=PIPE).communicate()[0] + assert os.path.exists(filename + '.opt.bc'), 'Failed to run llvm optimizations: ' + output + shutil.move(filename + '.opt.bc', filename) + + @staticmethod + def llvm_opts(filename): # deprecated version, only for test runner. TODO: remove if Building.LLVM_OPTS: shutil.move(filename + '.o', filename + '.o.pre') output = Popen([LLVM_OPT, filename + '.o.pre'] + Building.LLVM_OPT_OPTS + ['-o=' + filename + '.o'], stdout=PIPE).communicate()[0] @@ -371,8 +379,6 @@ class Building: into i64s. In any case, the handpicked ones here should be safe and portable. They are also tuned for things that look useful. ''' - if not Building.LLVM_OPTS: return # XXX this makes using this independently from the test runner very unpleasant - opts = [] if optimization_level > 0: #opts.append('-disable-inlining') # we prefer to let closure compiler do our inlining |