Commit missing parts of 1d8b0d46.

This commit is contained in:
whitequark 2016-03-28 21:44:24 +00:00
parent 1038f1321f
commit 3ed852e077
1 changed files with 9 additions and 4 deletions

View File

@ -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'