public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Unused case statements in expand_expr
@ 1998-06-23 14:56 Nick Burrett
  1998-06-23 22:55 ` Jeffrey A Law
  1998-06-23 22:55 ` Richard Stallman
  0 siblings, 2 replies; 5+ messages in thread
From: Nick Burrett @ 1998-06-23 14:56 UTC (permalink / raw)
  To: gcc2, egcs

In `expand_expr' we have:

    case FIX_ROUND_EXPR:
    case FIX_FLOOR_EXPR:
    case FIX_CEIL_EXPR:
      abort ();			/* Not used for C.  */


Since expr.c is `supposed' to be language-independent then can I remove
these case statements ? The end result is that `abort' will be called anyway.
It also means that languages that wish to implement any of those codes
can provide them in a language specific hook through the default case
`lang_expand_expr'.


Nick.

<date>  Nick Burrett  <nick.burrett@btinternet.com>

	* expr.c (expand_expr, case FIX_ROUND_EXPR): Remove.
	(expand_expr, case FIX_FLOOR_EXPR, FIX_CEIL_EXPR): Remove.


*** expr.c.orig	Tue Jun 23 16:31:39 1998
--- expr.c	Tue Jun 23 16:35:15 1998
*************** expand_expr (exp, target, tmode, modifie
*** 6632,6648 ****
        if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1), 1))
  	subtarget = 0;
        op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
        op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0);
        return expand_divmod (1, code, mode, op0, op1, target, unsignedp);
  
-     case FIX_ROUND_EXPR:
-     case FIX_FLOOR_EXPR:
-     case FIX_CEIL_EXPR:
-       abort ();			/* Not used for C.  */
- 
      case FIX_TRUNC_EXPR:
        op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, VOIDmode, 0);
        if (target == 0)
  	target = gen_reg_rtx (mode);
        expand_fix (target, op0, unsignedp);
        return target;
--- 6632,6643 ----

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Unused case statements in expand_expr
  1998-06-23 14:56 Unused case statements in expand_expr Nick Burrett
@ 1998-06-23 22:55 ` Jeffrey A Law
  1998-06-24 10:08   ` Nick Burrett
  1998-06-23 22:55 ` Richard Stallman
  1 sibling, 1 reply; 5+ messages in thread
From: Jeffrey A Law @ 1998-06-23 22:55 UTC (permalink / raw)
  To: Nick Burrett; +Cc: gcc2, egcs

  In message < 199806231544.QAA07673@nick.btinternet.com >you write:
  > 
  > In `expand_expr' we have:
  > 
  >     case FIX_ROUND_EXPR:
  >     case FIX_FLOOR_EXPR:
  >     case FIX_CEIL_EXPR:
  >       abort ();			/* Not used for C.  */
  > 
  > 
  > Since expr.c is `supposed' to be language-independent then can I remove
  > these case statements ? The end result is that `abort' will be called anyway.
  > It also means that languages that wish to implement any of those codes
  > can provide them in a language specific hook through the default case
  > `lang_expand_expr'.
But if they're useful for more than one language, then you have to
duplicate code.

Seems to me that if you've had to implement support for these nodes
that we can/should just drop your implementation into expand_expr.

jeff

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Unused case statements in expand_expr
  1998-06-23 14:56 Unused case statements in expand_expr Nick Burrett
  1998-06-23 22:55 ` Jeffrey A Law
@ 1998-06-23 22:55 ` Richard Stallman
  1 sibling, 0 replies; 5+ messages in thread
From: Richard Stallman @ 1998-06-23 22:55 UTC (permalink / raw)
  To: nick.burrett; +Cc: gcc2, egcs

    It also means that languages that wish to implement any of those codes
    can provide them in a language specific hook through the default case
    `lang_expand_expr'.

That would not be the right way to implement these operators.  If and
when these operators are actually implemented, the code should be put
in a language-independent file, so that these operators are available
for any and all languages.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Unused case statements in expand_expr
  1998-06-23 22:55 ` Jeffrey A Law
@ 1998-06-24 10:08   ` Nick Burrett
  1998-06-24 21:23     ` Jeffrey A Law
  0 siblings, 1 reply; 5+ messages in thread
From: Nick Burrett @ 1998-06-24 10:08 UTC (permalink / raw)
  To: law; +Cc: gcc2, egcs

>    In message < 199806231544.QAA07673@nick.btinternet.com >you write:
>    > 
>    > In `expand_expr' we have:
>    > 
>    >     case FIX_ROUND_EXPR:
>    >     case FIX_FLOOR_EXPR:
>    >     case FIX_CEIL_EXPR:
>    >       abort ();			/* Not used for C.  */
>    > 
>    > 
>    > Since expr.c is `supposed' to be language-independent then can I remove
>    > these case statements ? The end result is that `abort' will be called anyway.
>    > It also means that languages that wish to implement any of those codes
>    > can provide them in a language specific hook through the default case
>    > `lang_expand_expr'.
>
>  But if they're useful for more than one language, then you have to
>  duplicate code.
>
>  Seems to me that if you've had to implement support for these nodes
>  that we can/should just drop your implementation into expand_expr.

OK. I'm convinced now. :-)

I am going to have to take the plunge and implement FIX_ROUND_EXPR,
FIX_FLOOR_EXPR and FIX_CEIL_EXPR. A quick look shows a fair amount of work
to be done, such as adding rounding-mode support to config/fp-bit.c and
hacking optabs.c to support the IEEE rounding modes, so don't expect anything
too soon.

Nick.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Unused case statements in expand_expr
  1998-06-24 10:08   ` Nick Burrett
@ 1998-06-24 21:23     ` Jeffrey A Law
  0 siblings, 0 replies; 5+ messages in thread
From: Jeffrey A Law @ 1998-06-24 21:23 UTC (permalink / raw)
  To: Nick Burrett; +Cc: gcc2, egcs

  In message < 199806241054.LAA09916@nick.btinternet.com >you write:
  > I am going to have to take the plunge and implement FIX_ROUND_EXPR,
  > FIX_FLOOR_EXPR and FIX_CEIL_EXPR. A quick look shows a fair amount of work
  > to be done, such as adding rounding-mode support to config/fp-bit.c and
  > hacking optabs.c to support the IEEE rounding modes, so don't expect anything
  > too soon.
fp-bit.c?  That's an emulation library for machines without floating
point support.

While we may need to fix it at some point (and possibly real.c) it
seems like you could do most of the expr.c work without fixing fp-bit.c
and real.c initially.

jeff

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1998-06-24 21:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-06-23 14:56 Unused case statements in expand_expr Nick Burrett
1998-06-23 22:55 ` Jeffrey A Law
1998-06-24 10:08   ` Nick Burrett
1998-06-24 21:23     ` Jeffrey A Law
1998-06-23 22:55 ` Richard Stallman

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).