[LLVMdev] How to get a return type of a function with LLVM-C API

Syoyo Fujita syoyofujita at gmail.com
Thu May 22 07:07:21 PDT 2008


Hi LLVM-ers,

I am trying to get a return type of a function(from bitcode file) with
LLVM-C API, but there seems no appropriate API to do that.

I've tried to do that with following code,

----

LLVMModuleRef           M;
LLVMMemoryBufferRef     MemBuf;
LLVMValueRef            F;         // Function
LLVMTypeRef             RetTy;
char                   *ErrStr;

//
// -- Load shader module
//
ret = LLVMCreateMemoryBufferWithContentsOfFile(
         input,
        &MemBuf,    // [out]
        &ErrStr);   // [out]

ret = LLVMParseBitcode(
         MemBuf,
        &M,         // [out]
        &ErrStr);   // [out]

F = LLVMGetFirstFunction(M);

RetTy = LLVMGetReturnType(F);   // NG! Can't do this

----

How can I do that?
(I am using HEAD version of llvm)

And is there a tutorial or document for LLVM C API?


Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080522/048206ee/attachment.html>


More information about the llvm-dev mailing list