Pull in r202177 from upstream clang trunk (by Roman Divacky):

Give sparcv9 the ability to set the target cpu. Change it from
  accepting -march which doesnt exist on sparc gcc to -mcpu. While here
  adjust a few tests to not write an unused temporary file.
This commit is contained in:
Dimitry Andric 2014-02-26 22:18:33 +00:00
parent c3bb517174
commit d7538a4458
2 changed files with 18 additions and 1 deletions

View File

@ -4552,6 +4552,22 @@ public:
Builder.defineMacro("__sparcv9__");
}
}
virtual bool setCPU(const std::string &Name) {
bool CPUKnown = llvm::StringSwitch<bool>(Name)
.Case("v9", true)
.Case("ultrasparc", true)
.Case("ultrasparc3", true)
.Case("niagara", true)
.Case("niagara2", true)
.Case("niagara3", true)
.Case("niagara4", true)
.Default(false);
// No need to store the CPU yet. There aren't any CPU-specific
// macros to define.
return CPUKnown;
}
};
} // end anonymous namespace.

View File

@ -1373,7 +1373,8 @@ static std::string getCPUName(const ArgList &Args, const llvm::Triple &T) {
}
case llvm::Triple::sparc:
if (const Arg *A = Args.getLastArg(options::OPT_march_EQ))
case llvm::Triple::sparcv9:
if (const Arg *A = Args.getLastArg(options::OPT_mcpu_EQ))
return A->getValue();
return "";