Author: compnerd Date: Fri Apr 8 11:52:05 2016 New Revision: 265807 URL: http://llvm.org/viewvc/llvm-project?rev=265807&view=rev Log: Move EABIVersion from CodeGenOptions to TargetOptions
It is possible to argue that the EABIVersion field is similar in spirit to the ABI field in TargetOptions. It represents the embedded ABI that the target follows. This will allow us to thread this information into the target information construction. Modified: cfe/trunk/include/clang/Basic/TargetOptions.h cfe/trunk/include/clang/Frontend/CodeGenOptions.h cfe/trunk/lib/CodeGen/BackendUtil.cpp cfe/trunk/lib/Frontend/CompilerInvocation.cpp Modified: cfe/trunk/include/clang/Basic/TargetOptions.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetOptions.h?rev=265807&r1=265806&r2=265807&view=diff ============================================================================== --- cfe/trunk/include/clang/Basic/TargetOptions.h (original) +++ cfe/trunk/include/clang/Basic/TargetOptions.h Fri Apr 8 11:52:05 2016 @@ -36,6 +36,9 @@ public: /// If given, the name of the target ABI to use. std::string ABI; + /// The EABI version to use + std::string EABIVersion; + /// If given, the version string of the linker in use. std::string LinkerVersion; @@ -45,7 +48,7 @@ public: /// The list of target specific features to enable or disable -- this should /// be a list of strings starting with by '+' or '-'. std::vector<std::string> Features; - + std::vector<std::string> Reciprocals; }; Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.h?rev=265807&r1=265806&r2=265807&view=diff ============================================================================== --- cfe/trunk/include/clang/Frontend/CodeGenOptions.h (original) +++ cfe/trunk/include/clang/Frontend/CodeGenOptions.h Fri Apr 8 11:52:05 2016 @@ -159,9 +159,6 @@ public: /// importing. std::string ThinLTOIndexFile; - /// The EABI version to use - std::string EABIVersion; - /// A list of file names passed with -fcuda-include-gpubinary options to /// forward to CUDA runtime back-end for incorporating them into host-side /// object file. Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=265807&r1=265806&r2=265807&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original) +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Fri Apr 8 11:52:05 2016 @@ -552,7 +552,7 @@ TargetMachine *EmitAssemblyHelper::Creat Options.CompressDebugSections = CodeGenOpts.CompressDebugSections; // Set EABI version. - Options.EABIVersion = llvm::StringSwitch<llvm::EABI>(CodeGenOpts.EABIVersion) + Options.EABIVersion = llvm::StringSwitch<llvm::EABI>(TargetOpts.EABIVersion) .Case("4", llvm::EABI::EABI4) .Case("5", llvm::EABI::EABI5) .Case("gnu", llvm::EABI::GNU) Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=265807&r1=265806&r2=265807&view=diff ============================================================================== --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original) +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Fri Apr 8 11:52:05 2016 @@ -545,20 +545,6 @@ static bool ParseCodeGenArgs(CodeGenOpti Opts.DiscardValueNames = Args.hasArg(OPT_discard_value_names); Opts.DisableTailCalls = Args.hasArg(OPT_mdisable_tail_calls); Opts.FloatABI = Args.getLastArgValue(OPT_mfloat_abi); - if (Arg *A = Args.getLastArg(OPT_meabi)) { - StringRef Value = A->getValue(); - llvm::EABI EABIVersion = llvm::StringSwitch<llvm::EABI>(Value) - .Case("default", llvm::EABI::Default) - .Case("4", llvm::EABI::EABI4) - .Case("5", llvm::EABI::EABI5) - .Case("gnu", llvm::EABI::GNU) - .Default(llvm::EABI::Unknown); - if (EABIVersion == llvm::EABI::Unknown) - Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) - << Value; - else - Opts.EABIVersion = Value; - } Opts.LessPreciseFPMAD = Args.hasArg(OPT_cl_mad_enable); Opts.LimitFloatPrecision = Args.getLastArgValue(OPT_mlimit_float_precision); Opts.NoInfsFPMath = (Args.hasArg(OPT_menable_no_infinities) || @@ -2078,9 +2064,24 @@ static void ParsePreprocessorOutputArgs( Opts.UseLineDirectives = Args.hasArg(OPT_fuse_line_directives); } -static void ParseTargetArgs(TargetOptions &Opts, ArgList &Args) { +static void ParseTargetArgs(TargetOptions &Opts, ArgList &Args, + DiagnosticsEngine &Diags) { using namespace options; Opts.ABI = Args.getLastArgValue(OPT_target_abi); + if (Arg *A = Args.getLastArg(OPT_meabi)) { + StringRef Value = A->getValue(); + llvm::EABI EABIVersion = llvm::StringSwitch<llvm::EABI>(Value) + .Case("default", llvm::EABI::Default) + .Case("4", llvm::EABI::EABI4) + .Case("5", llvm::EABI::EABI5) + .Case("gnu", llvm::EABI::GNU) + .Default(llvm::EABI::Unknown); + if (EABIVersion == llvm::EABI::Unknown) + Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) + << Value; + else + Opts.EABIVersion = Value; + } Opts.CPU = Args.getLastArgValue(OPT_target_cpu); Opts.FPMath = Args.getLastArgValue(OPT_mfpmath); Opts.FeaturesAsWritten = Args.getAllArgValues(OPT_target_feature); @@ -2127,7 +2128,7 @@ bool CompilerInvocation::CreateFromArgs( ParseFileSystemArgs(Res.getFileSystemOpts(), Args); // FIXME: We shouldn't have to pass the DashX option around here InputKind DashX = ParseFrontendArgs(Res.getFrontendOpts(), Args, Diags); - ParseTargetArgs(Res.getTargetOpts(), Args); + ParseTargetArgs(Res.getTargetOpts(), Args, Diags); Success &= ParseCodeGenArgs(Res.getCodeGenOpts(), Args, DashX, Diags, Res.getTargetOpts()); ParseHeaderSearchArgs(Res.getHeaderSearchOpts(), Args); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits