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

edA-qa mort-ora-y via llvm-dev llvm-dev at lists.llvm.org
Sat Apr 21 10:01:15 PDT 2018


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
	



More information about the llvm-dev mailing list