File size: 518 Bytes
c65f48d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
from llvmlite.ir import _utils
from llvmlite.ir import types
class Context(object):
def __init__(self):
self.scope = _utils.NameScope()
self.identified_types = {}
def get_identified_type(self, name):
if name not in self.identified_types:
self.scope.register(name)
ty = types.IdentifiedStructType(self, name)
self.identified_types[name] = ty
else:
ty = self.identified_types[name]
return ty
global_context = Context()
|