From 3ca5967cea851900a9428215806bd5dc22dce2fe Mon Sep 17 00:00:00 2001 From: whitequark Date: Mon, 31 Aug 2015 14:02:02 -0600 Subject: [PATCH] LLVMIRGenerator: don't map sret LLVM argument to any ARTIQ arguments. --- artiq/compiler/transforms/llvm_ir_generator.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/artiq/compiler/transforms/llvm_ir_generator.py b/artiq/compiler/transforms/llvm_ir_generator.py index 08408c2d6..0a703fa8b 100644 --- a/artiq/compiler/transforms/llvm_ir_generator.py +++ b/artiq/compiler/transforms/llvm_ir_generator.py @@ -409,11 +409,7 @@ class LLVMIRGenerator: self.llfunction = self.llmodule.get_global(func.name) if self.llfunction is None: - llargtys = [] - for arg in func.arguments: - llargtys.append(self.llty_of_type(arg.type)) - llfunty = ll.FunctionType(args=llargtys, - return_type=self.llty_of_type(func.type.ret, for_return=True)) + llfunty = self.llty_of_type(func.type, bare=True) self.llfunction = ll.Function(self.llmodule, llfunty, func.name) if func.is_internal: @@ -427,7 +423,12 @@ class LLVMIRGenerator: disubprogram = self.debug_info_emitter.emit_subprogram(func, self.llfunction) # First, map arguments. - for arg, llarg in zip(func.arguments, self.llfunction.args): + if self.llfunction.type.pointee.__has_sret: + llactualargs = self.llfunction.args[1:] + else: + llactualargs = self.llfunction.args + + for arg, llarg in zip(func.arguments, llactualargs): self.llmap[arg] = llarg # Second, create all basic blocks.