[llvm-dev] How to add/use parameter attributes? Troubles with "byval"

5 views
Skip to first unread message

edA-qa mort-ora-y via llvm-dev

unread,
Apr 21, 2018, 1:01:27 PM4/21/18
to LLVM Developers Mailing List
I'm unable to figure out how IR attributes can be added via the C++ API.
I need to create a function like this:

    %1 = call i64 @abi_call_test_tuple_2p(%struct.abi_tuple_2p* byval
align 8 %v)

Where a structure is being passed by value. I need to add the `byval`
attribute somewhere (I'm not clear if this is on the function arguments
or the type).

I'm also uncertain of why that results in a different calling convention
than just:

    %1 = call i64 @abi_call_test_tuple_2p(%":abi_tuple_2" %0)

Does this not also pass the same structure by-value to the function? 
(It doesn't yield the same results it appears).

--
edA-qa mort-ora-y
http://mortoray.com/

Creator of the Leaf language
http://leaflang.org/

Streaming algorithms, AI, and design on Twitch
https://www.twitch.tv/mortoray

Twitter
edaqa

_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

Reply all
Reply to author
Forward
0 new messages