forked from OSchip/llvm-project
Add -mstack-alignment=X and fix -mstackrealign handling now that the
backend options are gone. llvm-svn: 145868
This commit is contained in:
parent
7b1866930e
commit
db66ed0e4c
|
@ -200,6 +200,8 @@ def mms_bitfields : Flag<"-mms-bitfields">,
|
|||
HelpText<"Set the default structure layout to be compatible with the Microsoft compiler standard.">;
|
||||
def mstackrealign : Flag<"-mstackrealign">,
|
||||
HelpText<"Force realign the stack at entry to every function.">;
|
||||
def mstack_alignment : Joined<"-mstack-alignment=">,
|
||||
HelpText<"Set the stack alignment">;
|
||||
def mlink_bitcode_file : Separate<"-mlink-bitcode-file">,
|
||||
HelpText<"Link the given bitcode file before performing optimizations.">;
|
||||
def O : Joined<"-O">, HelpText<"Optimization level">;
|
||||
|
|
|
@ -571,6 +571,7 @@ def mllvm : Separate<"-mllvm">;
|
|||
def mmacosx_version_min_EQ : Joined<"-mmacosx-version-min=">, Group<m_Group>;
|
||||
def mms_bitfields : Flag<"-mms-bitfields">, Group<m_Group>;
|
||||
def mstackrealign : Flag<"-mstackrealign">, Group<m_Group>;
|
||||
def mstack_alignment : Joined<"-mstack-alignment=">, Group<m_Group>;
|
||||
def mmmx : Flag<"-mmmx">, Group<m_x86_Features_Group>;
|
||||
def mno_3dnowa : Flag<"-mno-3dnowa">, Group<m_x86_Features_Group>;
|
||||
def mno_3dnow : Flag<"-mno-3dnow">, Group<m_x86_Features_Group>;
|
||||
|
|
|
@ -105,6 +105,11 @@ public:
|
|||
unsigned VerifyModule : 1; /// Control whether the module should be run
|
||||
/// through the LLVM Verifier.
|
||||
|
||||
unsigned RealignStack : 1; /// Controls whether stack frame should be
|
||||
/// readjusted to the desired alignment.
|
||||
unsigned StackAlignment; /// Overrides default stack alignment,
|
||||
/// if not 0.
|
||||
|
||||
/// The code model to use (-mcmodel).
|
||||
std::string CodeModel;
|
||||
|
||||
|
|
|
@ -289,6 +289,11 @@ bool EmitAssemblyHelper::AddEmitPasses(BackendAction Action,
|
|||
|
||||
llvm::TargetOptions Options;
|
||||
|
||||
if (CodeGenOpts.RealignStack)
|
||||
Options.RealignStack = true;
|
||||
if (CodeGenOpts.StackAlignment)
|
||||
Options.StackAlignmentOverride = CodeGenOpts.StackAlignment;
|
||||
|
||||
// Set frame pointer elimination mode.
|
||||
if (!CodeGenOpts.DisableFPElim) {
|
||||
Options.NoFramePointerElim = false;
|
||||
|
|
|
@ -1796,10 +1796,11 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
CmdArgs.push_back(Args.MakeArgString(Twine(StackProtectorLevel)));
|
||||
}
|
||||
|
||||
// Translate -mstackrealign
|
||||
if (Args.hasArg(options::OPT_mstackrealign)) {
|
||||
CmdArgs.push_back("-backend-option");
|
||||
CmdArgs.push_back("-force-align-stack");
|
||||
if (Args.hasArg(options::OPT_mstackrealign))
|
||||
CmdArgs.push_back("-mstackrealign");
|
||||
if (Args.hasArg(options::OPT_mstack_alignment)) {
|
||||
StringRef alignment = Args.getLastArgValue(options::OPT_mstack_alignment);
|
||||
CmdArgs.push_back(Args.MakeArgString("-mstack-alignment=" + alignment));
|
||||
}
|
||||
|
||||
// Forward -f options with positive and negative forms; we translate
|
||||
|
|
|
@ -1114,6 +1114,11 @@ static void ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
|
|||
Opts.CoverageFile = Args.getLastArgValue(OPT_coverage_file);
|
||||
Opts.DebugCompilationDir = Args.getLastArgValue(OPT_fdebug_compilation_dir);
|
||||
Opts.LinkBitcodeFile = Args.getLastArgValue(OPT_mlink_bitcode_file);
|
||||
Opts.RealignStack = Args.hasArg(OPT_mstackrealign);
|
||||
if (Arg *A = Args.getLastArg(OPT_mstack_alignment)) {
|
||||
StringRef Val = A->getValue(Args);
|
||||
Val.getAsInteger(10, Opts.StackAlignment);
|
||||
}
|
||||
|
||||
if (Arg *A = Args.getLastArg(OPT_fobjc_dispatch_method_EQ)) {
|
||||
StringRef Name = A->getValue(Args);
|
||||
|
|
Loading…
Reference in New Issue