forked from M-Labs/artiq
1
0
Fork 0

Ensure uwtable is added to all generated functions.

This commit is contained in:
whitequark 2015-08-08 21:48:21 +03:00
parent 13ad9b5d08
commit 22457bc19c
1 changed files with 4 additions and 1 deletions

View File

@ -175,6 +175,7 @@ class LLVMIRGenerator:
def process_function(self, func): def process_function(self, func):
try: try:
self.llfunction = self.llmodule.get_global(func.name) self.llfunction = self.llmodule.get_global(func.name)
if self.llfunction is None: if self.llfunction is None:
llargtys = [] llargtys = []
for arg in func.arguments: for arg in func.arguments:
@ -182,10 +183,12 @@ class LLVMIRGenerator:
llfunty = ll.FunctionType(args=llargtys, llfunty = ll.FunctionType(args=llargtys,
return_type=self.llty_of_type(func.type.ret, for_return=True)) return_type=self.llty_of_type(func.type.ret, for_return=True))
self.llfunction = ll.Function(self.llmodule, llfunty, func.name) self.llfunction = ll.Function(self.llmodule, llfunty, func.name)
self.llfunction.attributes.add('uwtable')
if func.is_internal: if func.is_internal:
self.llfunction.linkage = 'internal' self.llfunction.linkage = 'internal'
self.llfunction.attributes.add('uwtable')
self.llmap = {} self.llmap = {}
self.llbuilder = ll.IRBuilder() self.llbuilder = ll.IRBuilder()
self.fixups = [] self.fixups = []