This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [patches] Re: Add support for push??1 expanders


> For the sake of eliminating possible confusion (I used the wrong
> referent for "This method" at first reading), you might consider
> replacing "This method" with "The @code{mov} expander method".
> 
> You probably also want an "a" between the "with" and "@code{MEM}".
Done.
Thanks.

Fri Jul 20 13:34:02 CEST 2001  Jan Hubicka  <jh@suse.cz>
	* expr.c (emit_single_push_insn): Add call to push expander.
	* expr.h (optab_index): Add OTI_push
	(push_optab): New constant.
	* genopinit.c (optabs): Add push_optab.
	* optabs.c (init_optab): Init push optab.
	* md.texi (push??1): Document
Index: expr.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/expr.c,v
retrieving revision 1.338
diff -c -3 -p -r1.338 expr.c
*** expr.c	2001/07/11 20:35:51	1.338
--- expr.c	2001/07/17 19:05:30
*************** emit_single_push_insn (mode, x, type)
*** 3155,3161 ****
--- 3155,3175 ----
    rtx dest_addr;
    unsigned rounded_size = PUSH_ROUNDING (GET_MODE_SIZE (mode));
    rtx dest;
+   enum insn_code icode;
+   insn_operand_predicate_fn pred;
  
+   stack_pointer_delta += PUSH_ROUNDING (GET_MODE_SIZE (mode));
+   /* If there is push pattern, use it.  Otherwise try old way of throwing
+      MEM representing push operation to move expander.  */
+   icode = push_optab->handlers[(int) mode].insn_code;
+   if (icode != CODE_FOR_nothing)
+     {
+       if (((pred = insn_data[(int) icode].operand[0].predicate)
+ 	  && !((*pred) (x, mode))))
+ 	x = force_reg (mode, x);
+       emit_insn (GEN_FCN (icode) (x));
+       return;
+     }
    if (GET_MODE_SIZE (mode) == rounded_size)
      dest_addr = gen_rtx_fmt_e (STACK_PUSH_CODE, Pmode, stack_pointer_rtx);
    else
*************** emit_single_push_insn (mode, x, type)
*** 3171,3178 ****
      }
  
    dest = gen_rtx_MEM (mode, dest_addr);
- 
-   stack_pointer_delta += PUSH_ROUNDING (GET_MODE_SIZE (mode));
  
    if (type != 0)
      {
--- 3185,3190 ----
Index: expr.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/expr.h,v
retrieving revision 1.85
diff -c -3 -p -r1.85 expr.h
*** expr.h	2001/07/10 06:18:32	1.85
--- expr.h	2001/07/17 19:05:31
*************** enum optab_index
*** 378,383 ****
--- 378,386 ----
    OTI_cmov,
    OTI_cstore,
      
+   /* Push instruction.  */
+   OTI_push,
+ 
    OTI_MAX
  };
  
*************** extern optab optab_table[OTI_MAX];
*** 437,442 ****
--- 440,446 ----
  #define cbranch_optab (optab_table[OTI_cbranch])
  #define cmov_optab (optab_table[OTI_cmov])
  #define cstore_optab (optab_table[OTI_cstore])
+ #define push_optab (optab_table[OTI_push])
  
  /* Tables of patterns for extending one integer mode to another.  */
  extern enum insn_code extendtab[MAX_MACHINE_MODE][MAX_MACHINE_MODE][2];
Index: genopinit.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/genopinit.c,v
retrieving revision 1.43
diff -c -3 -p -r1.43 genopinit.c
*** genopinit.c	2001/03/22 18:48:29	1.43
--- genopinit.c	2001/07/17 19:05:34
*************** const char * const optabs[] =
*** 128,133 ****
--- 128,134 ----
    "cbranch_optab->handlers[$A].insn_code = CODE_FOR_$(cbranch$a4$)",
    "cmov_optab->handlers[$A].insn_code = CODE_FOR_$(cmov$a6$)",
    "cstore_optab->handlers[$A].insn_code = CODE_FOR_$(cstore$a4$)",
+   "push_optab->handlers[$A].insn_code = CODE_FOR_$(push$a1$)",
    "reload_in_optab[$A] = CODE_FOR_$(reload_in$a$)",
    "reload_out_optab[$A] = CODE_FOR_$(reload_out$a$)",
    "movstr_optab[$A] = CODE_FOR_$(movstr$a$)",
Index: optabs.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/optabs.c,v
retrieving revision 1.103
diff -c -3 -p -r1.103 optabs.c
*** optabs.c	2001/07/09 20:21:48	1.103
--- optabs.c	2001/07/17 19:05:37
*************** init_optabs ()
*** 4677,4682 ****
--- 4677,4683 ----
    cbranch_optab = init_optab (UNKNOWN);
    cmov_optab = init_optab (UNKNOWN);
    cstore_optab = init_optab (UNKNOWN);
+   push_optab = init_optab (UNKNOWN);
  
    for (i = 0; i < NUM_MACHINE_MODES; i++)
      {
Index: md.texi
===================================================================
RCS file: /cvs/gcc/egcs/gcc/doc/md.texi,v
retrieving revision 1.14
diff -c -3 -p -r1.14 md.texi
*** md.texi	2001/07/18 22:02:07	1.14
--- md.texi	2001/07/20 12:07:17
*************** into consecutive memory locations.  Oper
*** 2125,2130 ****
--- 2125,2138 ----
  consecutive memory locations, operand 1 is the first register, and
  operand 2 is a constant: the number of consecutive registers.
  
+ @cindex @code{push@var{m}} instruction pattern
+ @item @samp{push@var{m}}
+ Output an push instruction.  Operand 0 is value to push.  Used only when
+ @code{PUSH_ROUNDING} is defined.  For historical reason, this pattern may be
+ missing and in such case an @code{mov} expander is used instead, with a
+ @code{MEM} expression forming the push operation.  The @cpde{mov} expander
+ method is deprecated.
+ 
  @cindex @code{add@var{m}3} instruction pattern
  @item @samp{add@var{m}3}
  Add operand 2 and operand 1, storing the result in operand 0.  All operands


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]