Added API for reading assembly (.ll) files

git-svn-id: http://llvm-py.googlecode.com/svn/trunk@35 8d1e9007-1d4e-0410-b67e-1979fd6579aa
This commit is contained in:
mdevan.foobar 2008-09-08 13:09:43 +00:00
commit c10b1b58c3
10 changed files with 82 additions and 18 deletions

17
test/asm.py Normal file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env python
from llvm import *
from llvm.core import *
# create a module
m = Module.new('module1')
m.add_global_variable(Type.int(), 'i')
# write it's assembly representation to a file
asm = str(m)
print >> file("/tmp/testasm.ll", "w"), asm
# read it back into a module
m2 = Module.from_assembly(file("/tmp/testasm.ll"))
print m2