]> granicus.if.org Git - clang/commitdiff
Move EABIVersion from CodeGenOptions to TargetOptions
authorSaleem Abdulrasool <compnerd@compnerd.org>
Fri, 8 Apr 2016 16:52:05 +0000 (16:52 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Fri, 8 Apr 2016 16:52:05 +0000 (16:52 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265807 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/TargetOptions.h
include/clang/Frontend/CodeGenOptions.h
lib/CodeGen/BackendUtil.cpp
lib/Frontend/CompilerInvocation.cpp

index ca0cca78bfc8e3fd9ad58bf7d930d6504a4cacbc..3718ee316a8d65bb72ed0f5f64d0fb19d1bbff03 100644 (file)
@@ -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;
 };
 
index d96c2d6dc1df8ddd9d5514d6bb2a04a3c8736cbf..be176df7f7b48ca1725b1471525190febd54e83c 100644 (file)
@@ -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.
index 47a34a21b810ed8921b9637ded70c4c9de14f69c..4470afb910cac0e9a51240b6d783d6b1117b95b7 100644 (file)
@@ -552,7 +552,7 @@ TargetMachine *EmitAssemblyHelper::CreateTargetMachine(bool MustCreateTM) {
   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)
index 28cf5be0e8f16cb71880b2346cc991c20cea5acf..751d4334034d12453ebd2ce66e9cf334c9351481 100644 (file)
@@ -545,20 +545,6 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
   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(PreprocessorOutputOptions &Opts,
   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(CompilerInvocation &Res,
   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);