From dcb802cf7be8e540e487c699f25d89c4821536ab Mon Sep 17 00:00:00 2001 From: Anton Korobeynikov Date: Sun, 3 May 2009 13:00:11 +0000 Subject: [PATCH] Provide set of reserved registers git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70704 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/MSP430/MSP430ISelLowering.cpp | 8 ++++---- lib/Target/MSP430/MSP430RegisterInfo.cpp | 14 +++++++++++++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/lib/Target/MSP430/MSP430ISelLowering.cpp b/lib/Target/MSP430/MSP430ISelLowering.cpp index 625df96d198..7577a53b8f2 100644 --- a/lib/Target/MSP430/MSP430ISelLowering.cpp +++ b/lib/Target/MSP430/MSP430ISelLowering.cpp @@ -80,8 +80,8 @@ SDValue MSP430TargetLowering::LowerFORMAL_ARGUMENTS(SDValue Op, /// generate load operations for arguments places on the stack. // FIXME: struct return stuff // FIXME: varargs -SDValue MSP430TargetLowering:: LowerCCCArguments(SDValue Op, - SelectionDAG &DAG) { +SDValue MSP430TargetLowering::LowerCCCArguments(SDValue Op, + SelectionDAG &DAG) { MachineFunction &MF = DAG.getMachineFunction(); MachineFrameInfo *MFI = MF.getFrameInfo(); MachineRegisterInfo &RegInfo = MF.getRegInfo(); @@ -193,8 +193,8 @@ SDValue MSP430TargetLowering::LowerRET(SDValue Op, SelectionDAG &DAG) { Chain = DAG.getCopyToReg(Chain, dl, VA.getLocReg(), Op.getOperand(i*2+1), Flag); - // guarantee that all emitted copies are - // stuck together, avoiding something bad + // Guarantee that all emitted copies are stuck together, + // avoiding something bad. Flag = Chain.getValue(1); } diff --git a/lib/Target/MSP430/MSP430RegisterInfo.cpp b/lib/Target/MSP430/MSP430RegisterInfo.cpp index 1b9fc67db6d..f86f120d2b6 100644 --- a/lib/Target/MSP430/MSP430RegisterInfo.cpp +++ b/lib/Target/MSP430/MSP430RegisterInfo.cpp @@ -38,7 +38,19 @@ MSP430RegisterInfo::getCalleeSavedRegClasses(const MachineFunction *MF) const { BitVector MSP430RegisterInfo::getReservedRegs(const MachineFunction &MF) const { - assert(0 && "Not implemented yet!"); + BitVector Reserved(getNumRegs()); + + // Mark 4 special registers as reserved. + Reserved.set(MSP430::PC); + Reserved.set(MSP430::SP); + Reserved.set(MSP430::SR); + Reserved.set(MSP430::CG); + + // Mark frame pointer as reserved if needed. + if (hasFP(MF)) + Reserved.set(MSP430::FP); + + return Reserved; } bool MSP430RegisterInfo::hasFP(const MachineFunction &MF) const { -- 2.34.1