FFI call attributes #151
Labels
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: M-Labs/nac3#151
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
We should add these attributes correctly to those extern functions.
https://github.com/m-labs/artiq/pull/1778/files
Attributes ID can be obtained from string using
get_named_enum_kind_id
M-Labs/artiq-zynq#76
Considering this, should we keep the byval attribute? It seems that the backend can do some optimization with byval attribute (pass aggregate types in register rather than in stack memory), but how much does this affect performane? If the performance implication is not big, should we simplify this by removing the attribute?
I don't understand the connection between the attributes and #76. Are you saying that not using
byval
fixes the discrepancy in #76?It causes the discrepancy in zynq, i.e. both functions take a slice pointer, but one is using &CSlice and one is CSlice. With byval, the backend may not emit a point to struct but pass the struct content in register instead.
The discrepancy between different targets is caused by the target ABI, more specifically how they handle function parameters of aggregate type. Some targets will pass the aggregate value by pointer and some will pass in register if there are available registers (for performance reason). This can probably be fixed by using pointers to struct instead of passing structs directly, which should always be lowered as a pointer argument (if my understanding is correct).
Note: Adding the attribute is easy, I'm just a bit worried about the discrepancy.
And another thing we may want to have a look at is fastcc. Do we want to make the code faster by making calls to private functions fastcc? How much improvement would we get from this?
(wandering in the LLVM language reference now... just some random thoughts that I want to note down)