Patchwork [MIPS] : Remove ugly hack from "call_internal" splitter

login
register
mail settings
Submitter Uros Bizjak
Date Nov. 2, 2010, 7:56 a.m.
Message ID <AANLkTimNJJ1zwGVwRcewgJRONWk00KgpA9H-amS6pNeQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/69865/
State New
Headers show

Comments

Uros Bizjak - Nov. 2, 2010, 7:56 a.m.
Hello!

We should simply use curr_insn instead of an ugly hack.

2010-11-02  Uros Bizjak  <ubizjak@gmail.com>

	* config/mips/mips.md (call_internal): Pass curr_insn to
	mips_split_call.

Compile tested on x86_64-pc-linux-gnu for mips-elf cross.

OK?

Uros.
Richard Sandiford - Nov. 3, 2010, 9:23 p.m.
Uros Bizjak <ubizjak@gmail.com> writes:
> Hello!
>
> We should simply use curr_insn instead of an ugly hack.
>
> 2010-11-02  Uros Bizjak  <ubizjak@gmail.com>
>
> 	* config/mips/mips.md (call_internal): Pass curr_insn to
> 	mips_split_call.
>
> Compile tested on x86_64-pc-linux-gnu for mips-elf cross.

Please do the call splitters too.  OK with that change if it
passes regression testing.

Thanks,
Richard
Richard Sandiford - Nov. 3, 2010, 9:37 p.m.
Richard Sandiford <rdsandiford@googlemail.com> writes:
> Please do the call splitters too.

Um, please do the _other_ call splitters too, sorry.

Richard

Patch

Index: gcc/config/mips/mips.md
===================================================================
--- gcc/config/mips/mips.md	(revision 166172)
+++ gcc/config/mips/mips.md	(working copy)
@@ -6033,18 +6033,16 @@ 
 ;;     But once we generate the separate insns, it becomes obvious that
 ;;     $gp is not live on entry to the call.
 ;;
-;; ??? The operands[2] = insn check is a hack to make the original insn
-;; available to the splitter.
 (define_insn_and_split "call_internal"
   [(call (mem:SI (match_operand 0 "call_insn_operand" "c,S"))
 	 (match_operand 1 "" ""))
    (clobber (reg:SI RETURN_ADDR_REGNUM))]
   ""
   { return TARGET_SPLIT_CALLS ? "#" : MIPS_CALL ("jal", operands, 0, 1); }
-  "reload_completed && TARGET_SPLIT_CALLS && (operands[2] = insn)"
+  "reload_completed && TARGET_SPLIT_CALLS"
   [(const_int 0)]
 {
-  mips_split_call (operands[2], gen_call_split (operands[0], operands[1]));
+  mips_split_call (curr_insn, gen_call_split (operands[0], operands[1]));
   DONE;
 }
   [(set_attr "jal" "indirect,direct")])