aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/Mips/MipsEmitGPRestore.cpp
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanak@gmail.com>2011-05-26 18:59:03 +0000
committerAkira Hatanaka <ahatanak@gmail.com>2011-05-26 18:59:03 +0000
commitcf0cd8005c81853ddea3ce26b71491c48dc4984e (patch)
tree8504fe1b3c8d40159cd615639cf06dcd359837f5 /lib/Target/Mips/MipsEmitGPRestore.cpp
parent32bfb2c513c4efdc1db9967ddfecce8c922dda4f (diff)
downloadexternal_llvm-cf0cd8005c81853ddea3ce26b71491c48dc4984e.zip
external_llvm-cf0cd8005c81853ddea3ce26b71491c48dc4984e.tar.gz
external_llvm-cf0cd8005c81853ddea3ce26b71491c48dc4984e.tar.bz2
Add support for C++ exception handling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132131 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips/MipsEmitGPRestore.cpp')
-rw-r--r--lib/Target/Mips/MipsEmitGPRestore.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/Target/Mips/MipsEmitGPRestore.cpp b/lib/Target/Mips/MipsEmitGPRestore.cpp
index 5b84ad8..f49d490 100644
--- a/lib/Target/Mips/MipsEmitGPRestore.cpp
+++ b/lib/Target/Mips/MipsEmitGPRestore.cpp
@@ -55,6 +55,20 @@ bool Inserter::runOnMachineFunction(MachineFunction &F) {
MachineBasicBlock& MBB = *MFI;
MachineBasicBlock::iterator I = MFI->begin();
+ // If MBB is a landing pad, insert instruction that restores $gp after
+ // EH_LABEL.
+ if (MBB.isLandingPad()) {
+ // Find EH_LABEL first.
+ for (; I->getOpcode() != TargetOpcode::EH_LABEL; ++I) ;
+
+ // Insert lw.
+ ++I;
+ DebugLoc dl = I != MBB.end() ? I->getDebugLoc() : DebugLoc();
+ BuildMI(MBB, I, dl, TII->get(Mips::LW), Mips::GP).addImm(0)
+ .addFrameIndex(FI);
+ Changed = true;
+ }
+
while (I != MFI->end()) {
if (I->getOpcode() != Mips::JALR) {
++I;