[llvm] r178588 - [mips] Small update to the implementation of eh.return for Mips.
Akira Hatanaka
ahatanaka at mips.com
Tue Apr 2 16:02:07 PDT 2013
Author: ahatanak
Date: Tue Apr 2 18:02:07 2013
New Revision: 178588
URL: http://llvm.org/viewvc/llvm-project?rev=178588&view=rev
Log:
[mips] Small update to the implementation of eh.return for Mips.
This patch initializes t9 to the handler address, but only if the relocation
model is pic. This handles the case where handler to which eh.return jumps
points to the start of the function.
Patch by Sasa Stankovic.
Modified:
llvm/trunk/lib/Target/Mips/MipsSEInstrInfo.cpp
llvm/trunk/test/CodeGen/Mips/eh-return32.ll
llvm/trunk/test/CodeGen/Mips/eh-return64.ll
Modified: llvm/trunk/lib/Target/Mips/MipsSEInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsSEInstrInfo.cpp?rev=178588&r1=178587&r2=178588&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsSEInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsSEInstrInfo.cpp Tue Apr 2 18:02:07 2013
@@ -387,6 +387,7 @@ void MipsSEInstrInfo::ExpandEhReturn(Mac
unsigned JR = STI.isABI_N64() ? Mips::JR64 : Mips::JR;
unsigned SP = STI.isABI_N64() ? Mips::SP_64 : Mips::SP;
unsigned RA = STI.isABI_N64() ? Mips::RA_64 : Mips::RA;
+ unsigned T9 = STI.isABI_N64() ? Mips::T9_64 : Mips::T9;
unsigned ZERO = STI.isABI_N64() ? Mips::ZERO_64 : Mips::ZERO;
unsigned OffsetReg = I->getOperand(0).getReg();
unsigned TargetReg = I->getOperand(1).getReg();
@@ -394,6 +395,9 @@ void MipsSEInstrInfo::ExpandEhReturn(Mac
// or $ra, $v0, $zero
// addu $sp, $sp, $v1
// jr $ra
+ if (TM.getRelocationModel() == Reloc::PIC_)
+ BuildMI(MBB, I, I->getDebugLoc(), TM.getInstrInfo()->get(OR), T9)
+ .addReg(TargetReg).addReg(ZERO);
BuildMI(MBB, I, I->getDebugLoc(), TM.getInstrInfo()->get(OR), RA)
.addReg(TargetReg).addReg(ZERO);
BuildMI(MBB, I, I->getDebugLoc(), TM.getInstrInfo()->get(ADDU), SP)
Modified: llvm/trunk/test/CodeGen/Mips/eh-return32.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/eh-return32.ll?rev=178588&r1=178587&r2=178588&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/eh-return32.ll (original)
+++ llvm/trunk/test/CodeGen/Mips/eh-return32.ll Tue Apr 2 18:02:07 2013
@@ -37,7 +37,9 @@ entry:
; CHECK: lw $7, [[offset3]]($sp)
; check that stack is adjusted by $v1 and that code returns to address in $v0
+; also check that $25 contains handler value
; CHECK: addiu $sp, $sp, [[spoffset]]
+; CHECK: move $25, $2
; CHECK: move $ra, $2
; CHECK: jr $ra
; CHECK: addu $sp, $sp, $3
@@ -74,7 +76,9 @@ entry:
; CHECK: lw $7, [[offset3]]($sp)
; check that stack is adjusted by $v1 and that code returns to address in $v0
+; also check that $25 contains handler value
; CHECK: addiu $sp, $sp, [[spoffset]]
+; CHECK: move $25, $2
; CHECK: move $ra, $2
; CHECK: jr $ra
; CHECK: addu $sp, $sp, $3
Modified: llvm/trunk/test/CodeGen/Mips/eh-return64.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/eh-return64.ll?rev=178588&r1=178587&r2=178588&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/eh-return64.ll (original)
+++ llvm/trunk/test/CodeGen/Mips/eh-return64.ll Tue Apr 2 18:02:07 2013
@@ -37,7 +37,9 @@ entry:
; CHECK: ld $7, [[offset3]]($sp)
; check that stack is adjusted by $v1 and that code returns to address in $v0
+; also check that $25 contains handler value
; CHECK: daddiu $sp, $sp, [[spoffset]]
+; CHECK: move $25, $2
; CHECK: move $ra, $2
; CHECK: jr $ra
; CHECK: daddu $sp, $sp, $3
@@ -75,7 +77,9 @@ entry:
; CHECK: ld $7, [[offset3]]($sp)
; check that stack is adjusted by $v1 and that code returns to address in $v0
+; also check that $25 contains handler value
; CHECK: daddiu $sp, $sp, [[spoffset]]
+; CHECK: move $25, $2
; CHECK: move $ra, $2
; CHECK: jr $ra
; CHECK: daddu $sp, $sp, $3
More information about the llvm-commits
mailing list