[x86] Implement static static checking
Uros Bizjak
ubizjak@gmail.com
Mon Jul 5 19:36:00 GMT 2010
Hello!
> This implements static stack checking in the x86 back-end, i.e. checking of
> the static part of the stack frame in the prologue. This is modelled on the
> Alpha back-end, but of course only activated by means of -fstack-check.
>
> Tested on Linux, Solaris and Windows 32-bit as well as Linux 64-bit. OK for
> the mainline?
Can you please also create testcase(s) that exercise new option?
> +(define_insn "adjust_stack_and_probe<P:mode>"
> + [(set (match_operand:P 0 "register_operand" "=r")
> + (unspec_volatile:P [(match_operand:P 1 "register_operand" "0")]
> + UNSPECV_PROBE_STACK_RANGE))
> + (set (reg:P SP_REG)
> + (minus:P (reg:P SP_REG) (match_operand:P 2 "const_int_operand" "n")))
> + (clobber (reg:CC FLAGS_REG))
> + (clobber (mem:BLK (scratch)))]
> + ""
> + "* return output_adjust_stack_and_probe (operands[0]);"
> + [(set_attr "type" "multi")])
> +
> +(define_insn "probe_stack_range<P:mode>"
> + [(set (match_operand:P 0 "register_operand" "=r")
> + (unspec_volatile:P [(match_operand:P 1 "register_operand" "0")
> + (match_operand:P 2 "const_int_operand" "n")]
> + UNSPECV_PROBE_STACK_RANGE))
> + (clobber (reg:CC FLAGS_REG))]
> + ""
> + "* return output_probe_stack_range (operands[0], operands[2]);"
> + [(set_attr "type" "multi")])
> +
No need for explicit <P:...> in the insn name, since only one mode
iterator is used (perhaps you should also add an underscore before the
mode?)
> + if (TARGET_64BIT)
> + emit_insn (gen_adjust_stack_and_probedi (sr.reg, sr.reg, size_rtx));
> + else
> + emit_insn (gen_adjust_stack_and_probesi (sr.reg, sr.reg, size_rtx));
> +
Please implement this (and similar probe_stack_range{si,di} calls) by
initializing static function pointer in the way ix86_gen_leave and Co.
are implemented.
Thanks,
Uros.
More information about the Gcc-patches
mailing list