diff options
author | Akira Hatanaka <ahatanak@gmail.com> | 2011-06-02 00:24:44 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanak@gmail.com> | 2011-06-02 00:24:44 +0000 |
commit | 2e591477af1ef8e3c5ba6d51e8aeee8c99c7fa8e (patch) | |
tree | a45ed0d864f03420d52e58cc2624e93050fbf919 /lib/Target/Mips | |
parent | 7c6a5a2c397bb3759ed5df80a2ff9a4fdf17675a (diff) | |
download | llvm-2e591477af1ef8e3c5ba6d51e8aeee8c99c7fa8e.tar.gz llvm-2e591477af1ef8e3c5ba6d51e8aeee8c99c7fa8e.tar.bz2 llvm-2e591477af1ef8e3c5ba6d51e8aeee8c99c7fa8e.tar.xz |
Custom-lower FRAMEADDR. Patch by Sasa Stankovic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132444 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips')
-rw-r--r-- | lib/Target/Mips/MipsFrameLowering.cpp | 3 | ||||
-rw-r--r-- | lib/Target/Mips/MipsISelLowering.cpp | 14 | ||||
-rw-r--r-- | lib/Target/Mips/MipsISelLowering.h | 1 |
3 files changed, 17 insertions, 1 deletions
diff --git a/lib/Target/Mips/MipsFrameLowering.cpp b/lib/Target/Mips/MipsFrameLowering.cpp index 3b7e051439..091c1b248f 100644 --- a/lib/Target/Mips/MipsFrameLowering.cpp +++ b/lib/Target/Mips/MipsFrameLowering.cpp @@ -84,7 +84,8 @@ using namespace llvm; // if frame pointer elimination is disabled. bool MipsFrameLowering::hasFP(const MachineFunction &MF) const { const MachineFrameInfo *MFI = MF.getFrameInfo(); - return DisableFramePointerElim(MF) || MFI->hasVarSizedObjects(); + return DisableFramePointerElim(MF) || MFI->hasVarSizedObjects() + || MFI->isFrameAddressTaken(); } bool MipsFrameLowering::targetHandlesStackFrameRounding() const { diff --git a/lib/Target/Mips/MipsISelLowering.cpp b/lib/Target/Mips/MipsISelLowering.cpp index f737fd35d9..d6ac5ef184 100644 --- a/lib/Target/Mips/MipsISelLowering.cpp +++ b/lib/Target/Mips/MipsISelLowering.cpp @@ -523,6 +523,7 @@ LowerOperation(SDValue Op, SelectionDAG &DAG) const case ISD::SELECT: return LowerSELECT(Op, DAG); case ISD::VASTART: return LowerVASTART(Op, DAG); case ISD::FCOPYSIGN: return LowerFCOPYSIGN(Op, DAG); + case ISD::FRAMEADDR: return LowerFRAMEADDR(Op, DAG); } return SDValue(); } @@ -1551,6 +1552,19 @@ SDValue MipsTargetLowering::LowerFCOPYSIGN(SDValue Op, SelectionDAG &DAG) return LowerFCOPYSIGN64(Op, DAG, Subtarget->isLittle()); } +SDValue MipsTargetLowering:: +LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const { + unsigned Depth = cast<ConstantSDNode>(Op.getOperand(0))->getZExtValue(); + assert((Depth == 0) && "Frame address can only be determined for current frame."); + + MachineFrameInfo *MFI = DAG.getMachineFunction().getFrameInfo(); + MFI->setFrameAddressIsTaken(true); + EVT VT = Op.getValueType(); + DebugLoc dl = Op.getDebugLoc(); + SDValue FrameAddr = DAG.getCopyFromReg(DAG.getEntryNode(), dl, Mips::FP, VT); + return FrameAddr; +} + //===----------------------------------------------------------------------===// // Calling Convention Implementation //===----------------------------------------------------------------------===// diff --git a/lib/Target/Mips/MipsISelLowering.h b/lib/Target/Mips/MipsISelLowering.h index 7c6b6e7596..fbcedfddf9 100644 --- a/lib/Target/Mips/MipsISelLowering.h +++ b/lib/Target/Mips/MipsISelLowering.h @@ -125,6 +125,7 @@ namespace llvm { SDValue LowerSELECT(SDValue Op, SelectionDAG &DAG) const; SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG) const; SDValue LowerFCOPYSIGN(SDValue Op, SelectionDAG &DAG) const; + SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const; virtual SDValue LowerFormalArguments(SDValue Chain, |