Based on comments from Hal (http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20150810/292978.html), I've changed the interface to add a callback mechanism to the TargetFrameLowering class to query whether the specific target supports shrink wrapping. By default, shrink wrapping is disabled by default. Each target can override the default behaviour using the TargetFrameLowering::targetSupportsShrinkWrapping() method. Shrink wrapping can still be explicitly enabled or disabled from the command line, using the existing -enable-shrink-wrap=<true|false> option.
Pass the MachineFunction to the targetSupportsShrinkWrapping method, to allow function-specific decisions to be made about whether to shrink-wrap it. PPC needs to make this decision based on the ABI and 32/64 bit.
Small nitpicks inlined but LGTM otherwise.
Do not repeat the method name in the comment.
(Personally, I would not repeat target in the method name, but I see that are precedence :).)
Period at the end of the comment.
Could be a static method.
The formatting seems weird here.
Maybe put this check with the previous condition, i.e., if MF.empty || !isShrinkWrapEnabled(MF).