Execution engine and passes work. Documentation and tests updated.
git-svn-id: http://llvm-py.googlecode.com/svn/trunk@4 8d1e9007-1d4e-0410-b67e-1979fd6579aa
This commit is contained in:
parent
6ee3298bd2
commit
2255a7e5dd
15 changed files with 559 additions and 396 deletions
|
|
@ -26,18 +26,18 @@ entry = func.append_basic_block("entry")
|
|||
builder = Builder.new()
|
||||
builder.position_at_end(entry)
|
||||
|
||||
# add two args into temp1
|
||||
temp1 = builder.add(func.args[0], func.args[1], "temp1")
|
||||
# add two args into tmp1
|
||||
tmp1 = builder.add(func.args[0], func.args[1], "tmp1")
|
||||
|
||||
# sub `1' from that
|
||||
one = Constant.real( ty_double, 1.0 )
|
||||
temp2 = builder.sub(temp1, one, "temp2")
|
||||
tmp2 = builder.sub(tmp1, one, "tmp2")
|
||||
|
||||
# convert to integer
|
||||
temp3 = builder.fptoui(temp2, ty_int, "temp3")
|
||||
tmp3 = builder.fptoui(tmp2, ty_int, "tmp3")
|
||||
|
||||
# return it
|
||||
builder.ret(temp3)
|
||||
builder.ret(tmp3)
|
||||
|
||||
# dump the module to see the bc
|
||||
module.dump()
|
||||
# dump the module to see the llvm "assembly" code
|
||||
print module
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue