]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
mips.c (mips_emit_loadgp): Return early if there is nothing do to...
authorRichard Sandiford <rdsandiford@googlemail.com>
Thu, 5 Jun 2008 16:33:42 +0000 (16:33 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Thu, 5 Jun 2008 16:33:42 +0000 (16:33 +0000)
gcc/
* config/mips/mips.c (mips_emit_loadgp): Return early if
there is nothing do to, otherwise emit a blockage if
!TARGET_EXPLICIT_RELOCS || current_function_profile.
* config/mips/mips.md (loadgp_blockage): Use SI rather than DI.

From-SVN: r136407

gcc/ChangeLog
gcc/config/mips/mips.c
gcc/config/mips/mips.md

index acb6ecd4b0077b33d8a6b214811d5a6fcf6183b4..fd5a9ff3f9338a85fb690e52436fe934558d34fb 100644 (file)
@@ -1,3 +1,10 @@
+2008-06-05  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       * config/mips/mips.c (mips_emit_loadgp): Return early if
+       there is nothing do to, otherwise emit a blockage if
+       !TARGET_EXPLICIT_RELOCS || current_function_profile.
+       * config/mips/mips.md (loadgp_blockage): Use SI rather than DI.
+
 2008-05-29  Eric Botcazou  <ebotcazou@adacore.com>
 
        * tree-nested.c (check_for_nested_with_variably_modified): Fix typo.
index 1abbe49355b3a1e8e3ca68314319e9f62bbbd0f4..ff020bf9349f0602684de97506af6d6ec3cbaa8c 100644 (file)
@@ -6709,13 +6709,16 @@ mips_emit_loadgp (void)
       offset = mips_unspec_address (addr, SYMBOL_GOTOFF_LOADGP);
       incoming_address = gen_rtx_REG (Pmode, PIC_FUNCTION_ADDR_REGNUM);
       emit_insn (gen_loadgp (offset, incoming_address));
-      if (!TARGET_EXPLICIT_RELOCS)
-       emit_insn (gen_loadgp_blockage ());
       break;
 
     default:
-      break;
+      return;
     }
+  /* Emit a blockage if there are implicit uses of the GP register.
+     This includes profiled functions, because FUNCTION_PROFILE uses
+     a jal macro.  */
+  if (!TARGET_EXPLICIT_RELOCS || current_function_profile)
+    emit_insn (gen_loadgp_blockage ());
 }
 
 /* Set up the stack and frame (if desired) for the function.  */
index f22043416b4ab0ee1401fa4af7a617590c0733f0..6a940d53ad166025b67bb4555c1360809c585cfe 100644 (file)
 }
   [(set_attr "length" "8")])
 
-;; The use of gp is hidden when not using explicit relocations.
 ;; This blockage instruction prevents the gp load from being
 ;; scheduled after an implicit use of gp.  It also prevents
 ;; the load from being deleted as dead.
 (define_insn "loadgp_blockage"
-  [(unspec_volatile [(reg:DI 28)] UNSPEC_BLOCKAGE)]
+  [(unspec_volatile [(reg:SI 28)] UNSPEC_BLOCKAGE)]
   ""
   ""
   [(set_attr "type"    "unknown")