summaryrefslogtreecommitdiff
path: root/Driver
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-03-03 19:56:18 +0000
committerChris Lattner <sabre@nondot.org>2009-03-03 19:56:18 +0000
commit6328cc316d7032517399da9230a197cd29f2664d (patch)
treed2abea490e57bd931855bfe07d11a30f9e88cf65 /Driver
parent7ba138abd329e591a8f6d5001f60dd7082f71b3b (diff)
downloadclang-6328cc316d7032517399da9230a197cd29f2664d.tar.gz
implement support for propagating *features* down to the code generator
and defining target-specific macros based on them (like __SSE3__ and friends). After extensive discussion with Daniel, this work will need driver support, which will translate things like -msse3 into a -mattr feature. Until this work is done, the code in clang.cpp is disabled and the X86TargetInfo ctor still defaults to SSE2. With these two things changed, this code will work. PR3634 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65966 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver')
-rw-r--r--Driver/clang.cpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/Driver/clang.cpp b/Driver/clang.cpp
index 54e93f8031..9ecddd8cd5 100644
--- a/Driver/clang.cpp
+++ b/Driver/clang.cpp
@@ -517,10 +517,10 @@ Trigraphs("trigraphs", llvm::cl::desc("Process trigraph sequences."));
static llvm::cl::opt<bool>
Ansi("ansi", llvm::cl::desc("Equivalent to specifying -std=c89."));
-
static llvm::cl::list<std::string>
-TargetOptions("m", llvm::cl::Prefix, llvm::cl::value_desc("option"),
- llvm::cl::desc("Target-specific options, such as -msse3"));
+TargetFeatures("mattr", llvm::cl::CommaSeparated,
+ llvm::cl::desc("Target specific attributes (-mattr=help for details)"));
+
// FIXME: add:
@@ -530,19 +530,25 @@ static void InitializeLanguageStandard(LangOptions &Options, LangKind LK,
// Allow the target to set the default the langauge options as it sees fit.
Target->getDefaultLangOptions(Options);
- // If the user specified any -mfoo options, pass them to the target for
- // validation and processing.
- if (!TargetOptions.empty()) {
+ // If there are any -mattr options, pass them to the target for validation and
+ // processing. The driver should have already consolidated all the
+ // target-feature settings and passed them to us in the -mattr list. The
+ // -mattr list is treated by the code generator as a diff against the -mcpu
+ // setting, but the driver should pass all enabled options as "+" settings.
+ // This means that the target should only look at + settings.
+ if (!TargetFeatures.empty()
+ // FIXME: The driver is not quite yet ready for this.
+ && 0) {
std::string ErrorStr;
- int Opt = Target->HandleTargetOptions(&TargetOptions[0],
- TargetOptions.size(), ErrorStr);
+ int Opt = Target->HandleTargetFeatures(&TargetFeatures[0],
+ TargetFeatures.size(), ErrorStr);
if (Opt != -1) {
if (ErrorStr.empty())
- fprintf(stderr, "invalid command line option '%s'\n",
- TargetOptions[Opt].c_str());
+ fprintf(stderr, "invalid feature '%s'\n",
+ TargetFeatures[Opt].c_str());
else
- fprintf(stderr, "command line option '%s': %s\n",
- TargetOptions[Opt].c_str(), ErrorStr.c_str());
+ fprintf(stderr, "feature '%s': %s\n",
+ TargetFeatures[Opt].c_str(), ErrorStr.c_str());
exit(1);
}
}
@@ -1253,10 +1259,6 @@ static llvm::cl::opt<std::string>
TargetCPU("mcpu",
llvm::cl::desc("Target a specific cpu type (-mcpu=help for details)"));
-static llvm::cl::list<std::string>
-TargetFeatures("mattr",
- llvm::cl::desc("Target specific attributes (-mattr=help for details)"));
-
static void InitializeCompileOptions(CompileOptions &Opts) {
Opts.OptimizeSize = OptSize;
if (OptSize) {