mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-23 11:38:38 +00:00
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:
parent
a8056fabeb
commit
08f64c3321
@ -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) {
|
||||||
|
@ -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) {
|
||||||
|
@ -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) {
|
||||||
|
@ -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) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user