SANGEETA CHOWDHARY via llvm-dev
2018-May-23 03:12 UTC
[llvm-dev] How to create a call to a function which returns a struct
Hello, 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? Regards, Sangeeta
Manuel Jacob via llvm-dev
2018-May-23 09:06 UTC
[llvm-dev] How to create a call to a function which returns a struct
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/).