[pypy-dev] LLVM backend

holger krekel hpk at trillke.net
Mon Feb 7 08:46:19 CET 2005


Hi Carl, 

On Mon, Feb 07, 2005 at 01:38 +0100, Carl Friedrich Bolz wrote:
> Hi Holger,
> 
> I might have found the error though I'm not sure. I checken in a fix and 
> added some debug output, could you try again and post it if it fails?

it still fails ...  "py.test -x" in the translator/llvm directory gives: 

inserting into sys.path: /home/hpk/projects/dist-pypy
============================= test process starts =============================
testing-mode: inprocess
executable  : /usr/bin/python  (2.3.4-final-0)
using py lib: /home/hpk/projects/dist-pypy/py <rev 8944>
initial testconfig 0: /home/hpk/projects/dist-pypy/pypy/conftest.py/.
initial testconfig 1: /home/hpk/projects/dist-pypy/py/test/defaultconfig.py/.
===============================================================================
llvm__________test_genllvm.py[18] ...F

_______________________________________________________________________________

    def test_simple1(self):
>       f = compile_function(llvmsnippet.simple1, [])

[/home/hpk/projects/dist-pypy/pypy/translator/llvm/test/test_genllvm.py:86]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def compile_function(function, annotate):
        t = Translator(function)
        a = t.annotate(annotate)
        gen = LLVMGenerator(t)
>       return gen.compile()

[/home/hpk/projects/dist-pypy/pypy/translator/llvm/test/test_genllvm.py:20]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def compile(self, optimize=True):
        from pypy.tool.udir import udir
        name = self.l_entrypoint.llvmname()[1:]
        llvmfile = udir.join('%s.ll' % name)
        f = llvmfile.open('w')
        self.write(f)
        f.close()
        pyxfile = udir.join('%s_wrap.pyx' % name)
        f = pyxfile.open('w')
        f.write(self.l_entrypoint.get_pyrex_source())
        f.close()
        mod = build_llvm_module.make_module_from_llvm(llvmfile, pyxfile,
>                                                     optimize)

[/home/hpk/projects/dist-pypy/pypy/translator/llvm/genllvm.py:68]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def make_module_from_llvm(llvmfile, pyxfile, optimize=True):
        include_dir = autopath.this_dir
        dirpath = llvmfile.dirpath()
        lastdir = path.local()
        os.chdir(str(dirpath))
        modname = pyxfile.purebasename
        ops1 = ["llvm-as %s -f -o %s.bc" % (llvmfile, llvmfile.purebasename), 
                "llvmc -f -O3 %s.bc -o %s_optimized.o" % (llvmfile.purebasename,
                                                          llvmfile.purebasename),
                "llc %s_optimized.o.bc -f -o %s.s" % (llvmfile.purebasename,
                                                       llvmfile.purebasename),
                "as %s.s -o %s.o" % (llvmfile.purebasename, llvmfile.purebasename)]
        if not optimize:
            ops1 = ["llvm-as %s -f" % llvmfile,
                    "llc %s.bc -f -o %s.s" % (llvmfile.purebasename,
                                              llvmfile.purebasename),
                    "as %s.s -o %s.o" % (llvmfile.purebasename,
                                              llvmfile.purebasename)]
        ops2 = ["gcc -c -fPIC -I/usr/include/python %s.c" % pyxfile.purebasename,
               "gcc -shared %s.o %s.o -o %s.so" % (llvmfile.purebasename,
                                                    modname, modname)]
        try:
            if debug: print "modname", modname
            c = stdoutcapture.Capture(mixed_out_err = True)
            if debug: print "working in", path.local()
            try:
                try:
                    for op in ops1:
                        print op
E                       cmdexec(op)
~                       ExecutionFailed: cmdexec('llc simple1_optimized.o.bc -f -o simple1.s')  << ExecutionFailed: 1  llc simple1_optimized.o.bc -f -o simple1.s
                        llc: bytecode didn't read correctly.
                        

[/home/hpk/projects/dist-pypy/pypy/translator/llvm/build_llvm_module.py:58]
[testcode  : /home/hpk/projects/dist-pypy/pypy/translator/llvm/test/test_genllvm.py:85]
[modulepath: TestGenLLVM.test_simple1]
- - - - - - - - - - - - - - -  recorded stdout - - - - - - - - - - - - - - - 
modname simple1_wrap
working in /tmp/usession-129
llvm-as /tmp/usession-129/simple1.ll -f -o simple1.bc
llvmc -f -O3 simple1.bc -o simple1_optimized.o
llc simple1_optimized.o.bc -f -o simple1.s
_______________________________________________________________________________
============= tests finished: 3 passed, 1 failed in 9.79 seconds =============

contents of usession-129 are on codespeak.net:/home/hpk/usession-129 
i am beginning to suspect my installation. Is there an easy way to 
verify that my installation works? 

cheers, 

    holger




More information about the Pypy-dev mailing list