Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added llvm.core.Argument.alignment

git-svn-id: http://llvm-py.googlecode.com/svn/trunk@101 8d1e9007-1d4e-0410-b67e-1979fd6579aa
  • Loading branch information...
commit b7fa3e8fa1ccf43a81e895fa6db2549d60da6ee5 1 parent 7f74b22
mdevan.foobar authored
View
1  CHANGELOG
@@ -1,6 +1,7 @@
0.7, in progress:
+ * Add llvm.core.Argument.alignment property.
* Migrate to LLVM 2.8.
* Fix ffi link issue on darwin (Albert Mietus) (Issue #29).
* LLVM tutorial ported (Max Shawabkeh) (Issue #33).
View
8 llvm/core.py
@@ -1260,9 +1260,15 @@ def add_attribute(self, attr):
def remove_attribute(self, attr):
_core.LLVMRemoveAttribute(self.ptr, attr)
- def set_alignment(self, align):
+ def _set_alignment(self, align):
_core.LLVMSetParamAlignment(self.ptr, align)
+ def _get_alignment(self):
+ return _core.LLVMGetParamAlignment(self.ptr)
+
+ alignment = \
+ property(_get_alignment, _set_alignment)
+
class Function(GlobalValue):
View
3  test/testall.py
@@ -267,7 +267,8 @@ def do_argument():
a = f.args[0]
a.add_attribute(ATTR_ZEXT)
a.remove_attribute(ATTR_ZEXT)
- a.set_alignment(4)
+ a.alignment = 16
+ a1 = a.alignment
def do_function():
View
28 test/testattrs.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+
+from llvm.core import *
+from cStringIO import StringIO
+
+
+def make_module():
+ test_module = """
+ define i32 @sum(i32, i32) {
+ entry:
+ %2 = add i32 %0, %1
+ ret i32 %2
+ }
+ """
+ return Module.from_assembly(StringIO(test_module))
+
+
+def test_align(m):
+ f = m.get_function_named('sum')
+ f.args[0].alignment = 16
+ assert "align 16" in str(f)
+ assert f.args[0].alignment == 16
+
+
+m = make_module()
+test_align(m)
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.