Add AllocaInstruction
This commit is contained in:
parent
091a393d1d
commit
b8e0338da8
4 changed files with 59 additions and 6 deletions
24
llvm/tests/test_alloca.py
Normal file
24
llvm/tests/test_alloca.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import unittest
|
||||
from llvm.core import Type, Module, Builder, Constant
|
||||
from .support import TestCase, tests
|
||||
|
||||
class TestAlloca(TestCase):
|
||||
def test_alloca_alignment(self):
|
||||
m = Module.new('')
|
||||
f = m.add_function(Type.function(Type.void(), []), "foo")
|
||||
b = Builder.new(f.append_basic_block(''))
|
||||
inst = b.alloca(Type.int(32))
|
||||
inst.alignment = 4
|
||||
b.ret_void()
|
||||
m.verify()
|
||||
|
||||
self.assertTrue(inst.is_static)
|
||||
self.assertFalse(inst.is_array)
|
||||
self.assertEqual(inst.alignment, 4)
|
||||
self.assertEqual(str(inst.array_size), 'i32 1')
|
||||
|
||||
tests.append(TestAlloca)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue