GCC Bugzilla – Attachment 5447 Details for
Bug 13585
Incorrect optimisation of call to sfunc
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch for 3.3 and 3.4
sfunc-diff (text/plain), 3.24 KB, created by
Jorn Wolfgang Rennecke
on 2004-01-09 18:23:13 UTC
(
hide
)
Description:
Proposed patch for 3.3 and 3.4
Filename:
MIME Type:
Creator:
Jorn Wolfgang Rennecke
Created:
2004-01-09 18:23:13 UTC
Size:
3.24 KB
patch
obsolete
>2004-01-09 J"orn Rennecke <joern.rennecke@superh.com> > > * sh-protos.h (check_use_sfunc_addr): Declare. > * sh.c (extract_sfunc_addr, check_use_sfunc_addr): New functions. > * sh.md (use_sfunc_addr): Use check_use_sfunc_addr in insn predicate. > >Index: config/sh/sh-protos.h >=================================================================== >RCS file: /cvs/gcc/gcc/gcc/config/sh/sh-protos.h,v >retrieving revision 1.34.2.1 >diff -p -u -r1.34.2.1 sh-protos.h >--- config/sh/sh-protos.h 31 Jan 2003 23:51:23 -0000 1.34.2.1 >+++ config/sh/sh-protos.h 9 Jan 2004 17:30:52 -0000 >@@ -131,6 +131,7 @@ extern bool sh_cannot_change_mode_class > extern void sh_mark_label PARAMS ((rtx, int)); > extern int sh_register_move_cost > PARAMS ((enum machine_mode mode, enum reg_class, enum reg_class)); >+extern int check_use_sfunc_addr (rtx, rtx); > > #ifdef HARD_CONST > extern void fpscr_set_from_mem PARAMS ((int, HARD_REG_SET)); >Index: config/sh/sh.c >=================================================================== >RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.c,v >retrieving revision 1.188.2.7 >diff -p -u -r1.188.2.7 sh.c >--- config/sh/sh.c 5 Dec 2003 15:56:33 -0000 1.188.2.7 >+++ config/sh/sh.c 9 Jan 2004 17:30:52 -0000 >@@ -7857,4 +7857,51 @@ sh_register_operand (op, mode) > return register_operand (op, mode); > } > >+/* INSN is an sfunc; return the rtx that describes the address used. */ >+static rtx >+extract_sfunc_addr (rtx insn) >+{ >+ rtx pattern, part = NULL_RTX; >+ int len, i; >+ >+ pattern = PATTERN (insn); >+ len = XVECLEN (pattern, 0); >+ for (i = 0; i < len; i++) >+ { >+ part = XVECEXP (pattern, 0, i); >+ if (GET_CODE (part) == USE && GET_MODE (XEXP (part, 0)) == Pmode >+ && GENERAL_REGISTER_P (true_regnum (XEXP (part, 0)))) >+ return XEXP (part, 0); >+ } >+ if (GET_CODE (XVECEXP (pattern, 0, 0)) == UNSPEC_VOLATILE) >+ return XVECEXP (XVECEXP (pattern, 0, 0), 0, 1); >+ abort (); >+} >+ >+/* Verify that the register in use_sfunc_addr still agrees with the address >+ used in the sfunc. This prevents fill_slots_from_thread from changing >+ use_sfunc_addr. >+ INSN is the use_sfunc_addr instruction, and REG is the register it >+ guards. */ >+int >+check_use_sfunc_addr (rtx insn, rtx reg) >+{ >+ /* Search for the sfunc. It should really come right after INSN. */ >+ while ((insn = NEXT_INSN (insn))) >+ { >+ if (GET_CODE (insn) == CODE_LABEL || GET_CODE (insn) == JUMP_INSN) >+ break; >+ if (! INSN_P (insn)) >+ continue; >+ >+ if (GET_CODE (PATTERN (insn)) == SEQUENCE) >+ insn = XVECEXP (PATTERN (insn), 0, 0); >+ if (GET_CODE (PATTERN (insn)) != PARALLEL >+ || get_attr_type (insn) != TYPE_SFUNC) >+ continue; >+ return rtx_equal_p (extract_sfunc_addr (insn), reg); >+ } >+ abort (); >+} >+ > #include "gt-sh.h" >Index: config/sh/sh.md >=================================================================== >RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.md,v >retrieving revision 1.133.2.1 >diff -p -u -r1.133.2.1 sh.md >--- config/sh/sh.md 15 Apr 2003 17:06:10 -0000 1.133.2.1 >+++ config/sh/sh.md 9 Jan 2004 17:30:52 -0000 >@@ -1220,7 +1220,7 @@ > (define_insn "use_sfunc_addr" > [(set (reg:SI PR_REG) > (unspec:SI [(match_operand:SI 0 "register_operand" "r")] UNSPEC_SFUNC))] >- "TARGET_SH1" >+ "TARGET_SH1 && check_use_sfunc_addr (insn, operands[0])" > "" > [(set_attr "length" "0")]) >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 13585
:
5420
| 5447