Add a new -mstack-probe and -mno-stack-probe option to enable the generation of stack probing functions on non-Windows platforms, if supported. This patch only enables this for Darwin.
Details
Diff Detail
- Repository
- rC Clang
Event Timeline
It looks pretty straightforward, but I'd ask (at least) Duncan or Akira, and Matthias to review this more carefully.
-Gerolf
lib/CodeGen/BackendUtil.cpp | ||
---|---|---|
442 | Is there a reason you can't use function attributes "probe-stack"="___chkstk_darwin" and "stack-probe-size"=4096 instead of setting a TargetOptions flag here? If you intend to use stack probing with LTO, I think you need function attributes. Also, it looks like that would simplify the changes made to X86 backend. | |
lib/Driver/ToolChains/Clang.cpp | ||
3955 | Just to confirm, is stack probing going to be enabled unconditionally on Darwin unless the user disables it with mno-stack-probe? |
lib/CodeGen/BackendUtil.cpp | ||
---|---|---|
442 | I don't think there's any reason not to. Is it worth specifying the probe size itself given that it'll be a known fixed value? It could be misleading to give a probe size which only has a single valid value for Darwin. | |
lib/Driver/ToolChains/Clang.cpp | ||
3955 | Yes that's the intention. However on D40863 there's discussion that it might be better to restrict to newer Darwin targets. |
lib/CodeGen/BackendUtil.cpp | ||
---|---|---|
442 | If 4096B is the only valid size for Darwin and the default size is 4096B in the backend, you can just add attribute "probe-stack"="___chkstk_darwin" to the function. The backend can check the existence of the attribute and decide whether to enable stack-probing. |
No, this approach was superseded. I will upstream a new implementation in the near future.
Is there a reason you can't use function attributes "probe-stack"="___chkstk_darwin" and "stack-probe-size"=4096 instead of setting a TargetOptions flag here? If you intend to use stack probing with LTO, I think you need function attributes. Also, it looks like that would simplify the changes made to X86 backend.