From: Akira Hatanaka Date: Tue, 27 Sep 2011 16:58:43 +0000 (+0000) Subject: Do not add the pass that restores $gp if target is Mips64. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=78fec58c07837ecf935cf437ec672b8b46ff6d7b;p=oota-llvm.git Do not add the pass that restores $gp if target is Mips64. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140607 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/Mips/MipsTargetMachine.cpp b/lib/Target/Mips/MipsTargetMachine.cpp index 25211d472f0..a318f81352a 100644 --- a/lib/Target/Mips/MipsTargetMachine.cpp +++ b/lib/Target/Mips/MipsTargetMachine.cpp @@ -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; }