[LLVMdev] How to define a function with multiple return values?
Tzu-Chien Chiu
tzuchien.chiu at gmail.com
Thu Jul 28 23:18:14 PDT 2005
LegalizeDAG.cpp
SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
case ISD::RET:
Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain.
switch (Node->getNumOperands()) {
case 2: // ret val
[skipped]
case 1: // ret void
[skipped]
default: { // ret <values>
[skipped]
Does it imply that a ret instruction may return more than one values?
ret uint 1, uint 2, ubyte 3, uint 4
But at most one return value is allowed, according to
http://llvm.cs.uiuc.edu/docs/LangRef.html#i_ret
Syntax:
ret <type> <value> ; Return a value from a non-void function
ret void ; Return from void function
How to define a function with multiple return values? The code:
uint, uint, ubyte, uint %main() {
ret uint 1, uint 2, ubyte 3, uint 4
}
cannot be correctly assembled by llvm-as.
--
Tzu-Chien Chiu,
3D Graphics Hardware Architect
<URL:http://www.csie.nctu.edu.tw/~jwchiu>
More information about the llvm-dev
mailing list