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]
Other format: [Raw text]

Re: [patch i386]: Change stack probing and allocation implementation


Hello!

> >> 2010-08-19  Kai Tietz
> >>
> >>        * config/i386/cygwin.asm (___chkstk_ms): New.
> >>        * config/i386/i386.c (override_options): Replace
> >>        gen_allocate_stack_worker_,, by gen_allocate_stack_worker_probe_,,.
> >>        (ix86_expand_prologue): Adjust probed stack allocation.
> >>        * config/i386/i386.md (define_insn "allocate_stack_worker_32): Removed.
> >>        (define_insn "allocate_stack_worker_64): Removed.
> >>        (define_insn "allocate_stack_worker_probe_32): New.
> >>        (define_insn "allocate_stack_worker_probe_64): New.
> >>        (allocate_stack): Adjust probed stack allocation.
>
> I altered the patch a bit.  Tidied up the .md changes with macros,
> tidied up the assembly file with multiple object files and dwarf2
> unwind info.  Adjusted the prologue code to use the value in eax.

> +(define_insn "pro_epilogue_adjust_stack_<mode>_2"
> +  [(set (match_operand:P 0 "register_operand" "=r")
> +	(plus:P (match_operand:DI 1 "register_operand" "0")
> +		 (match_operand:DI 2 "register_operand" "r")))
>     (clobber (reg:CC FLAGS_REG))
>     (clobber (mem:BLK (scratch)))]

Hm, this can't be right for Pmode == SImode. Alternatively, it is now
possible to merge pro_epilogue_..._1 and pro_epilogue_,,,_2 into:

(define_insn "pro_epilogue_adjust_stack_<mode>_add"
  [(set (match_operand:P 0 "register_operand" "=r,r")
	(plus:P (match_operand:P 1 "register_operand" "0,r")
	        (match_operand:P 2 "<nonmemory_operand>" "r<i>,l<i>")))
   (clobber (reg:CC FLAGS_REG))
   (clobber (mem:BLK (scratch)))]
  ""
{
  switch (get_attr_type (insn))
    {
    case TYPE_IMOV:
      return "mov{<imodesuffix>}\t{%1, %0|%0, %1}";

    case TYPE_ALU:
      gcc_assert (rtx_equal_p (operands[0], operands[1]));
      if (x86_maybe_negate_const_int (&operands[2], <MODE>mode))
	return "sub{<imodesuffix>}\t{%2, %0|%0, %2}";

      return "add{<imodesuffix>}\t{%2, %0|%0, %2}";

    default:
      operands[2] = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
      return "lea{<imodesuffix>}\t{%a2, %0|%0, %a2}";
    }
}
  [(set (attr "type")
	(cond [(and (eq_attr "alternative" "0")
		    (eq (symbol_ref "TARGET_OPT_AGU") (const_int 0)))
		 (const_string "alu")
	       (match_operand:<MODE> 2 "const0_operand" "")
		 (const_string "imov")
	      ]
	      (const_string "lea")))
   (set (attr "length_immediate")
	(cond [(eq_attr "type" "imov")
		 (const_string "0")
	       (and (eq_attr "type" "alu")
		    (match_operand 2 "const128_operand" ""))
		 (const_string "1")
	      ]
	      (const_string "*")))
   (set_attr "mode" "<MODE>")])

Attached [RFC] patch implements this merge, and some related cleanups
involving renames and indirect functions. Patch was tested on
x86_64-pc-linux-gnu without regressions.

Uros.

Attachment: p.diff.txt
Description: Text document


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