Do not use $gp as a dedicated global register if the target ABI is not O32.
[oota-llvm.git] / lib / Target / Mips / MipsMachineFunction.cpp
index 9d3a27b518ff90df75ae24f5b0cda15527da232a..8535b290b43876f82e2ebbca2d4c38b14e864867 100644 (file)
@@ -37,8 +37,8 @@ unsigned MipsFunctionInfo::getGlobalBaseReg() {
 
   const MipsSubtarget &ST = MF.getTarget().getSubtarget<MipsSubtarget>();
 
-  if (FixGlobalBaseReg) // $gp is the global base register.
-    return GlobalBaseReg = ST.isABI_N64() ? Mips::GP_64 : Mips::GP;
+  if (FixGlobalBaseReg && ST.isABI_O32()) // $gp is the global base register.
+    return GlobalBaseReg = Mips::GP;
 
   const TargetRegisterClass *RC = ST.isABI_N64() ?
     (const TargetRegisterClass*)&Mips::CPU64RegsRegClass :