aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-11-11 17:21:20 -0800
committerAlon Zakai <alonzakai@gmail.com>2011-11-11 17:21:20 -0800
commita712f0dbf34060af8ec376483bc9a446233de113 (patch)
tree62120e33e1d9728b6235e98b0f93bfff3063eec4
parent8e0fd1cb75afb4d4843f89b889a634da171d32fe (diff)
fix bug with duplicate llvm_as, and other tweaks to that code
-rw-r--r--tests/runner.py30
-rw-r--r--tools/shared.py6
2 files changed, 27 insertions, 9 deletions
diff --git a/tests/runner.py b/tests/runner.py
index de70f707..42442ba5 100644
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -81,13 +81,16 @@ class RunnerCore(unittest.TestCase):
if Building.LLVM_OPTS or force_recompile or build_ll_hook:
Building.ll_opts(filename)
if build_ll_hook:
- build_ll_hook(filename)
- shutil.move(filename + '.o.ll', filename + '.o.ll.pre')
- Building.llvm_as(filename + '.o.ll.pre', filename + '.o')
- output = Popen([LLVM_AS, filename + '.o.ll.pre'] + ['-o=' + filename + '.o'], stdout=PIPE, stderr=STDOUT).communicate()[0]
- assert 'error:' not in output, 'Error in llvm-as: ' + output
+ need_post = build_ll_hook(filename)
+ Building.llvm_as(filename)
+ shutil.move(filename + '.o.ll', filename + '.o.ll.pre') # for comparisons later
Building.llvm_opts(filename)
Building.llvm_dis(filename)
+ if build_ll_hook and need_post:
+ build_ll_hook(filename)
+ Building.llvm_as(filename)
+ shutil.move(filename + '.o.ll', filename + '.o.ll.post') # for comparisons later
+ Building.llvm_dis(filename)
# Build JavaScript code from source code
def build(self, src, dirname, filename, output_processor=None, main_file=None, additional_files=[], libraries=[], includes=[], build_ll_hook=None, extra_emscripten_args=[]):
@@ -3526,7 +3529,21 @@ if 'benchmark' not in str(sys.argv):
def do_autodebug(self, filename):
output = Popen(['python', AUTODEBUGGER, filename+'.o.ll', filename+'.o.ll.ll'], stdout=PIPE, stderr=STDOUT).communicate()[0]
assert 'Success.' in output, output
- self.prep_ll_run(filename, filename+'.o.ll.ll', force_recompile=True) # rebuild .bc
+ self.prep_ll_run(filename, filename+'.o.ll.ll', force_recompile=True) # rebuild .bc # TODO: use code in do_autodebug_post for this
+
+ # Autodebug the code, after LLVM opts. Will only work once!
+ def do_autodebug_post(self, filename):
+ if not hasattr(self, 'post'):
+ print 'Asking for post re-call'
+ self.post = True
+ return True
+ print 'Autodebugging during post time'
+ delattr(self, 'post')
+ output = Popen(['python', AUTODEBUGGER, filename+'.o.ll', filename+'.o.ll.ll'], stdout=PIPE, stderr=STDOUT).communicate()[0]
+ assert 'Success.' in output, output
+ shutil.copyfile(filename + '.o.ll.ll', filename + '.o.ll')
+ Building.llvm_as(filename)
+ Building.llvm_dis(filename)
def test_autodebug(self):
if Building.LLVM_OPTS: return self.skip('LLVM opts mess us up')
@@ -3898,6 +3915,7 @@ Child2:9
def test_typeinfo(self):
Settings.RUNTIME_TYPE_INFO = 1
if Settings.QUANTUM_SIZE != 4: return self.skip('We assume normal sizes in the output here')
+ if Settings.USE_TYPED_ARRAYS == 2: return self.skip('LLVM unsafe opts optimize out the type info')
src = '''
#include<stdio.h>
diff --git a/tools/shared.py b/tools/shared.py
index 5cc06240..6fa9ab9a 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -304,14 +304,14 @@ class Building:
assert os.path.exists(filename + '.o.ll'), 'Could not create .ll file: ' + output
@staticmethod
- def llvm_as(source, target):
+ def llvm_as(filename):
# LLVM assembly ==> LLVM binary
try:
os.remove(target)
except:
pass
- output = Popen([LLVM_AS, source, '-o=' + target], stdout=PIPE, stderr=STDOUT).communicate()[0]
- assert os.path.exists(target), 'Could not create bc file: ' + output
+ output = Popen([LLVM_AS, filename + '.o.ll', '-o=' + filename + '.o'], stdout=PIPE, stderr=STDOUT).communicate()[0]
+ assert os.path.exists(filename + '.o'), 'Could not create bc file: ' + output
@staticmethod
def emscripten(filename, output_processor=None, append_ext=True, extra_args=[]):