mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-04 21:30:49 +00:00
Support to provide exception and selector registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34482 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b180aa1753
commit
62819f3144
@ -469,7 +469,15 @@ public:
|
||||
/// getRARegister - This method should return the register where the return
|
||||
/// address can be found.
|
||||
virtual unsigned getRARegister() const = 0;
|
||||
|
||||
|
||||
/// getEHExceptionRegister - This method should return the register containing
|
||||
/// the address of the exception info on entry to a landing pad.
|
||||
virtual unsigned getEHExceptionRegister() const = 0;
|
||||
|
||||
/// getEHHandlerRegister - This method should return the register containing
|
||||
/// the switch table selection on entry to an landing pad.
|
||||
virtual unsigned getEHHandlerRegister() const = 0;
|
||||
|
||||
/// getLocation - This method should return the actual location of a frame
|
||||
/// variable given the frame index. The location is returned in ML.
|
||||
/// Subclasses should override this method for special handling of frame
|
||||
|
@ -1190,6 +1190,9 @@ SDOperand ARMTargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) {
|
||||
return LowerFORMAL_ARGUMENTS(Op, DAG);
|
||||
case ISD::RETURNADDR: break;
|
||||
case ISD::FRAMEADDR: break;
|
||||
// Exception address and exception selector. Currently unimplemented.
|
||||
case ISD::EXCEPTIONADDR: break;
|
||||
case ISD::EHSELECTION: break;
|
||||
}
|
||||
return SDOperand();
|
||||
}
|
||||
|
@ -1287,5 +1287,15 @@ unsigned ARMRegisterInfo::getFrameRegister(MachineFunction &MF) const {
|
||||
return STI.useThumbBacktraces() ? ARM::R7 : ARM::R11;
|
||||
}
|
||||
|
||||
unsigned ARMRegisterInfo::getEHExceptionRegister() const {
|
||||
assert(0 && "What is the exception register");
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned ARMRegisterInfo::getEHHandlerRegister() const {
|
||||
assert(0 && "What is the exception handler register");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include "ARMGenRegisterInfo.inc"
|
||||
|
||||
|
@ -85,6 +85,10 @@ public:
|
||||
// Debug information queries.
|
||||
unsigned getRARegister() const;
|
||||
unsigned getFrameRegister(MachineFunction &MF) const;
|
||||
|
||||
// Exception handling queries.
|
||||
unsigned getEHExceptionRegister() const;
|
||||
unsigned getEHHandlerRegister() const;
|
||||
};
|
||||
|
||||
} // end namespace llvm
|
||||
|
@ -548,8 +548,11 @@ SDOperand AlphaTargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) {
|
||||
return DAG.getNode(AlphaISD::GlobalRetAddr, MVT::i64);
|
||||
//FIXME: implement
|
||||
case ISD::FRAMEADDR: break;
|
||||
// Exception address and exception selector. Currently unimplemented.
|
||||
case ISD::EXCEPTIONADDR: break;
|
||||
case ISD::EHSELECTION: break;
|
||||
}
|
||||
|
||||
|
||||
return SDOperand();
|
||||
}
|
||||
|
||||
|
@ -399,6 +399,16 @@ unsigned AlphaRegisterInfo::getFrameRegister(MachineFunction &MF) const {
|
||||
return hasFP(MF) ? Alpha::R15 : Alpha::R30;
|
||||
}
|
||||
|
||||
unsigned AlphaRegisterInfo::getEHExceptionRegister() const {
|
||||
assert(0 && "What is the exception register");
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned AlphaRegisterInfo::getEHHandlerRegister() const {
|
||||
assert(0 && "What is the exception handler register");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include "AlphaGenRegisterInfo.inc"
|
||||
|
||||
std::string AlphaRegisterInfo::getPrettyName(unsigned reg)
|
||||
|
@ -68,6 +68,10 @@ struct AlphaRegisterInfo : public AlphaGenRegisterInfo {
|
||||
unsigned getRARegister() const;
|
||||
unsigned getFrameRegister(MachineFunction &MF) const;
|
||||
|
||||
// Exception handling queries.
|
||||
unsigned getEHExceptionRegister() const;
|
||||
unsigned getEHHandlerRegister() const;
|
||||
|
||||
static std::string getPrettyName(unsigned reg);
|
||||
};
|
||||
|
||||
|
@ -590,6 +590,9 @@ LowerOperation(SDOperand Op, SelectionDAG &DAG) {
|
||||
// Frame & Return address. Currently unimplemented
|
||||
case ISD::RETURNADDR: break;
|
||||
case ISD::FRAMEADDR: break;
|
||||
// Exception address and exception selector. Currently unimplemented.
|
||||
case ISD::EXCEPTIONADDR: break;
|
||||
case ISD::EHSELECTION: break;
|
||||
}
|
||||
return SDOperand();
|
||||
}
|
||||
|
@ -360,5 +360,15 @@ unsigned IA64RegisterInfo::getFrameRegister(MachineFunction &MF) const {
|
||||
return hasFP(MF) ? IA64::r5 : IA64::r12;
|
||||
}
|
||||
|
||||
unsigned IA64RegisterInfo::getEHExceptionRegister() const {
|
||||
assert(0 && "What is the exception register");
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned IA64RegisterInfo::getEHHandlerRegister() const {
|
||||
assert(0 && "What is the exception handler register");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include "IA64GenRegisterInfo.inc"
|
||||
|
||||
|
@ -64,6 +64,10 @@ struct IA64RegisterInfo : public IA64GenRegisterInfo {
|
||||
// Debug information queries.
|
||||
unsigned getRARegister() const;
|
||||
unsigned getFrameRegister(MachineFunction &MF) const;
|
||||
|
||||
// Exception handling queries.
|
||||
unsigned getEHExceptionRegister() const;
|
||||
unsigned getEHHandlerRegister() const;
|
||||
};
|
||||
|
||||
} // End llvm namespace
|
||||
|
@ -2610,6 +2610,30 @@ static SDOperand LowerMUL(SDOperand Op, SelectionDAG &DAG) {
|
||||
}
|
||||
}
|
||||
|
||||
/// LowerEXCEPTIONADDR - Replace EXCEPTIONADDR with a copy from the exception
|
||||
/// register. The register was made live in the ISel.
|
||||
static SDOperand LowerEXCEPTIONADDR(SDOperand Op, SelectionDAG &DAG) {
|
||||
const MRegisterInfo *MRI = DAG.getTargetLoweringInfo().
|
||||
getTargetMachine().
|
||||
getRegisterInfo();
|
||||
MVT::ValueType VT = Op.Val->getValueType(0);
|
||||
unsigned Reg = MRI->getEHExceptionRegister();
|
||||
SDOperand Result = DAG.getCopyFromReg(Op.getOperand(0), Reg, VT);
|
||||
return Result.getValue(Op.ResNo);
|
||||
}
|
||||
|
||||
/// LowerEXCEPTIONADDR - Replace EHSELECTION with a copy from the exception
|
||||
/// selection register. The register was made live in the ISel.
|
||||
static SDOperand LowerEHSELECTION(SDOperand Op, SelectionDAG &DAG) {
|
||||
const MRegisterInfo *MRI = DAG.getTargetLoweringInfo().
|
||||
getTargetMachine().
|
||||
getRegisterInfo();
|
||||
MVT::ValueType VT = Op.Val->getValueType(0);
|
||||
unsigned Reg = MRI->getEHHandlerRegister();
|
||||
SDOperand Result = DAG.getCopyFromReg(Op.getOperand(1), Reg, VT);
|
||||
return Result.getValue(Op.ResNo);
|
||||
}
|
||||
|
||||
/// LowerOperation - Provide custom lowering hooks for some operations.
|
||||
///
|
||||
SDOperand PPCTargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) {
|
||||
@ -2647,6 +2671,10 @@ SDOperand PPCTargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) {
|
||||
// Frame & Return address. Currently unimplemented
|
||||
case ISD::RETURNADDR: break;
|
||||
case ISD::FRAMEADDR: break;
|
||||
|
||||
// Exception address and exception selector.
|
||||
case ISD::EXCEPTIONADDR: return LowerEXCEPTIONADDR(Op, DAG);
|
||||
case ISD::EHSELECTION: return LowerEHSELECTION(Op, DAG);
|
||||
}
|
||||
return SDOperand();
|
||||
}
|
||||
|
@ -1022,7 +1022,6 @@ void PPCRegisterInfo::emitEpilogue(MachineFunction &MF,
|
||||
|
||||
unsigned PPCRegisterInfo::getRARegister() const {
|
||||
return !Subtarget.isPPC64() ? PPC::LR : PPC::LR8;
|
||||
|
||||
}
|
||||
|
||||
unsigned PPCRegisterInfo::getFrameRegister(MachineFunction &MF) const {
|
||||
@ -1040,5 +1039,13 @@ void PPCRegisterInfo::getInitialFrameState(std::vector<MachineMove> &Moves)
|
||||
Moves.push_back(MachineMove(0, Dst, Src));
|
||||
}
|
||||
|
||||
unsigned PPCRegisterInfo::getEHExceptionRegister() const {
|
||||
return !Subtarget.isPPC64() ? PPC::R3 : PPC::X3;
|
||||
}
|
||||
|
||||
unsigned PPCRegisterInfo::getEHHandlerRegister() const {
|
||||
return !Subtarget.isPPC64() ? PPC::R4 : PPC::X4;
|
||||
}
|
||||
|
||||
#include "PPCGenRegisterInfo.inc"
|
||||
|
||||
|
@ -89,6 +89,10 @@ public:
|
||||
unsigned getRARegister() const;
|
||||
unsigned getFrameRegister(MachineFunction &MF) const;
|
||||
void getInitialFrameState(std::vector<MachineMove> &Moves) const;
|
||||
|
||||
// Exception handling queries.
|
||||
unsigned getEHExceptionRegister() const;
|
||||
unsigned getEHHandlerRegister() const;
|
||||
};
|
||||
|
||||
} // end namespace llvm
|
||||
|
@ -871,6 +871,9 @@ LowerOperation(SDOperand Op, SelectionDAG &DAG) {
|
||||
// Frame & Return address. Currently unimplemented
|
||||
case ISD::RETURNADDR: break;
|
||||
case ISD::FRAMEADDR: break;
|
||||
// Exception address and exception selector. Currently unimplemented.
|
||||
case ISD::EXCEPTIONADDR: break;
|
||||
case ISD::EHSELECTION: break;
|
||||
}
|
||||
return SDOperand();
|
||||
}
|
||||
|
@ -250,5 +250,15 @@ unsigned SparcRegisterInfo::getFrameRegister(MachineFunction &MF) const {
|
||||
return SP::G1;
|
||||
}
|
||||
|
||||
unsigned SparcRegisterInfo::getEHExceptionRegister() const {
|
||||
assert(0 && "What is the exception register");
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned SparcRegisterInfo::getEHHandlerRegister() const {
|
||||
assert(0 && "What is the exception handler register");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include "SparcGenRegisterInfo.inc"
|
||||
|
||||
|
@ -70,6 +70,10 @@ struct SparcRegisterInfo : public SparcGenRegisterInfo {
|
||||
// Debug information queries.
|
||||
unsigned getRARegister() const;
|
||||
unsigned getFrameRegister(MachineFunction &MF) const;
|
||||
|
||||
// Exception handling queries.
|
||||
unsigned getEHExceptionRegister() const;
|
||||
unsigned getEHHandlerRegister() const;
|
||||
};
|
||||
|
||||
} // end namespace llvm
|
||||
|
@ -4675,7 +4675,11 @@ SDOperand X86TargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) {
|
||||
case ISD::INTRINSIC_WO_CHAIN: return LowerINTRINSIC_WO_CHAIN(Op, DAG);
|
||||
case ISD::RETURNADDR: return LowerRETURNADDR(Op, DAG);
|
||||
case ISD::FRAMEADDR: return LowerFRAMEADDR(Op, DAG);
|
||||
// Exception address and exception selector. Currently unimplemented.
|
||||
case ISD::EXCEPTIONADDR: break;
|
||||
case ISD::EHSELECTION: break;
|
||||
}
|
||||
return SDOperand();
|
||||
}
|
||||
|
||||
const char *X86TargetLowering::getTargetNodeName(unsigned Opcode) const {
|
||||
|
@ -1193,6 +1193,16 @@ void X86RegisterInfo::getInitialFrameState(std::vector<MachineMove> &Moves)
|
||||
Moves.push_back(MachineMove(0, Dst, Src));
|
||||
}
|
||||
|
||||
unsigned X86RegisterInfo::getEHExceptionRegister() const {
|
||||
assert(0 && "What is the exception register");
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned X86RegisterInfo::getEHHandlerRegister() const {
|
||||
assert(0 && "What is the exception handler register");
|
||||
return 0;
|
||||
}
|
||||
|
||||
namespace llvm {
|
||||
unsigned getX86SubSuperRegister(unsigned Reg, MVT::ValueType VT, bool High) {
|
||||
switch (VT) {
|
||||
|
@ -101,6 +101,10 @@ public:
|
||||
unsigned getRARegister() const;
|
||||
unsigned getFrameRegister(MachineFunction &MF) const;
|
||||
void getInitialFrameState(std::vector<MachineMove> &Moves) const;
|
||||
|
||||
// Exception handling queries.
|
||||
unsigned getEHExceptionRegister() const;
|
||||
unsigned getEHHandlerRegister() const;
|
||||
};
|
||||
|
||||
// getX86SubSuperRegister - X86 utility function. It returns the sub or super
|
||||
|
Loading…
Reference in New Issue
Block a user