i386 call insns fix

Jan Hubicka jh@suse.cz
Fri Apr 6 08:40:00 GMT 2001


Hi,
I've got confussed by reading old documentation to believe that second
operand of call_insn may be used in target dependent form.
Now it is used by stack unwinding code so my previous patch to call
insns needs fixing.

I apologize for that - at least on my system it makes no difference in tests,
but makes differences in unwind frames, so I guess it is needed.

Honza

Fri Apr  6 17:37:43 CEST 2001  Jan Hubicka  <jh@suse.cz>
	* i386.c (call, call_value): Make sure that resulting call_insn
	does have proper second operand.
Index: i386.md
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/i386.md,v
retrieving revision 1.257
diff -c -3 -p -r1.257 i386.md
*** i386.md	2001/04/05 17:04:29	1.257
--- i386.md	2001/04/06 15:23:57
***************
*** 12882,12892 ****
  
  (define_expand "call"
    [(call (match_operand:QI 0 "" "")
! 	 (match_operand 2 "" ""))]
    ;; Operand 1 not used on the i386.
    ""
    "
  {
    /* Static functions and indirect calls don't need
       current_function_uses_pic_offset_table.  */
    if (flag_pic
--- 12882,12894 ----
  
  (define_expand "call"
    [(call (match_operand:QI 0 "" "")
! 	 (match_operand 1 "" ""))
!    (use (match_operand 2 "" ""))]
    ;; Operand 1 not used on the i386.
    ""
    "
  {
+   rtx insn;
    /* Static functions and indirect calls don't need
       current_function_uses_pic_offset_table.  */
    if (flag_pic
***************
*** 12898,12910 ****
      XEXP (operands[0], 0) = copy_to_mode_reg (Pmode, XEXP (operands[0], 0));
    if (TARGET_64BIT && INTVAL (operands[2]) >= 0)
      {
-       rtx insn;
        rtx reg = gen_rtx_REG (QImode, 0);
        emit_move_insn (reg, operands[2]);
!       insn = emit_call_insn (gen_call_exp (operands[0], operands[2]));
        use_reg (&CALL_INSN_FUNCTION_USAGE (insn), reg);
        DONE;
      }
  }")
  
  (define_expand "call_exp"
--- 12900,12913 ----
      XEXP (operands[0], 0) = copy_to_mode_reg (Pmode, XEXP (operands[0], 0));
    if (TARGET_64BIT && INTVAL (operands[2]) >= 0)
      {
        rtx reg = gen_rtx_REG (QImode, 0);
        emit_move_insn (reg, operands[2]);
!       insn = emit_call_insn (gen_call_exp (operands[0], operands[1]));
        use_reg (&CALL_INSN_FUNCTION_USAGE (insn), reg);
        DONE;
      }
+    insn = emit_call_insn (gen_call_exp (operands[0], operands[1]));
+    DONE;
  }")
  
  (define_expand "call_exp"
***************
*** 12998,13008 ****
  (define_expand "call_value"
    [(set (match_operand 0 "" "")
  	(call (match_operand:QI 1 "" "")
! 	      (match_operand:SI 3 "" "")))]
    ;; Operand 2 not used on the i386.
    ""
    "
  {
    /* Static functions and indirect calls don't need
       current_function_uses_pic_offset_table.  */
    if (flag_pic
--- 13001,13013 ----
  (define_expand "call_value"
    [(set (match_operand 0 "" "")
  	(call (match_operand:QI 1 "" "")
! 	      (match_operand:SI 2 "" "")))
!    (use (match_operand:SI 3 "" ""))]
    ;; Operand 2 not used on the i386.
    ""
    "
  {
+   rtx insn;
    /* Static functions and indirect calls don't need
       current_function_uses_pic_offset_table.  */
    if (flag_pic
***************
*** 13013,13026 ****
      XEXP (operands[1], 0) = copy_to_mode_reg (Pmode, XEXP (operands[1], 0));
    if (TARGET_64BIT && INTVAL (operands[3]) >= 0)
      {
-       rtx insn;
        rtx reg = gen_rtx_REG (QImode, 0);
        emit_move_insn (reg, operands[3]);
        insn = emit_call_insn (gen_call_value_exp (operands[0], operands[1],
! 						 operands[3]));
        use_reg (&CALL_INSN_FUNCTION_USAGE (insn), reg);
        DONE;
      }
  }")
  
  (define_expand "call_value_exp"
--- 13018,13033 ----
      XEXP (operands[1], 0) = copy_to_mode_reg (Pmode, XEXP (operands[1], 0));
    if (TARGET_64BIT && INTVAL (operands[3]) >= 0)
      {
        rtx reg = gen_rtx_REG (QImode, 0);
        emit_move_insn (reg, operands[3]);
        insn = emit_call_insn (gen_call_value_exp (operands[0], operands[1],
! 						 operands[2]));
        use_reg (&CALL_INSN_FUNCTION_USAGE (insn), reg);
        DONE;
      }
+   insn = emit_call_insn (gen_call_value_exp (operands[0], operands[1],
+ 					     operands[2]));
+   DONE;
  }")
  
  (define_expand "call_value_exp"



More information about the Gcc-patches mailing list