From dcb0ffdd03d54882b68a23a7fa0e0efe67d2ffea Mon Sep 17 00:00:00 2001 From: whitequark Date: Mon, 28 Mar 2016 21:44:24 +0000 Subject: [PATCH] Commit missing parts of 1d8b0d46. --- artiq/compiler/transforms/llvm_ir_generator.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/artiq/compiler/transforms/llvm_ir_generator.py b/artiq/compiler/transforms/llvm_ir_generator.py index f25a5a9c6..8082595f9 100644 --- a/artiq/compiler/transforms/llvm_ir_generator.py +++ b/artiq/compiler/transforms/llvm_ir_generator.py @@ -1317,19 +1317,20 @@ class LLVMIRGenerator: return llresult def process_Invoke(self, insn): + functiontyp = insn.target_function().type llnormalblock = self.map(insn.normal_target()) llunwindblock = self.map(insn.exception_target()) - if types.is_rpc_function(insn.target_function().type): + if types.is_rpc_function(functiontyp): return self._build_rpc(insn.target_function().loc, - insn.target_function().type, + functiontyp, insn.arguments(), llnormalblock, llunwindblock) - elif types.is_c_function(insn.target_function().type): + elif types.is_c_function(functiontyp): llfun, llargs = self._prepare_ffi_call(insn) else: llfun, llargs = self._prepare_closure_call(insn) - if self.has_sret(insn.target_function().type): + if self.has_sret(functiontyp): llstackptr = self.llbuilder.call(self.llbuiltin("llvm.stacksave"), []) llresultslot = self.llbuilder.alloca(llfun.type.pointee.args[0].pointee) @@ -1342,6 +1343,10 @@ class LLVMIRGenerator: llcall = self.llbuilder.invoke(llfun, llargs, llnormalblock, llunwindblock, name=insn.name) + # See the comment in process_Call. + if types.is_c_function(functiontyp) and 'nowrite' in functiontyp.flags: + llcall.metadata['tbaa'] = self.tbaa_nowrite_call + if insn.is_cold: llcall.cconv = 'coldcc'