mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-29 13:24:25 +00:00
Simplify lowering and selection of exception ops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34491 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -403,6 +403,20 @@ public:
|
|||||||
return StackPointerRegisterToSaveRestore;
|
return StackPointerRegisterToSaveRestore;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// getExceptionAddressRegister - If a physical register, this returns
|
||||||
|
/// the register that receives the exception address on entry to a landing
|
||||||
|
/// pad.
|
||||||
|
unsigned getExceptionAddressRegister() const {
|
||||||
|
return ExceptionPointerRegister;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// getExceptionSelectorRegister - If a physical register, this returns
|
||||||
|
/// the register that receives the exception typeid on entry to a landing
|
||||||
|
/// pad.
|
||||||
|
unsigned getExceptionSelectorRegister() const {
|
||||||
|
return ExceptionSelectorRegister;
|
||||||
|
}
|
||||||
|
|
||||||
/// getJumpBufSize - returns the target's jmp_buf size in bytes (if never
|
/// getJumpBufSize - returns the target's jmp_buf size in bytes (if never
|
||||||
/// set, the default is 200)
|
/// set, the default is 200)
|
||||||
unsigned getJumpBufSize() const {
|
unsigned getJumpBufSize() const {
|
||||||
@ -604,6 +618,20 @@ protected:
|
|||||||
StackPointerRegisterToSaveRestore = R;
|
StackPointerRegisterToSaveRestore = R;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// setExceptionPointerRegister - If set to a physical register, this sets
|
||||||
|
/// the register that receives the exception address on entry to a landing
|
||||||
|
/// pad.
|
||||||
|
void setExceptionPointerRegister(unsigned R) {
|
||||||
|
ExceptionPointerRegister = R;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// setExceptionSelectorRegister - If set to a physical register, this sets
|
||||||
|
/// the register that receives the exception typeid on entry to a landing
|
||||||
|
/// pad.
|
||||||
|
void setExceptionSelectorRegister(unsigned R) {
|
||||||
|
ExceptionSelectorRegister = R;
|
||||||
|
}
|
||||||
|
|
||||||
/// SelectIsExpensive - Tells the code generator not to expand operations
|
/// SelectIsExpensive - Tells the code generator not to expand operations
|
||||||
/// into sequences that use the select operations if possible.
|
/// into sequences that use the select operations if possible.
|
||||||
void setSelectIsExpensive() { SelectIsExpensive = true; }
|
void setSelectIsExpensive() { SelectIsExpensive = true; }
|
||||||
@ -956,6 +984,16 @@ private:
|
|||||||
/// and restore.
|
/// and restore.
|
||||||
unsigned StackPointerRegisterToSaveRestore;
|
unsigned StackPointerRegisterToSaveRestore;
|
||||||
|
|
||||||
|
/// ExceptionPointerRegister - If set to a physical register, this specifies
|
||||||
|
/// the register that receives the exception address on entry to a landing
|
||||||
|
/// pad.
|
||||||
|
unsigned ExceptionPointerRegister;
|
||||||
|
|
||||||
|
/// ExceptionSelectorRegister - If set to a physical register, this specifies
|
||||||
|
/// the register that receives the exception typeid on entry to a landing
|
||||||
|
/// pad.
|
||||||
|
unsigned ExceptionSelectorRegister;
|
||||||
|
|
||||||
/// RegClassForVT - This indicates the default register class to use for
|
/// RegClassForVT - This indicates the default register class to use for
|
||||||
/// each ValueType the target supports natively.
|
/// each ValueType the target supports natively.
|
||||||
TargetRegisterClass *RegClassForVT[MVT::LAST_VALUETYPE];
|
TargetRegisterClass *RegClassForVT[MVT::LAST_VALUETYPE];
|
||||||
|
@ -668,8 +668,6 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
|
|||||||
break;
|
break;
|
||||||
case ISD::FRAMEADDR:
|
case ISD::FRAMEADDR:
|
||||||
case ISD::RETURNADDR:
|
case ISD::RETURNADDR:
|
||||||
case ISD::EXCEPTIONADDR:
|
|
||||||
case ISD::EHSELECTION:
|
|
||||||
// The only option for these nodes is to custom lower them. If the target
|
// The only option for these nodes is to custom lower them. If the target
|
||||||
// does not custom lower them, then return zero.
|
// does not custom lower them, then return zero.
|
||||||
Tmp1 = TLI.LowerOperation(Op, DAG);
|
Tmp1 = TLI.LowerOperation(Op, DAG);
|
||||||
@ -678,6 +676,32 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
|
|||||||
else
|
else
|
||||||
Result = DAG.getConstant(0, TLI.getPointerTy());
|
Result = DAG.getConstant(0, TLI.getPointerTy());
|
||||||
break;
|
break;
|
||||||
|
case ISD::EHSELECTION:
|
||||||
|
LegalizeOp(Node->getOperand(1));
|
||||||
|
// Fall Thru
|
||||||
|
case ISD::EXCEPTIONADDR: {
|
||||||
|
Tmp1 = LegalizeOp(Node->getOperand(0));
|
||||||
|
MVT::ValueType VT = Node->getValueType(0);
|
||||||
|
switch (TLI.getOperationAction(Node->getOpcode(), VT)) {
|
||||||
|
default: assert(0 && "This action is not supported yet!");
|
||||||
|
case TargetLowering::Expand: {
|
||||||
|
unsigned Reg = Node->getOpcode() == ISD::EXCEPTIONADDR ?
|
||||||
|
TLI.getExceptionAddressRegister() :
|
||||||
|
TLI.getExceptionSelectorRegister();
|
||||||
|
Result = DAG.getCopyFromReg(Tmp1, Reg, VT).getValue(Op.ResNo);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case TargetLowering::Custom:
|
||||||
|
Result = TLI.LowerOperation(Op, DAG);
|
||||||
|
if (Result.Val) break;
|
||||||
|
// Fall Thru
|
||||||
|
case TargetLowering::Legal:
|
||||||
|
Result = DAG.getNode(ISD::MERGE_VALUES, VT, DAG.getConstant(0, VT), Tmp1).
|
||||||
|
getValue(Op.ResNo);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case ISD::AssertSext:
|
case ISD::AssertSext:
|
||||||
case ISD::AssertZext:
|
case ISD::AssertZext:
|
||||||
Tmp1 = LegalizeOp(Node->getOperand(0));
|
Tmp1 = LegalizeOp(Node->getOperand(0));
|
||||||
|
Reference in New Issue
Block a user