[PATCH] D50557: [clang][mips] Set __mips_fpr correctly for -mfpxx

Stefan Maksimovic via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 17 06:56:40 PDT 2018


smaksimovic added inline comments.


================
Comment at: lib/Basic/Targets/Mips.cpp:62
 
+unsigned MipsTargetInfo::getISARev(const std::string& CPU) const {
+  return llvm::StringSwitch<unsigned>(getCPU())
----------------
atanasyan wrote:
> The CPU argument looks unused. We can either remove it or make this routine a non-member static function. Probably we can change the CPU’s type to StringRef.
I opted to remove the argument.


================
Comment at: lib/Basic/Targets/Mips.cpp:97
 
-  const std::string ISARev = llvm::StringSwitch<std::string>(getCPU())
-                                 .Cases("mips32", "mips64", "1")
-                                 .Cases("mips32r2", "mips64r2", "2")
-                                 .Cases("mips32r3", "mips64r3", "3")
-                                 .Cases("mips32r5", "mips64r5", "5")
-                                 .Cases("mips32r6", "mips64r6", "6")
-                                 .Default("");
+  const std::string ISARev = std::to_string(getISARev(getCPU()));
+
----------------
atanasyan wrote:
> Is this change required for the fix? It looks like a refactoring and maybe done by a separate commit.
Since I took the code that originally was here in order to reuse it down below, I changed this line because the new function returns an int instead, as it was easier to do comparisons at line 264.


https://reviews.llvm.org/D50557





More information about the cfe-commits mailing list