Factor out SmallDataThreshold
This patch factors out SmallDataThreshold code.
llvm-svn: 237364
diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp
index 5428a55..6d52ab9 100644
--- a/clang/lib/Driver/ToolChains.cpp
+++ b/clang/lib/Driver/ToolChains.cpp
@@ -2128,6 +2128,30 @@
return InstallRelDir;
}
+const char *Hexagon_TC::GetSmallDataThreshold(const ArgList &Args)
+{
+ Arg *A;
+
+ A = Args.getLastArg(options::OPT_G,
+ options::OPT_G_EQ,
+ options::OPT_msmall_data_threshold_EQ);
+ if (A)
+ return A->getValue();
+
+ A = Args.getLastArg(options::OPT_shared,
+ options::OPT_fpic,
+ options::OPT_fPIC);
+ if (A)
+ return "0";
+
+ return 0;
+}
+
+bool Hexagon_TC::UsesG0(const char* smallDataThreshold)
+{
+ return smallDataThreshold && smallDataThreshold[0] == '0';
+}
+
static void GetHexagonLibraryPaths(
const ArgList &Args,
const std::string &Ver,