aboutsummaryrefslogtreecommitdiff
path: root/tools/shared.py
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 /tools/shared.py
parentd1d6cbf8701b204bf379c6d94bb15d52f6f003aa (diff)
add .ll debugging output option to emcc
Diffstat (limited to 'tools/shared.py')
-rw-r--r--tools/shared.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/shared.py b/tools/shared.py
index 777566cc..b8f76a0d 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -445,11 +445,16 @@ class Building:
# shutil.move(filename + '.tmp.bc', filename + '.o')
@staticmethod
- def llvm_dis(filename):
+ def llvm_dis(input_filename, output_filename=None):
# LLVM binary ==> LLVM assembly
- try_delete(filename + '.o.ll')
- output = Popen([LLVM_DIS, filename + '.o'] + LLVM_DIS_OPTS + ['-o=' + filename + '.o.ll'], stdout=PIPE).communicate()[0]
- assert os.path.exists(filename + '.o.ll'), 'Could not create .ll file: ' + output
+ if output_filename is None:
+ # use test runner conventions
+ output_filename = input_filename + '.o.ll'
+ input_filename = input_filename + '.o'
+ try_delete(output_filename)
+ output = Popen([LLVM_DIS, input_filename ] + LLVM_DIS_OPTS + ['-o=' + output_filename], stdout=PIPE).communicate()[0]
+ assert os.path.exists(output_filename), 'Could not create .ll file: ' + output
+ return output_filename
@staticmethod
def llvm_as(input_filename, output_filename=None):
@@ -461,6 +466,7 @@ class Building:
try_delete(output_filename)
output = Popen([LLVM_AS, input_filename, '-o=' + output_filename], stdout=PIPE).communicate()[0]
assert os.path.exists(output_filename), 'Could not create bc file: ' + output
+ return output_filename
@staticmethod
def llvm_nm(filename, stdout=PIPE, stderr=None):