Driver/Frontend: Add support for -fobjc-legacy-dispatch, not yet used.

llvm-svn: 95004
This commit is contained in:
Daniel Dunbar 2010-02-01 21:07:25 +00:00
parent 5b5d2db3f6
commit 2e3f2c805e
5 changed files with 24 additions and 2 deletions

View File

@ -41,6 +41,8 @@ public:
unsigned NoCommon : 1; /// Set when -fno-common or C++ is enabled. unsigned NoCommon : 1; /// Set when -fno-common or C++ is enabled.
unsigned NoImplicitFloat : 1; /// Set when -mno-implicit-float is enabled. unsigned NoImplicitFloat : 1; /// Set when -mno-implicit-float is enabled.
unsigned NoZeroInitializedInBSS : 1; /// -fno-zero-initialized-in-bss unsigned NoZeroInitializedInBSS : 1; /// -fno-zero-initialized-in-bss
unsigned ObjCLegacyDispatch: 1; /// Use legacy Objective-C dispatch, even with
/// 2.0 runtime.
unsigned OptimizationLevel : 3; /// The -O[0-4] option specified. unsigned OptimizationLevel : 3; /// The -O[0-4] option specified.
unsigned OptimizeSize : 1; /// If -Os is specified. unsigned OptimizeSize : 1; /// If -Os is specified.
unsigned SoftFloat : 1; /// -soft-float. unsigned SoftFloat : 1; /// -soft-float.
@ -90,12 +92,13 @@ public:
NoCommon = 0; NoCommon = 0;
NoImplicitFloat = 0; NoImplicitFloat = 0;
NoZeroInitializedInBSS = 0; NoZeroInitializedInBSS = 0;
ObjCLegacyDispatch = 0;
OptimizationLevel = 0; OptimizationLevel = 0;
OptimizeSize = 0; OptimizeSize = 0;
UnrollLoops = 0;
SoftFloat = 0; SoftFloat = 0;
TimePasses = 0; TimePasses = 0;
UnitAtATime = 1; UnitAtATime = 1;
UnrollLoops = 0;
UnwindTables = 0; UnwindTables = 0;
VerifyModule = 1; VerifyModule = 1;

View File

@ -347,6 +347,8 @@ def fobjc_gc : Flag<"-fobjc-gc">,
HelpText<"Enable Objective-C garbage collection">; HelpText<"Enable Objective-C garbage collection">;
def fobjc_gc_only : Flag<"-fobjc-gc-only">, def fobjc_gc_only : Flag<"-fobjc-gc-only">,
HelpText<"Use GC exclusively for Objective-C related memory management">; HelpText<"Use GC exclusively for Objective-C related memory management">;
def fobjc_legacy_dispatch : Flag<"-fobjc-legacy-dispatch">,
HelpText<"Use legacy dispatch with the Objective-C non-fragile ABI">;
def print_ivar_layout : Flag<"-print-ivar-layout">, def print_ivar_layout : Flag<"-print-ivar-layout">,
HelpText<"Enable Objective-C Ivar layout bitmap print trace">; HelpText<"Enable Objective-C Ivar layout bitmap print trace">;
def fobjc_nonfragile_abi : Flag<"-fobjc-nonfragile-abi">, def fobjc_nonfragile_abi : Flag<"-fobjc-nonfragile-abi">,

View File

@ -303,6 +303,7 @@ def fno_keep_inline_functions : Flag<"-fno-keep-inline-functions">, Group<clang_
def fno_math_errno : Flag<"-fno-math-errno">, Group<f_Group>; def fno_math_errno : Flag<"-fno-math-errno">, Group<f_Group>;
def fno_merge_all_constants : Flag<"-fno-merge-all-constants">, Group<f_Group>; def fno_merge_all_constants : Flag<"-fno-merge-all-constants">, Group<f_Group>;
def fno_ms_extensions : Flag<"-fno-ms-extensions">, Group<f_Group>; def fno_ms_extensions : Flag<"-fno-ms-extensions">, Group<f_Group>;
def fno_objc_legacy_dispatch : Flag<"-fno-objc-legacy-dispatch">, Group<f_Group>;
def fno_omit_frame_pointer : Flag<"-fno-omit-frame-pointer">, Group<f_Group>; def fno_omit_frame_pointer : Flag<"-fno-omit-frame-pointer">, Group<f_Group>;
def fno_pascal_strings : Flag<"-fno-pascal-strings">, Group<f_Group>; def fno_pascal_strings : Flag<"-fno-pascal-strings">, Group<f_Group>;
def fno_rtti : Flag<"-fno-rtti">, Group<f_Group>; def fno_rtti : Flag<"-fno-rtti">, Group<f_Group>;
@ -318,6 +319,7 @@ def fobjc_atdefs : Flag<"-fobjc-atdefs">, Group<clang_ignored_f_Group>;
def fobjc_call_cxx_cdtors : Flag<"-fobjc-call-cxx-cdtors">, Group<clang_ignored_f_Group>; def fobjc_call_cxx_cdtors : Flag<"-fobjc-call-cxx-cdtors">, Group<clang_ignored_f_Group>;
def fobjc_gc_only : Flag<"-fobjc-gc-only">, Group<f_Group>; def fobjc_gc_only : Flag<"-fobjc-gc-only">, Group<f_Group>;
def fobjc_gc : Flag<"-fobjc-gc">, Group<f_Group>; def fobjc_gc : Flag<"-fobjc-gc">, Group<f_Group>;
def fobjc_legacy_dispatch : Flag<"-fobjc-legacy-dispatch">, Group<f_Group>;
def fobjc_new_property : Flag<"-fobjc-new-property">, Group<clang_ignored_f_Group>; def fobjc_new_property : Flag<"-fobjc-new-property">, Group<clang_ignored_f_Group>;
def fobjc_nonfragile_abi : Flag<"-fobjc-nonfragile-abi">, Group<f_Group>; def fobjc_nonfragile_abi : Flag<"-fobjc-nonfragile-abi">, Group<f_Group>;
def fobjc_sender_dependent_dispatch : Flag<"-fobjc-sender-dependent-dispatch">, Group<f_Group>; def fobjc_sender_dependent_dispatch : Flag<"-fobjc-sender-dependent-dispatch">, Group<f_Group>;

View File

@ -1024,10 +1024,22 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
// -fobjc-nonfragile-abi=0 is default. // -fobjc-nonfragile-abi=0 is default.
if (types::isObjC(InputType)) { if (types::isObjC(InputType)) {
if (Args.hasArg(options::OPT_fobjc_nonfragile_abi) || if (Args.hasArg(options::OPT_fobjc_nonfragile_abi) ||
getToolChain().IsObjCNonFragileABIDefault()) getToolChain().IsObjCNonFragileABIDefault()) {
CmdArgs.push_back("-fobjc-nonfragile-abi"); CmdArgs.push_back("-fobjc-nonfragile-abi");
// -fobjc-legacy-dispatch is only relevant with the nonfragile-abi, and
// defaults to off.
if (Args.hasFlag(options::OPT_fobjc_legacy_dispatch,
options::OPT_fno_objc_legacy_dispatch,
false))
CmdArgs.push_back("-fobjc-legacy-dispatch");
}
} }
if (!Args.hasFlag(options::OPT_fassume_sane_operator_new,
options::OPT_fno_assume_sane_operator_new))
CmdArgs.push_back("-fno-assume-sane-operator-new");
// -fshort-wchar default varies depending on platform; only // -fshort-wchar default varies depending on platform; only
// pass if specified. // pass if specified.
if (Arg *A = Args.getLastArg(options::OPT_fshort_wchar)) { if (Arg *A = Args.getLastArg(options::OPT_fshort_wchar)) {

View File

@ -170,6 +170,8 @@ static void CodeGenOptsToArgs(const CodeGenOptions &Opts,
} }
if (Opts.NoZeroInitializedInBSS) if (Opts.NoZeroInitializedInBSS)
Res.push_back("-mno-zero-initialized-bss"); Res.push_back("-mno-zero-initialized-bss");
if (Opts.ObjCLegacyDispatch)
Res.push_back("-fobjc-legacy-dispatch");
if (Opts.SoftFloat) if (Opts.SoftFloat)
Res.push_back("-msoft-float"); Res.push_back("-msoft-float");
if (Opts.UnwindTables) if (Opts.UnwindTables)
@ -772,6 +774,7 @@ static void ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
Opts.FloatABI = getLastArgValue(Args, OPT_mfloat_abi); Opts.FloatABI = getLastArgValue(Args, OPT_mfloat_abi);
Opts.LimitFloatPrecision = getLastArgValue(Args, OPT_mlimit_float_precision); Opts.LimitFloatPrecision = getLastArgValue(Args, OPT_mlimit_float_precision);
Opts.NoZeroInitializedInBSS = Args.hasArg(OPT_mno_zero_initialized_in_bss); Opts.NoZeroInitializedInBSS = Args.hasArg(OPT_mno_zero_initialized_in_bss);
Opts.ObjCLegacyDispatch = Args.hasArg(OPT_fobjc_legacy_dispatch);
Opts.SoftFloat = Args.hasArg(OPT_msoft_float); Opts.SoftFloat = Args.hasArg(OPT_msoft_float);
Opts.UnwindTables = Args.hasArg(OPT_munwind_tables); Opts.UnwindTables = Args.hasArg(OPT_munwind_tables);
Opts.RelocationModel = getLastArgValue(Args, OPT_mrelocation_model, "pic"); Opts.RelocationModel = getLastArgValue(Args, OPT_mrelocation_model, "pic");