Re: [PATCH]: Add entity argument to MODE_AFTER macro

2012-07-19 Thread Uros Bizjak
On Wed, Jul 18, 2012 at 8:31 PM, Uros Bizjak ubiz...@gmail.com wrote:

 As with all other mode switching macros, we need to pass entity index
 also to MODE_AFTER macro. In a multi-entity mode switching case, we
 usually don't have same modes for all entities, and we should be able
 to return the mode that applies to a specific entity. It looks that
 epiphany port already tripped on this issue.

 2012-07-18  Uros Bizjak  ubiz...@gmail.com

 * doc/tm.texi.in (MODE_AFTER): Add entity as the first macro argument.
 * doc/tm.texi: Regenerate.
 * mode-switching.c (optimize_mode_switching): Update MODE_AFTER call.
 * config/sh/sh.h (MODE_AFTER): Update.
 * config/epiphany/epiphany.h (MODE_AFTER): Update.

I have committed the patch to mainline SVN.

Uros.


[PATCH]: Add entity argument to MODE_AFTER macro

2012-07-18 Thread Uros Bizjak
Hello!

As with all other mode switching macros, we need to pass entity index
also to MODE_AFTER macro. In a multi-entity mode switching case, we
usually don't have same modes for all entities, and we should be able
to return the mode that applies to a specific entity. It looks that
epiphany port already tripped on this issue.

2012-07-18  Uros Bizjak  ubiz...@gmail.com

* doc/tm.texi.in (MODE_AFTER): Add entity as the first macro argument.
* doc/tm.texi: Regenerate.
* mode-switching.c (optimize_mode_switching): Update MODE_AFTER call.
* config/sh/sh.h (MODE_AFTER): Update.
* config/epiphany/epiphany.h (MODE_AFTER): Update.

Patch was bootstrapped on x86_64-pc-linux-gnu. Also, a functional C
crosscompiler was built for sh-elf and epiphany-elf targets.

Bordering on obvious, OK for mainline?

Uros.
Index: mode-switching.c
===
--- mode-switching.c(revision 189491)
+++ mode-switching.c(working copy)
@@ -534,7 +534,7 @@ optimize_mode_switching (void)
  RESET_BIT (transp[bb-index], j);
}
 #ifdef MODE_AFTER
- last_mode = MODE_AFTER (last_mode, insn);
+ last_mode = MODE_AFTER (e, last_mode, insn);
 #endif
  /* Update LIVE_NOW.  */
  for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
Index: doc/tm.texi
===
--- doc/tm.texi (revision 189491)
+++ doc/tm.texi (working copy)
@@ -9708,8 +9708,9 @@ return an integer value not larger than the corres
 be switched into prior to the execution of @var{insn}.
 @end defmac
 
-@defmac MODE_AFTER (@var{mode}, @var{insn})
-If this macro is defined, it is evaluated for every @var{insn} during
+@defmac MODE_AFTER (@var{entity}, @var{mode}, @var{insn})
+@var{entity} is an integer specifying a mode-switched entity.  If
+this macro is defined, it is evaluated for every @var{insn} during
 mode switching.  It determines the mode that an insn results in (if
 different from the incoming mode).
 @end defmac
Index: doc/tm.texi.in
===
--- doc/tm.texi.in  (revision 189491)
+++ doc/tm.texi.in  (working copy)
@@ -9587,8 +9587,9 @@ return an integer value not larger than the corres
 be switched into prior to the execution of @var{insn}.
 @end defmac
 
-@defmac MODE_AFTER (@var{mode}, @var{insn})
-If this macro is defined, it is evaluated for every @var{insn} during
+@defmac MODE_AFTER (@var{entity}, @var{mode}, @var{insn})
+@var{entity} is an integer specifying a mode-switched entity.  If
+this macro is defined, it is evaluated for every @var{insn} during
 mode switching.  It determines the mode that an insn results in (if
 different from the incoming mode).
 @end defmac
Index: config/sh/sh.h
===
--- config/sh/sh.h  (revision 189491)
+++ config/sh/sh.h  (working copy)
@@ -2351,7 +2351,7 @@ extern int current_function_interrupt;
? get_attr_fp_mode (INSN)   \
: FP_MODE_NONE)
 
-#define MODE_AFTER(MODE, INSN)  \
+#define MODE_AFTER(ENTITY, MODE, INSN) \
  (TARGET_HITACHI   \
recog_memoized (INSN) = 0\
get_attr_fp_set (INSN) != FP_SET_NONE  \
Index: config/epiphany/epiphany.h
===
--- config/epiphany/epiphany.h  (revision 189491)
+++ config/epiphany/epiphany.h  (working copy)
@@ -888,8 +888,8 @@ enum epiphany_function_type
 
 #define MODE_ENTRY(ENTITY) (epiphany_mode_entry_exit ((ENTITY), false))
 #define MODE_EXIT(ENTITY) (epiphany_mode_entry_exit ((ENTITY), true))
-#define MODE_AFTER(LAST_MODE, INSN) \
-  (epiphany_mode_after (e, (LAST_MODE), (INSN)))
+#define MODE_AFTER(ENTITY, LAST_MODE, INSN) \
+  (epiphany_mode_after ((ENTITY), (LAST_MODE), (INSN)))
 
 #define TARGET_INSERT_MODE_SWITCH_USE epiphany_insert_mode_switch_use