aboutsummaryrefslogtreecommitdiff
path: root/emcc
diff options
context:
space:
mode:
Diffstat (limited to 'emcc')
-rwxr-xr-xemcc19
1 files changed, 16 insertions, 3 deletions
diff --git a/emcc b/emcc
index a6bf9c6a..942ea1b3 100755
--- a/emcc
+++ b/emcc
@@ -161,9 +161,17 @@ Options that are modified or new in %s include:
time in return for the smallest and fastest
output.
- -O3 As -O2, plus additional optimizations that can
+ -Os Like -O2 with extra optimizations for size.
+
+ -Oz Like -Os but reduces code size further.
+
+ -O3 Like -O2 plus additional JS optimizations that can
take a significant amount of compilation time and/or
- are relatively new.
+ are relatively new. Note that differs from -O2 only
+ during the bitcode to JS (final link + JS generation)
+ stage, as it is JS-specific, so you can run -Os
+ on your source files for example, and -O3 during
+ JS generation if you want.
For tips on optimizing your code, see
https://github.com/kripken/emscripten/wiki/Optimizing-Code
@@ -810,8 +818,13 @@ try:
# Let -O default to -O2, which is what gcc does.
requested_level = newargs[i][2:] or '2'
if requested_level == 's':
+ llvm_opts = ['-Os']
requested_level = 2
settings_changes.append('INLINING_LIMIT=50')
+ elif requested_level == 'z':
+ llvm_opts = ['-Oz']
+ requested_level = 2
+ settings_changes.append('INLINING_LIMIT=25')
opt_level = validate_arg_level(requested_level, 3, 'Invalid optimization level: ' + newargs[i])
# We leave the -O option in place so that the clang front-end runs in that
# optimization mode, but we disable the actual optimization passes, as we'll
@@ -1353,7 +1366,7 @@ try:
file_ending = filename_type_ending(input_file)
if file_ending.endswith(SOURCE_ENDINGS):
temp_file = temp_files[i]
- logging.debug('optimizing %s with -O%s', input_file, llvm_opts)
+ logging.debug('optimizing %s', input_file)
shared.Building.llvm_opt(temp_file, llvm_opts)
# If we were just asked to generate bitcode, stop there