File tree 1 file changed +16
-1
lines changed
artiq/compiler/transforms
1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -936,7 +936,18 @@ def _prepare_closure_call(self, insn):
936
936
return llfun , [llenv ] + list (llargs )
937
937
938
938
def _prepare_ffi_call (self , insn ):
939
- llargs = [self .map (arg ) for arg in insn .arguments ()]
939
+ llargs = []
940
+ byvals = []
941
+ for i , arg in enumerate (insn .arguments ()):
942
+ llarg = self .map (arg )
943
+ if isinstance (llarg .type , (ll .LiteralStructType , ll .IdentifiedStructType )):
944
+ llslot = self .llbuilder .alloca (llarg .type )
945
+ self .llbuilder .store (llarg , llslot )
946
+ llargs .append (llslot )
947
+ byvals .append (i )
948
+ else :
949
+ llargs .append (llarg )
950
+
940
951
llfunname = insn .target_function ().type .name
941
952
llfun = self .llmodule .get_global (llfunname )
942
953
if llfun is None :
@@ -951,6 +962,10 @@ def _prepare_ffi_call(self, insn):
951
962
insn .target_function ().type .name )
952
963
if self .needs_sret (llretty ):
953
964
llfun .args [0 ].add_attribute ('sret' )
965
+ byvals = [i + 1 for i in byvals ]
966
+ for i in byvals :
967
+ llfun .args [i ].add_attribute ('byval' )
968
+
954
969
return llfun , list (llargs )
955
970
956
971
# See session.c:{send,receive}_rpc_value and comm_generic.py:_{send,receive}_rpc_value.
You can’t perform that action at this time.
0 commit comments