This patch defines a subtarget feature to force stack realignment and removes cl::opt option force-stack-align. This change is needed to enable forcing stack realignment when doing LTO. The subtarget features each target defines should be removed in the future once we have a way to define target-independent "generic" subtarget features.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
I think we can make changes to X86TTIImpl::areInlineCompatible if we want to be stricter and reject inlining when the caller and callee disagree on "force-align-stack". The current code would allow inlining if the caller had feature "force-align-stack" and the callee did not.
I don't think this is the right design for this feature: Forcing essentially all targets to add the same subtarget feature and associated logic is not good.
Instead, please add this to include/llvm/Target/TargetOptions.h, and add default handling in lib/Target/TargetMachine.cpp (command-line options, function attributes, etc.).
Hi Hal,
We specifically didn't do that for soft-float. I don't know if we want to look at this as "a step too far", but that's where we've been. I'm fine with revisiting that decision - I didn't have a strong opinion either way.
-eric
Use function attribute "force-align-stack" instead of defining a subtarget feature for each target and move cl::opt option ForceAlignStack to CommandFlags.h so that tools like llc can write the function attribute to the IR. It really should be an enum attribute because it's target independent, but I used a string attribute here to make it consistent with "no-realign-stack".
The updated patch makes the following changes:
- Use function attribute "stackrealign" to decide whether stack realignment should happen.
- Rename "force-align-stack" to "stackrealign" to be consistent with the function attribute.
I also think function attribute "no-realign-stack" should be a cl::opt option since it is used for debugging purposes. I plan to make the changes in a follow-up patch.