Support return values of basic integer types.

Emit RETL instruction to return instead of funny JMPL.
Fix indentation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12186 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Brian Gaeke 2004-03-06 05:32:28 +00:00
parent a8056fabeb
commit 08f64c3321
4 changed files with 148 additions and 96 deletions

View File

@ -227,12 +227,25 @@ bool V8ISel::runOnFunction(Function &Fn) {
void V8ISel::visitReturnInst(ReturnInst &I) { void V8ISel::visitReturnInst(ReturnInst &I) {
if (I.getNumOperands() == 0) { if (I.getNumOperands () == 1) {
// Just emit a 'jmpl' instruction to return. unsigned RetValReg = getReg (I.getOperand (0));
BuildMI(BB, V8::JMPLi, 2, V8::G0).addZImm(8).addReg(V8::I7); switch (getClass (I.getOperand (0)->getType ())) {
case cByte:
case cShort:
case cInt:
// Schlep it over into i0 (where it will become o0 after restore).
BuildMI (BB, V8::ORrr, 2, V8::I0).addReg(V8::G0).addReg(RetValReg);
break;
default:
visitInstruction (I);
return; return;
} }
visitInstruction(I); } else if (I.getNumOperands () != 1) {
visitInstruction (I);
}
// Just emit a 'retl' instruction to return.
BuildMI(BB, V8::RETL, 0);
return;
} }
void V8ISel::visitBinaryOperator (BinaryOperator &I) { void V8ISel::visitBinaryOperator (BinaryOperator &I) {

View File

@ -227,12 +227,25 @@ bool V8ISel::runOnFunction(Function &Fn) {
void V8ISel::visitReturnInst(ReturnInst &I) { void V8ISel::visitReturnInst(ReturnInst &I) {
if (I.getNumOperands() == 0) { if (I.getNumOperands () == 1) {
// Just emit a 'jmpl' instruction to return. unsigned RetValReg = getReg (I.getOperand (0));
BuildMI(BB, V8::JMPLi, 2, V8::G0).addZImm(8).addReg(V8::I7); switch (getClass (I.getOperand (0)->getType ())) {
case cByte:
case cShort:
case cInt:
// Schlep it over into i0 (where it will become o0 after restore).
BuildMI (BB, V8::ORrr, 2, V8::I0).addReg(V8::G0).addReg(RetValReg);
break;
default:
visitInstruction (I);
return; return;
} }
visitInstruction(I); } else if (I.getNumOperands () != 1) {
visitInstruction (I);
}
// Just emit a 'retl' instruction to return.
BuildMI(BB, V8::RETL, 0);
return;
} }
void V8ISel::visitBinaryOperator (BinaryOperator &I) { void V8ISel::visitBinaryOperator (BinaryOperator &I) {

View File

@ -227,12 +227,25 @@ bool V8ISel::runOnFunction(Function &Fn) {
void V8ISel::visitReturnInst(ReturnInst &I) { void V8ISel::visitReturnInst(ReturnInst &I) {
if (I.getNumOperands() == 0) { if (I.getNumOperands () == 1) {
// Just emit a 'jmpl' instruction to return. unsigned RetValReg = getReg (I.getOperand (0));
BuildMI(BB, V8::JMPLi, 2, V8::G0).addZImm(8).addReg(V8::I7); switch (getClass (I.getOperand (0)->getType ())) {
case cByte:
case cShort:
case cInt:
// Schlep it over into i0 (where it will become o0 after restore).
BuildMI (BB, V8::ORrr, 2, V8::I0).addReg(V8::G0).addReg(RetValReg);
break;
default:
visitInstruction (I);
return; return;
} }
visitInstruction(I); } else if (I.getNumOperands () != 1) {
visitInstruction (I);
}
// Just emit a 'retl' instruction to return.
BuildMI(BB, V8::RETL, 0);
return;
} }
void V8ISel::visitBinaryOperator (BinaryOperator &I) { void V8ISel::visitBinaryOperator (BinaryOperator &I) {

View File

@ -227,12 +227,25 @@ bool V8ISel::runOnFunction(Function &Fn) {
void V8ISel::visitReturnInst(ReturnInst &I) { void V8ISel::visitReturnInst(ReturnInst &I) {
if (I.getNumOperands() == 0) { if (I.getNumOperands () == 1) {
// Just emit a 'jmpl' instruction to return. unsigned RetValReg = getReg (I.getOperand (0));
BuildMI(BB, V8::JMPLi, 2, V8::G0).addZImm(8).addReg(V8::I7); switch (getClass (I.getOperand (0)->getType ())) {
case cByte:
case cShort:
case cInt:
// Schlep it over into i0 (where it will become o0 after restore).
BuildMI (BB, V8::ORrr, 2, V8::I0).addReg(V8::G0).addReg(RetValReg);
break;
default:
visitInstruction (I);
return; return;
} }
visitInstruction(I); } else if (I.getNumOperands () != 1) {
visitInstruction (I);
}
// Just emit a 'retl' instruction to return.
BuildMI(BB, V8::RETL, 0);
return;
} }
void V8ISel::visitBinaryOperator (BinaryOperator &I) { void V8ISel::visitBinaryOperator (BinaryOperator &I) {