зеркало из https://github.com/microsoft/clang-1.git
[driver] Add a -Ofast option, which enables -O3, -ffast-math, and
-fstrict-aliasing. rdar://13622687 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179216 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
2c5a38e3bc
Коммит
d4fc9de6f7
|
@ -181,6 +181,7 @@ def ObjCXX : Flag<["-"], "ObjC++">, Flags<[DriverOption]>,
|
|||
def ObjC : Flag<["-"], "ObjC">, Flags<[DriverOption]>,
|
||||
HelpText<"Treat source input files as Objective-C inputs">;
|
||||
def O : Joined<["-"], "O">, Group<O_Group>, Flags<[CC1Option]>;
|
||||
def Ofast : Joined<["-"], "Ofast">, Group<O_Group>, Flags<[CC1Option]>;
|
||||
def P : Flag<["-"], "P">, Flags<[CC1Option]>,
|
||||
HelpText<"Disable linemarker output in -E mode">;
|
||||
def Qn : Flag<["-"], "Qn">;
|
||||
|
|
|
@ -68,6 +68,9 @@ static unsigned getOptimizationLevel(ArgList &Args, InputKind IK,
|
|||
if (A->getOption().matches(options::OPT_O0))
|
||||
return 0;
|
||||
|
||||
if (A->getOption().matches(options::OPT_Ofast))
|
||||
return 3;
|
||||
|
||||
assert (A->getOption().matches(options::OPT_O));
|
||||
|
||||
StringRef S(A->getValue());
|
||||
|
@ -97,6 +100,13 @@ static unsigned getOptimizationLevelSize(ArgList &Args, InputKind IK,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static bool isOptimizationLevelFast(ArgList &Args) {
|
||||
if (Arg *A = Args.getLastArg(options::OPT_O_Group))
|
||||
if (A->getOption().matches(options::OPT_Ofast))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static void addWarningArgs(ArgList &Args, std::vector<std::string> &Warnings) {
|
||||
for (arg_iterator I = Args.filtered_begin(OPT_W_Group),
|
||||
E = Args.filtered_end(); I != E; ++I) {
|
||||
|
@ -324,7 +334,8 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
|
|||
Opts.ForbidGuardVariables = Args.hasArg(OPT_fforbid_guard_variables);
|
||||
Opts.UseRegisterSizedBitfieldAccess = Args.hasArg(
|
||||
OPT_fuse_register_sized_bitfield_access);
|
||||
Opts.RelaxedAliasing = Args.hasArg(OPT_relaxed_aliasing);
|
||||
Opts.RelaxedAliasing = Args.hasArg(OPT_relaxed_aliasing) ||
|
||||
isOptimizationLevelFast(Args);
|
||||
Opts.StructPathTBAA = Args.hasArg(OPT_struct_path_tbaa);
|
||||
Opts.DwarfDebugFlags = Args.getLastArgValue(OPT_dwarf_debug_flags);
|
||||
Opts.MergeAllConstants = !Args.hasArg(OPT_fno_merge_all_constants);
|
||||
|
@ -1302,7 +1313,8 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
|
|||
// inlining enabled.
|
||||
Opts.NoInlineDefine = !Opt || Args.hasArg(OPT_fno_inline);
|
||||
|
||||
Opts.FastMath = Args.hasArg(OPT_ffast_math);
|
||||
Opts.FastMath = Args.hasArg(OPT_ffast_math) ||
|
||||
isOptimizationLevelFast(Args);
|
||||
Opts.FiniteMathOnly = Args.hasArg(OPT_ffinite_math_only);
|
||||
|
||||
Opts.RetainCommentsFromSystemHeaders =
|
||||
|
|
Загрузка…
Ссылка в новой задаче