summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Sanders <daniel.sanders@imgtec.com>2014-02-19 15:55:21 +0000
committerDaniel Sanders <daniel.sanders@imgtec.com>2014-02-19 15:55:21 +0000
commit9a8ab56fac64d77ec2fbdfd8bec1e9ba1d04c6a6 (patch)
tree70da4e38ae9ff278f97054be117b0a4cf6f9c215 /lib
parent3e0d3a45e57237e8029f696faa801618d87a4259 (diff)
downloadllvm-9a8ab56fac64d77ec2fbdfd8bec1e9ba1d04c6a6.tar.gz
llvm-9a8ab56fac64d77ec2fbdfd8bec1e9ba1d04c6a6.tar.bz2
llvm-9a8ab56fac64d77ec2fbdfd8bec1e9ba1d04c6a6.tar.xz
[mips] Use llvm::Triple in ParseMipsTriple() instead of manually parsing it
No functional change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201689 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp18
1 files changed, 4 insertions, 14 deletions
diff --git a/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp b/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp
index 70b5ba79cf..01bdfb704f 100644
--- a/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp
+++ b/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp
@@ -15,6 +15,7 @@
#include "InstPrinter/MipsInstPrinter.h"
#include "MipsMCAsmInfo.h"
#include "MipsTargetStreamer.h"
+#include "llvm/ADT/Triple.h"
#include "llvm/MC/MCCodeGenInfo.h"
#include "llvm/MC/MCELFStreamer.h"
#include "llvm/MC/MCInstrInfo.h"
@@ -40,21 +41,10 @@ using namespace llvm;
static std::string ParseMipsTriple(StringRef TT, StringRef CPU) {
std::string MipsArchFeature;
- size_t DashPosition = 0;
- StringRef TheTriple;
+ Triple TheTriple(TT);
- // Let's see if there is a dash, like mips-unknown-linux.
- DashPosition = TT.find('-');
-
- if (DashPosition == StringRef::npos) {
- // No dash, we check the string size.
- TheTriple = TT.substr(0);
- } else {
- // We are only interested in substring before dash.
- TheTriple = TT.substr(0,DashPosition);
- }
-
- if (TheTriple == "mips" || TheTriple == "mipsel") {
+ if (TheTriple.getArch() == Triple::mips ||
+ TheTriple.getArch() == Triple::mipsel) {
if (CPU.empty() || CPU == "mips32") {
MipsArchFeature = "+mips32";
} else if (CPU == "mips32r2") {