r178744 - Plumb through the -fsplit-stack option using the existing backend

Rafael EspĂ­ndola rafael.espindola at gmail.com
Thu Apr 4 06:28:08 PDT 2013


Fixes pr14332?

On 4 April 2013 02:29, Eric Christopher <echristo at gmail.com> wrote:
> Author: echristo
> Date: Thu Apr  4 01:29:47 2013
> New Revision: 178744
>
> URL: http://llvm.org/viewvc/llvm-project?rev=178744&view=rev
> Log:
> Plumb through the -fsplit-stack option using the existing backend
> support.
>
> Caveat: Other than the existing segmented stacks support, no
> claims are made of this working.
>
> Modified:
>     cfe/trunk/include/clang/Driver/CC1Options.td
>     cfe/trunk/include/clang/Driver/Options.td
>     cfe/trunk/include/clang/Frontend/CodeGenOptions.def
>     cfe/trunk/lib/CodeGen/BackendUtil.cpp
>     cfe/trunk/lib/Driver/Tools.cpp
>     cfe/trunk/lib/Frontend/CompilerInvocation.cpp
>     cfe/trunk/test/Driver/clang_f_opts.c
>
> Modified: cfe/trunk/include/clang/Driver/CC1Options.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=178744&r1=178743&r2=178744&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Driver/CC1Options.td (original)
> +++ cfe/trunk/include/clang/Driver/CC1Options.td Thu Apr  4 01:29:47 2013
> @@ -184,6 +184,8 @@ def mlimit_float_precision : Separate<["
>    HelpText<"Limit float precision to the given value">;
>  def mno_exec_stack : Flag<["-"], "mnoexecstack">,
>    HelpText<"Mark the file as not needing an executable stack">;
> +def split_stacks : Flag<["-"], "split-stacks">,
> +  HelpText<"Try to use a split stack if possible.">;
>  def mno_zero_initialized_in_bss : Flag<["-"], "mno-zero-initialized-in-bss">,
>    HelpText<"Do not put zero initialized data in the BSS">;
>  def backend_option : Separate<["-"], "backend-option">,
>
> Modified: cfe/trunk/include/clang/Driver/Options.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=178744&r1=178743&r2=178744&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Driver/Options.td (original)
> +++ cfe/trunk/include/clang/Driver/Options.td Thu Apr  4 01:29:47 2013
> @@ -675,6 +675,7 @@ def fshow_source_location : Flag<["-"],
>  def fspell_checking : Flag<["-"], "fspell-checking">, Group<f_Group>;
>  def fsigned_bitfields : Flag<["-"], "fsigned-bitfields">, Group<f_Group>;
>  def fsigned_char : Flag<["-"], "fsigned-char">, Group<f_Group>;
> +def fsplit_stack : Flag<["-"], "fsplit-stack">, Group<f_Group>;
>  def fstack_protector_all : Flag<["-"], "fstack-protector-all">, Group<f_Group>;
>  def fstack_protector : Flag<["-"], "fstack-protector">, Group<f_Group>;
>  def fstrict_aliasing : Flag<["-"], "fstrict-aliasing">, Group<f_Group>;
>
> Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.def
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.def?rev=178744&r1=178743&r2=178744&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Frontend/CodeGenOptions.def (original)
> +++ cfe/trunk/include/clang/Frontend/CodeGenOptions.def Thu Apr  4 01:29:47 2013
> @@ -70,6 +70,7 @@ CODEGENOPT(NoDwarf2CFIAsm    , 1, 0) ///
>  CODEGENOPT(NoDwarfDirectoryAsm , 1, 0) ///< Set when -fno-dwarf-directory-asm is
>                                         ///< enabled.
>  CODEGENOPT(NoExecStack       , 1, 0) ///< Set when -Wa,--noexecstack is enabled.
> +CODEGENOPT(EnableSegmentedStacks , 1, 0) ///< Set when -fsplit-stack is enabled.
>  CODEGENOPT(NoGlobalMerge     , 1, 0) ///< Set when -mno-global-merge is enabled.
>  CODEGENOPT(NoImplicitFloat   , 1, 0) ///< Set when -mno-implicit-float is enabled.
>  CODEGENOPT(NoInfsFPMath      , 1, 0) ///< Assume FP arguments, results not +-Inf.
>
> Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=178744&r1=178743&r2=178744&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
> +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Thu Apr  4 01:29:47 2013
> @@ -457,6 +457,7 @@ TargetMachine *EmitAssemblyHelper::Creat
>    Options.TrapFuncName = CodeGenOpts.TrapFuncName;
>    Options.PositionIndependentExecutable = LangOpts.PIELevel != 0;
>    Options.SSPBufferSize = CodeGenOpts.SSPBufferSize;
> +  Options.EnableSegmentedStacks = CodeGenOpts.EnableSegmentedStacks;
>
>    TargetMachine *TM = TheTarget->createTargetMachine(Triple, TargetOpts.CPU,
>                                                       FeaturesStr, Options,
>
> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=178744&r1=178743&r2=178744&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Thu Apr  4 01:29:47 2013
> @@ -2112,6 +2112,10 @@ void Clang::ConstructJob(Compilation &C,
>                      options::OPT_fno_optimize_sibling_calls))
>      CmdArgs.push_back("-mdisable-tail-calls");
>
> +  // Handle segmented stacks.
> +  if (Args.hasArg(options::OPT_fsplit_stack))
> +    CmdArgs.push_back("-split-stacks");
> +
>    // Handle various floating point optimization flags, mapping them to the
>    // appropriate LLVM code generation flags. The pattern for all of these is to
>    // default off the codegen optimizations, and if any flag enables them and no
>
> Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=178744&r1=178743&r2=178744&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
> +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu Apr  4 01:29:47 2013
> @@ -358,6 +358,7 @@ static bool ParseCodeGenArgs(CodeGenOpti
>    Opts.NumRegisterParameters = Args.getLastArgIntValue(OPT_mregparm, 0, Diags);
>    Opts.NoGlobalMerge = Args.hasArg(OPT_mno_global_merge);
>    Opts.NoExecStack = Args.hasArg(OPT_mno_exec_stack);
> +  Opts.EnableSegmentedStacks = Args.hasArg(OPT_split_stacks);
>    Opts.RelaxAll = Args.hasArg(OPT_mrelax_all);
>    Opts.OmitLeafFramePointer = Args.hasArg(OPT_momit_leaf_frame_pointer);
>    Opts.SaveTempLabels = Args.hasArg(OPT_msave_temp_labels);
>
> Modified: cfe/trunk/test/Driver/clang_f_opts.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang_f_opts.c?rev=178744&r1=178743&r2=178744&view=diff
> ==============================================================================
> --- cfe/trunk/test/Driver/clang_f_opts.c (original)
> +++ cfe/trunk/test/Driver/clang_f_opts.c Thu Apr  4 01:29:47 2013
> @@ -1,6 +1,7 @@
> -// RUN: %clang -### -S -fasm -fblocks -fbuiltin -fno-math-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fmath-errno -fno-common -fno-pascal-strings -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS1 %s
> +// RUN: %clang -### -S -fasm -fblocks -fbuiltin -fno-math-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fmath-errno -fno-common -fno-pascal-strings -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings -fsplit-stack %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS1 %s
>  // RUN: %clang -### -S -fasm -fblocks -fbuiltin -fno-math-errno -fcommon -fpascal-strings -fno-asm -fno-blocks -fno-builtin -fmath-errno -fno-common -fno-pascal-strings -fno-show-source-location -fshort-enums -fshort-wchar %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS2 %s
>
> +// CHECK-OPTIONS1: -split-stacks
>  // CHECK-OPTIONS1: -fgnu-keywords
>  // CHECK-OPTIONS1: -fblocks
>  // CHECK-OPTIONS1: -fpascal-strings
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list