mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-26 03:38:25 +08:00
compiler: Clarify recv_rpc value names and documentation [nfc]
Previously, the phi emitted for the pointer parameter to recv_rpc was – rather confusingly – called "size", and the pseudo-code in the comment had bit-rotted. Signed-off-by: David Nadlinger <code@klickverbot.at>
This commit is contained in:
parent
4c2e921270
commit
f368e1b228
@ -1252,10 +1252,12 @@ class LLVMIRGenerator:
|
|||||||
self.llbuilder.call(self.llbuiltin("llvm.stackrestore"), [llstackptr])
|
self.llbuilder.call(self.llbuiltin("llvm.stackrestore"), [llstackptr])
|
||||||
|
|
||||||
# T result = {
|
# T result = {
|
||||||
# void *ptr = NULL;
|
# void *ret_ptr = alloca(sizeof(T));
|
||||||
# loop: int size = rpc_recv("tag", ptr);
|
# void *ptr = ret_ptr;
|
||||||
|
# loop: int size = recv_rpc(ptr);
|
||||||
|
# // Non-zero: Provide `size` bytes of extra storage for variable-length data.
|
||||||
# if(size) { ptr = alloca(size); goto loop; }
|
# if(size) { ptr = alloca(size); goto loop; }
|
||||||
# else *(T*)ptr
|
# else *(T*)ret_ptr
|
||||||
# }
|
# }
|
||||||
llprehead = self.llbuilder.basic_block
|
llprehead = self.llbuilder.basic_block
|
||||||
llhead = self.llbuilder.append_basic_block(name="rpc.head")
|
llhead = self.llbuilder.append_basic_block(name="rpc.head")
|
||||||
@ -1270,7 +1272,7 @@ class LLVMIRGenerator:
|
|||||||
self.llbuilder.branch(llhead)
|
self.llbuilder.branch(llhead)
|
||||||
|
|
||||||
self.llbuilder.position_at_end(llhead)
|
self.llbuilder.position_at_end(llhead)
|
||||||
llphi = self.llbuilder.phi(llslotgen.type, name="rpc.size")
|
llphi = self.llbuilder.phi(llslotgen.type, name="rpc.ptr")
|
||||||
llphi.add_incoming(llslotgen, llprehead)
|
llphi.add_incoming(llslotgen, llprehead)
|
||||||
if llunwindblock:
|
if llunwindblock:
|
||||||
llsize = self.llbuilder.invoke(self.llbuiltin("recv_rpc"), [llphi],
|
llsize = self.llbuilder.invoke(self.llbuiltin("recv_rpc"), [llphi],
|
||||||
|
Loading…
Reference in New Issue
Block a user