r187617 - Use function attributes to indicate if we don't want to realign the stack.
Bill Wendling
isanbard at gmail.com
Fri Aug 2 13:57:21 PDT 2013
On Aug 2, 2013, at 12:57 PM, Nick Lewycky <nlewycky at google.com> wrote:
> On 1 August 2013 14:41, Bill Wendling <isanbard at gmail.com> wrote:
> Author: void
> Date: Thu Aug 1 16:41:02 2013
> New Revision: 187617
>
> URL: http://llvm.org/viewvc/llvm-project?rev=187617&view=rev
> Log:
> Use function attributes to indicate if we don't want to realign the stack.
>
> Modified:
> cfe/trunk/lib/CodeGen/BackendUtil.cpp
> cfe/trunk/lib/CodeGen/CGCall.cpp
>
> Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=187617&r1=187616&r2=187617&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
> +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Thu Aug 1 16:41:02 2013
> @@ -451,7 +451,6 @@ TargetMachine *EmitAssemblyHelper::Creat
> Options.UnsafeFPMath = CodeGenOpts.UnsafeFPMath;
> Options.UseSoftFloat = CodeGenOpts.SoftFloat;
> Options.StackAlignmentOverride = CodeGenOpts.StackAlignment;
> - Options.RealignStack = CodeGenOpts.StackRealignment;
> Options.DisableTailCalls = CodeGenOpts.DisableTailCalls;
> Options.TrapFuncName = CodeGenOpts.TrapFuncName;
> Options.PositionIndependentExecutable = LangOpts.PIELevel != 0;
>
> Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=187617&r1=187616&r2=187617&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGCall.cpp Thu Aug 1 16:41:02 2013
> @@ -1084,6 +1084,9 @@ void CodeGenModule::ConstructAttributeLi
>
> FuncAttrs.addAttribute("no-frame-pointer-elim-non-leaf",
> llvm::toStringRef(NoFramePointerElimNonLeaf));
> +
> + if (!CodeGenOpts.StackRealignment)
> + FuncAttrs.addAttribute("no-realign-stack");
> }
>
> This is not what mstackrealign does. There are three stack realignment modes, on off and forced. -mstackrealign forces a stack alignment to occur on entry to every function. no-realign-stack (off) forbids realigning stack even if you put a stack object on the stack which requires a higher alignment than the stack provides.
>
The flag that I replaced was a boolean flag (see r187618). It was turned on by default and only turned off when the CodeGenOpts.StackRealignment value was turned `false.' From what I can tell, it didn't have a third state. However, I may have uncovered a bug of some sort. Send me a test case and I can adjust this for you. :)
-bw
More information about the cfe-commits
mailing list