[llvm-dev] How to create a call to a function which returns a struct
Manuel Jacob via llvm-dev
llvm-dev at lists.llvm.org
Wed May 23 02:06:16 PDT 2018
On 2018-05-23 05:12, SANGEETA CHOWDHARY via llvm-dev wrote:
> I am trying to create a call to a function which returns a struct in
> llvm pass. I also want to read struct fields returned from this
> function call. Can somebody help me with this?
You call the function like every other function. You can then extract
the fields with the 'extractvalue' instruction
(http://llvm.org/docs/LangRef.html#extractvalue-instruction). In a
pass, usually these instructions are created with a IRBuilder. If you
don't already know about it, you'll find many examples in the LLVM code
base (for example under lib/Transforms/).
More information about the llvm-dev
mailing list