aboutsummaryrefslogtreecommitdiff
path: root/emcc
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-01-01 11:17:49 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-01-01 11:17:49 -0800
commit21e67b788795e3ea0feb8dcd636a56f4c28c21a9 (patch)
tree1139b835ba93ef4f405411b4b72301a463670c8b /emcc
parentd1d6cbf8701b204bf379c6d94bb15d52f6f003aa (diff)
add .ll debugging output option to emcc
Diffstat (limited to 'emcc')
-rwxr-xr-xemcc27
1 files changed, 16 insertions, 11 deletions
diff --git a/emcc b/emcc
index d4bbcebe..67c822e9 100755
--- a/emcc
+++ b/emcc
@@ -457,12 +457,25 @@ try:
except:
pass
+ if DEBUG:
+ print >> sys.stderr, 'emcc: saving intermediate processing steps to %s' % shared.EMSCRIPTEN_TEMP_DIR
+
+ intermediate_counter = 0
+ def save_intermediate(name=None):
+ global intermediate_counter
+ shutil.copyfile(final, os.path.join(shared.EMSCRIPTEN_TEMP_DIR, 'emcc-%d%s.js' % (intermediate_counter, '' if name is None else '-' + name)))
+ intermediate_counter += 1
+
if not LEAVE_INPUTS_RAW:
- emscripten_input = in_temp(target_basename + '.bc')
+ final = in_temp(target_basename + '.bc')
+ if DEBUG:
+ final = shared.Building.llvm_dis(final, final + '.ll')
+ save_intermediate('ll')
else:
assert len(input_files) == 1
- emscripten_input = input_files[0]
- final = shared.Building.emscripten(emscripten_input, append_ext=False)
+ final = input_files[0]
+
+ final = shared.Building.emscripten(final, append_ext=False)
# Apply a source code transformation, if requested
source_transform = os.environ.get('EMCC_JS_PROCESSOR')
@@ -473,14 +486,6 @@ try:
process(final)
if DEBUG:
- print >> sys.stderr, 'emcc: saving intermediate processing steps to %s' % shared.EMSCRIPTEN_TEMP_DIR
-
- intermediate_counter = 0
- def save_intermediate(name=None):
- global intermediate_counter
- shutil.copyfile(final, os.path.join(shared.EMSCRIPTEN_TEMP_DIR, 'emcc-%d%s.js' % (intermediate_counter, '' if name is None else '-' + name)))
- intermediate_counter += 1
-
save_intermediate('original')
final = shared.Building.js_optimizer(final, []) # Clean up the syntax a bit, so comparisons to later passes are simpler
save_intermediate('pretty')