aboutsummaryrefslogtreecommitdiff
path: root/emcc
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-11-14 21:58:52 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-11-14 21:58:52 -0800
commit149b9ea5747d610d2ebfb41bc87e8bb96f498359 (patch)
treea08fc9b33d9aac1baa436a0a4896a103b24702bb /emcc
parent757f28b777303a90fe2992d0e2f82ce0958f12f2 (diff)
emit ll from llvm opt directly, to skip writing and reading all the bitcode
Diffstat (limited to 'emcc')
-rwxr-xr-xemcc16
1 files changed, 12 insertions, 4 deletions
diff --git a/emcc b/emcc
index 4c3aa009..c3f9d862 100755
--- a/emcc
+++ b/emcc
@@ -1638,18 +1638,26 @@ try:
else:
# At minimum remove dead functions etc., this potentially saves a lot in the size of the generated code (and the time to compile it)
link_opts += shared.Building.get_safe_internalize() + ['-globaldce']
- shared.Building.llvm_opt(in_temp(target_basename + '.bc'), link_opts)
- if DEBUG: save_intermediate('linktime', 'bc')
+ if not save_bc:
+ # let llvm opt directly emit ll, to skip writing and reading all the bitcode
+ link_opts += ['-S']
+ shared.Building.llvm_opt(final, link_opts, final + '.link.ll')
+ final = final + '.link.ll'
+ if DEBUG: save_intermediate('linktime', 'll')
+ else:
+ shared.Building.llvm_opt(final, link_opts)
+ if DEBUG: save_intermediate('linktime', 'bc')
if save_bc:
shutil.copyfile(final, save_bc)
# Prepare .ll for Emscripten
if not LEAVE_INPUTS_RAW:
- final = shared.Building.llvm_dis(final, final + '.ll')
+ if save_bc:
+ final = shared.Building.llvm_dis(final, final + '.ll')
else:
assert len(input_files) == 1
- if DEBUG: save_intermediate('ll', 'll')
+ if DEBUG and save_bc: save_intermediate('ll', 'll')
if AUTODEBUG:
logging.debug('autodebug')