Greetings,
Hi Tony,
This is an area that's undergone some changes recently. The LLVM 2.3
multiple-return-value (MRV) syntax has been replaced by the
first-class aggregates syntax in SVN trunk.
I'm working on getting our compiler's interface to LLVM to mimic the
way the LLVM-GCC inserts instructions to generate AMD64 ABI compliant
code. I'm trying to create
ret i64 %mrv, double %double_mrv37
This is LLVM 2.3 MRV syntax.
which is basically what LLVM-GCC puts out. However if I use lcc
-march=cpp to get the API code I need it has the following line:
ReturnInst::Create(int64_t93, label_return);
with no reference to the double. I also can't find anything in the
doxygen docs for a version of ReturnInst::Create( ) that takes two
values for returning, nor could I find anything by generating an
intentionally bad call and letting my gen-compiler list the possible
ReturnInst which it knows about. Do I have to create the ReturnInst in a
different way to do this? Any guidance for how to do this from within
the CPP API would be greatly appreciated. Thanks!!
I don't know the details about the LLVM 2.3 interface offhand.
I believe there's a form of ReturnInst::Create which you can
pass multiple values, probably an array of Value*.
I can tell you about how to do this with the first-class
aggregates approach in svn trunk though.
With first-class aggregates, it's necessary to build up the
aggregate return value one piece at a time. The LLVM syntax looks
like this:
define { i64, double } @foo(i64 %x, double %y) nounwind {
%a = insertvalue { i64, double } undef, i64 %x, 0
%b = insertvalue { i64, double } %a, double %y, 1
ret { i64, double } %b
}
See the LangRef.html for details on the insertvalue instruction.
The -march=cpp backend in SVN trunk supports this too.
Also in svn trunk, if you're using the IRBuilder interface
you can use the CreateAggregateRet method, which takes care of
creating the InsertValueInsts for you.
Dan