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

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/).