forked from OSchip/llvm-project
start wiring up support for target-specific -mfoo options like -msse
llvm-svn: 65881
This commit is contained in:
parent
b94d7f65fa
commit
e6e4c0381a
|
@ -517,6 +517,12 @@ Trigraphs("trigraphs", llvm::cl::desc("Process trigraph sequences."));
|
||||||
static llvm::cl::opt<bool>
|
static llvm::cl::opt<bool>
|
||||||
Ansi("ansi", llvm::cl::desc("Equivalent to specifying -std=c89."));
|
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"));
|
||||||
|
|
||||||
|
|
||||||
// FIXME: add:
|
// FIXME: add:
|
||||||
// -fdollars-in-identifiers
|
// -fdollars-in-identifiers
|
||||||
static void InitializeLanguageStandard(LangOptions &Options, LangKind LK,
|
static void InitializeLanguageStandard(LangOptions &Options, LangKind LK,
|
||||||
|
@ -524,6 +530,23 @@ static void InitializeLanguageStandard(LangOptions &Options, LangKind LK,
|
||||||
// Allow the target to set the default the langauge options as it sees fit.
|
// Allow the target to set the default the langauge options as it sees fit.
|
||||||
Target->getDefaultLangOptions(Options);
|
Target->getDefaultLangOptions(Options);
|
||||||
|
|
||||||
|
// If the user specified any -mfoo options, pass them to the target for
|
||||||
|
// validation and processing.
|
||||||
|
if (!TargetOptions.empty()) {
|
||||||
|
std::string ErrorStr;
|
||||||
|
int Opt = Target->HandleTargetOptions(&TargetOptions[0],
|
||||||
|
TargetOptions.size(), ErrorStr);
|
||||||
|
if (Opt != -1) {
|
||||||
|
if (ErrorStr.empty())
|
||||||
|
fprintf(stderr, "invalid command line option '%s'\n",
|
||||||
|
TargetOptions[Opt].c_str());
|
||||||
|
else
|
||||||
|
fprintf(stderr, "command line option '%s': %s\n",
|
||||||
|
TargetOptions[Opt].c_str(), ErrorStr.c_str());
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (Ansi) // "The -ansi option is equivalent to -std=c89."
|
if (Ansi) // "The -ansi option is equivalent to -std=c89."
|
||||||
LangStd = lang_c89;
|
LangStd = lang_c89;
|
||||||
|
|
||||||
|
|
|
@ -249,6 +249,16 @@ public:
|
||||||
/// options.
|
/// options.
|
||||||
virtual void getDefaultLangOptions(LangOptions &Opts) {}
|
virtual void getDefaultLangOptions(LangOptions &Opts) {}
|
||||||
|
|
||||||
|
/// HandleTargetOptions - Handle target-specific options like -msse2 and
|
||||||
|
/// friends. An array of arguments is passed in: if they are all valid, this
|
||||||
|
/// should handle them and return -1. If there is an error, the index of the
|
||||||
|
/// invalid argument should be returned along with an optional error string.
|
||||||
|
virtual int HandleTargetOptions(std::string *StrArray, unsigned NumStrs,
|
||||||
|
std::string &ErrorReason) {
|
||||||
|
if (NumStrs == 0)
|
||||||
|
return -1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
protected:
|
protected:
|
||||||
virtual uint64_t getPointerWidthV(unsigned AddrSpace) const {
|
virtual uint64_t getPointerWidthV(unsigned AddrSpace) const {
|
||||||
return PointerWidth;
|
return PointerWidth;
|
||||||
|
|
Loading…
Reference in New Issue