* [PATCH, MIPS]: Remove ugly hack from "call_internal" splitter
@ 2010-11-02 8:22 Uros Bizjak
2010-11-03 21:27 ` Richard Sandiford
0 siblings, 1 reply; 5+ messages in thread
From: Uros Bizjak @ 2010-11-02 8:22 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 258 bytes --]
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.
[-- Attachment #2: m.diff.txt --]
[-- Type: text/plain, Size: 1034 bytes --]
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")])
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH, MIPS]: Remove ugly hack from "call_internal" splitter
2010-11-02 8:22 [PATCH, MIPS]: Remove ugly hack from "call_internal" splitter Uros Bizjak
@ 2010-11-03 21:27 ` Richard Sandiford
2010-11-03 21:40 ` Richard Sandiford
2010-11-03 21:40 ` Uros Bizjak
0 siblings, 2 replies; 5+ messages in thread
From: Richard Sandiford @ 2010-11-03 21:27 UTC (permalink / raw)
To: Uros Bizjak; +Cc: gcc-patches
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH, MIPS]: Remove ugly hack from "call_internal" splitter
2010-11-03 21:27 ` Richard Sandiford
@ 2010-11-03 21:40 ` Richard Sandiford
2010-11-03 21:40 ` Uros Bizjak
1 sibling, 0 replies; 5+ messages in thread
From: Richard Sandiford @ 2010-11-03 21:40 UTC (permalink / raw)
To: Uros Bizjak; +Cc: gcc-patches
Richard Sandiford <rdsandiford@googlemail.com> writes:
> Please do the call splitters too.
Um, please do the _other_ call splitters too, sorry.
Richard
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH, MIPS]: Remove ugly hack from "call_internal" splitter
2010-11-03 21:27 ` Richard Sandiford
2010-11-03 21:40 ` Richard Sandiford
@ 2010-11-03 21:40 ` Uros Bizjak
2010-11-13 18:03 ` Richard Sandiford
1 sibling, 1 reply; 5+ messages in thread
From: Uros Bizjak @ 2010-11-03 21:40 UTC (permalink / raw)
To: Uros Bizjak, gcc-patches, rdsandiford
[-- Attachment #1: Type: text/plain, Size: 1325 bytes --]
On Wed, Nov 3, 2010 at 10:23 PM, Richard Sandiford
<rdsandiford@googlemail.com> wrote:
> 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.
In addition to other call splitters, I noticed that mips_split_call
copies CALL_INSN_FUNCTION_USAGE to splitted call_insn pattern. This is
not necessary, since try_split will do that automatically (se
emit-rtl.c, around line 3459).
2010-11-03 Uros Bizjak <ubizjak@gmail.com>
* config/mips/mips.md (call_internal): Pass curr_insn to
mips_split_call.
(call_internal_direct): Ditto.
(call_value_internal): Ditto.
(call_value_internal_direct): Ditto.
(call_value_multiple_internal): Ditto.
* config/mips/mips.c (mips_split_call): Do not copy
CALL_INSN_FUNCTION_USAGE here.
Attached patch was tested by building a cross to mips-elf.
Unfortunatelly, I have no access to real mips target, so I would like
to ask somebody if can do a regression test of attached patch.
Uros.
[-- Attachment #2: m.diff.txt --]
[-- Type: text/plain, Size: 3373 bytes --]
Index: gcc/config/mips/mips.md
===================================================================
--- gcc/config/mips/mips.md (revision 166247)
+++ 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")])
@@ -6069,10 +6067,10 @@
(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],
+ mips_split_call (curr_insn,
gen_call_direct_split (operands[0], operands[1]));
DONE;
}
@@ -6108,10 +6106,10 @@
(clobber (reg:SI RETURN_ADDR_REGNUM))]
""
{ return TARGET_SPLIT_CALLS ? "#" : MIPS_CALL ("jal", operands, 1, 2); }
- "reload_completed && TARGET_SPLIT_CALLS && (operands[3] = insn)"
+ "reload_completed && TARGET_SPLIT_CALLS"
[(const_int 0)]
{
- mips_split_call (operands[3],
+ mips_split_call (curr_insn,
gen_call_value_split (operands[0], operands[1],
operands[2]));
DONE;
@@ -6137,10 +6135,10 @@
(clobber (reg:SI RETURN_ADDR_REGNUM))]
""
{ return TARGET_SPLIT_CALLS ? "#" : MIPS_CALL ("jal", operands, 1, -1); }
- "reload_completed && TARGET_SPLIT_CALLS && (operands[3] = insn)"
+ "reload_completed && TARGET_SPLIT_CALLS"
[(const_int 0)]
{
- mips_split_call (operands[3],
+ mips_split_call (curr_insn,
gen_call_value_direct_split (operands[0], operands[1],
operands[2]));
DONE;
@@ -6169,10 +6167,10 @@
(clobber (reg:SI RETURN_ADDR_REGNUM))]
""
{ return TARGET_SPLIT_CALLS ? "#" : MIPS_CALL ("jal", operands, 1, 2); }
- "reload_completed && TARGET_SPLIT_CALLS && (operands[4] = insn)"
+ "reload_completed && TARGET_SPLIT_CALLS"
[(const_int 0)]
{
- mips_split_call (operands[4],
+ mips_split_call (curr_insn,
gen_call_value_multiple_split (operands[0], operands[1],
operands[2], operands[3]));
DONE;
Index: gcc/config/mips/mips.c
===================================================================
--- gcc/config/mips/mips.c (revision 166247)
+++ gcc/config/mips/mips.c (working copy)
@@ -6519,8 +6519,6 @@ mips_split_call (rtx insn, rtx call_patt
rtx new_insn;
new_insn = emit_call_insn (call_pattern);
- CALL_INSN_FUNCTION_USAGE (new_insn)
- = copy_rtx (CALL_INSN_FUNCTION_USAGE (insn));
if (!find_reg_note (insn, REG_NORETURN, 0))
/* Pick a temporary register that is suitable for both MIPS16 and
non-MIPS16 code. $4 and $5 are used for returning complex double
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH, MIPS]: Remove ugly hack from "call_internal" splitter
2010-11-03 21:40 ` Uros Bizjak
@ 2010-11-13 18:03 ` Richard Sandiford
0 siblings, 0 replies; 5+ messages in thread
From: Richard Sandiford @ 2010-11-13 18:03 UTC (permalink / raw)
To: Uros Bizjak; +Cc: gcc-patches
Uros Bizjak <ubizjak@gmail.com> writes:
> 2010-11-03 Uros Bizjak <ubizjak@gmail.com>
>
> * config/mips/mips.md (call_internal): Pass curr_insn to
> mips_split_call.
> (call_internal_direct): Ditto.
> (call_value_internal): Ditto.
> (call_value_internal_direct): Ditto.
> (call_value_multiple_internal): Ditto.
> * config/mips/mips.c (mips_split_call): Do not copy
> CALL_INSN_FUNCTION_USAGE here.
>
> Attached patch was tested by building a cross to mips-elf.
> Unfortunatelly, I have no access to real mips target, so I would like
> to ask somebody if can do a regression test of attached patch.
Thanks, tested on mips64-linux-gnu. I had to make a trivial change
(removing the new_insn variable to avoid a warning), so I applied
the patch as tested.
Richard
2010-11-13 Uros Bizjak <ubizjak@gmail.com>
* config/mips/mips.md (call_internal): Pass curr_insn to
mips_split_call.
(call_internal_direct): Ditto.
(call_value_internal): Ditto.
(call_value_internal_direct): Ditto.
(call_value_multiple_internal): Ditto.
* config/mips/mips.c (mips_split_call): Do not copy
CALL_INSN_FUNCTION_USAGE here.
Index: gcc/config/mips/mips.md
===================================================================
--- gcc/config/mips/mips.md 2010-11-13 17:30:42.000000000 +0000
+++ gcc/config/mips/mips.md 2010-11-13 17:32:02.000000000 +0000
@@ -6051,18 +6051,16 @@ (define_expand "call"
;; 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")])
@@ -6087,10 +6085,10 @@ (define_insn_and_split "call_internal_di
(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],
+ mips_split_call (curr_insn,
gen_call_direct_split (operands[0], operands[1]));
DONE;
}
@@ -6126,10 +6124,10 @@ (define_insn_and_split "call_value_inter
(clobber (reg:SI RETURN_ADDR_REGNUM))]
""
{ return TARGET_SPLIT_CALLS ? "#" : MIPS_CALL ("jal", operands, 1, 2); }
- "reload_completed && TARGET_SPLIT_CALLS && (operands[3] = insn)"
+ "reload_completed && TARGET_SPLIT_CALLS"
[(const_int 0)]
{
- mips_split_call (operands[3],
+ mips_split_call (curr_insn,
gen_call_value_split (operands[0], operands[1],
operands[2]));
DONE;
@@ -6155,10 +6153,10 @@ (define_insn_and_split "call_value_inter
(clobber (reg:SI RETURN_ADDR_REGNUM))]
""
{ return TARGET_SPLIT_CALLS ? "#" : MIPS_CALL ("jal", operands, 1, -1); }
- "reload_completed && TARGET_SPLIT_CALLS && (operands[3] = insn)"
+ "reload_completed && TARGET_SPLIT_CALLS"
[(const_int 0)]
{
- mips_split_call (operands[3],
+ mips_split_call (curr_insn,
gen_call_value_direct_split (operands[0], operands[1],
operands[2]));
DONE;
@@ -6187,10 +6185,10 @@ (define_insn_and_split "call_value_multi
(clobber (reg:SI RETURN_ADDR_REGNUM))]
""
{ return TARGET_SPLIT_CALLS ? "#" : MIPS_CALL ("jal", operands, 1, 2); }
- "reload_completed && TARGET_SPLIT_CALLS && (operands[4] = insn)"
+ "reload_completed && TARGET_SPLIT_CALLS"
[(const_int 0)]
{
- mips_split_call (operands[4],
+ mips_split_call (curr_insn,
gen_call_value_multiple_split (operands[0], operands[1],
operands[2], operands[3]));
DONE;
Index: gcc/config/mips/mips.c
===================================================================
--- gcc/config/mips/mips.c 2010-11-13 17:30:42.000000000 +0000
+++ gcc/config/mips/mips.c 2010-11-13 17:32:02.000000000 +0000
@@ -6520,11 +6520,7 @@ mips_expand_call (enum mips_call_type ty
void
mips_split_call (rtx insn, rtx call_pattern)
{
- rtx new_insn;
-
- new_insn = emit_call_insn (call_pattern);
- CALL_INSN_FUNCTION_USAGE (new_insn)
- = copy_rtx (CALL_INSN_FUNCTION_USAGE (insn));
+ emit_call_insn (call_pattern);
if (!find_reg_note (insn, REG_NORETURN, 0))
/* Pick a temporary register that is suitable for both MIPS16 and
non-MIPS16 code. $4 and $5 are used for returning complex double
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-11-13 17:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-02 8:22 [PATCH, MIPS]: Remove ugly hack from "call_internal" splitter Uros Bizjak
2010-11-03 21:27 ` Richard Sandiford
2010-11-03 21:40 ` Richard Sandiford
2010-11-03 21:40 ` Uros Bizjak
2010-11-13 18:03 ` Richard Sandiford
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).