llvm.org GIT mirror llvm / 67fdafe
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178588 91177308-0d34-0410-b5e6-96231b3b80d8 Akira Hatanaka 7 years ago
3 changed file(s) with 12 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
386386 unsigned JR = STI.isABI_N64() ? Mips::JR64 : Mips::JR;
387387 unsigned SP = STI.isABI_N64() ? Mips::SP_64 : Mips::SP;
388388 unsigned RA = STI.isABI_N64() ? Mips::RA_64 : Mips::RA;
389 unsigned T9 = STI.isABI_N64() ? Mips::T9_64 : Mips::T9;
389390 unsigned ZERO = STI.isABI_N64() ? Mips::ZERO_64 : Mips::ZERO;
390391 unsigned OffsetReg = I->getOperand(0).getReg();
391392 unsigned TargetReg = I->getOperand(1).getReg();
393394 // or $ra, $v0, $zero
394395 // addu $sp, $sp, $v1
395396 // jr $ra
397 if (TM.getRelocationModel() == Reloc::PIC_)
398 BuildMI(MBB, I, I->getDebugLoc(), TM.getInstrInfo()->get(OR), T9)
399 .addReg(TargetReg).addReg(ZERO);
396400 BuildMI(MBB, I, I->getDebugLoc(), TM.getInstrInfo()->get(OR), RA)
397401 .addReg(TargetReg).addReg(ZERO);
398402 BuildMI(MBB, I, I->getDebugLoc(), TM.getInstrInfo()->get(ADDU), SP)
3636 ; CHECK: lw $7, [[offset3]]($sp)
3737
3838 ; check that stack is adjusted by $v1 and that code returns to address in $v0
39 ; also check that $25 contains handler value
3940 ; CHECK: addiu $sp, $sp, [[spoffset]]
41 ; CHECK: move $25, $2
4042 ; CHECK: move $ra, $2
4143 ; CHECK: jr $ra
4244 ; CHECK: addu $sp, $sp, $3
7375 ; CHECK: lw $7, [[offset3]]($sp)
7476
7577 ; check that stack is adjusted by $v1 and that code returns to address in $v0
78 ; also check that $25 contains handler value
7679 ; CHECK: addiu $sp, $sp, [[spoffset]]
80 ; CHECK: move $25, $2
7781 ; CHECK: move $ra, $2
7882 ; CHECK: jr $ra
7983 ; CHECK: addu $sp, $sp, $3
3636 ; CHECK: ld $7, [[offset3]]($sp)
3737
3838 ; check that stack is adjusted by $v1 and that code returns to address in $v0
39 ; also check that $25 contains handler value
3940 ; CHECK: daddiu $sp, $sp, [[spoffset]]
41 ; CHECK: move $25, $2
4042 ; CHECK: move $ra, $2
4143 ; CHECK: jr $ra
4244 ; CHECK: daddu $sp, $sp, $3
7476 ; CHECK: ld $7, [[offset3]]($sp)
7577
7678 ; check that stack is adjusted by $v1 and that code returns to address in $v0
79 ; also check that $25 contains handler value
7780 ; CHECK: daddiu $sp, $sp, [[spoffset]]
81 ; CHECK: move $25, $2
7882 ; CHECK: move $ra, $2
7983 ; CHECK: jr $ra
8084 ; CHECK: daddu $sp, $sp, $3