I am using LLVM to develop a procedural language. Can anybody point me to an example that uses CreateCall for a non-tail call? I am having trouble doing anything with the return value from the call besides returning it immediately.
i.e. Passing the CallInst created by CreateCall to CreateRet is working fine, but I am having trouble storing the returned value in a local variable or passing it to another call.
Sounds like you are using the C++ API.
You can store the value like: Value *val = Builder.CreateCall(…);
Then, for example, you can do: Builder.CreateAdd(val, val);
Or whatever else you want to program!
That looks a lot like what I am trying to do. I will assume that my problem is either caused by my environment (VC7.1) or by the fact that I am using an older version of llvm (2.5). Will upgrade my llvm and report back if my problem persists.
LLVM 2.5 is really old now, I highly suggest upgrading to 3.1 or even using svn trunk.