Do not add the pass that restores $gp if target is Mips64.
authorAkira Hatanaka <ahatanak@gmail.com>
Tue, 27 Sep 2011 16:58:43 +0000 (16:58 +0000)
committerAkira Hatanaka <ahatanak@gmail.com>
Tue, 27 Sep 2011 16:58:43 +0000 (16:58 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140607 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Mips/MipsTargetMachine.cpp

index 25211d472f07ec1f906c2327e8cd6c79d558327d..a318f81352af76f1016e25378dda495a192d7e04 100644 (file)
@@ -96,7 +96,10 @@ addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel)
 
 bool MipsTargetMachine::
 addPreRegAlloc(PassManagerBase &PM, CodeGenOpt::Level OptLevel) {
-  PM.add(createMipsEmitGPRestorePass(*this));
+  // Do not restore $gp if target is Mips64.
+  // In N32/64, $gp is a callee-saved register.
+  if (!Subtarget.hasMips64())
+    PM.add(createMipsEmitGPRestorePass(*this));
   return true;
 }