mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-12 17:25:49 +00:00
[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
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
#include "InstPrinter/MipsInstPrinter.h"
|
#include "InstPrinter/MipsInstPrinter.h"
|
||||||
#include "MipsMCAsmInfo.h"
|
#include "MipsMCAsmInfo.h"
|
||||||
#include "MipsTargetStreamer.h"
|
#include "MipsTargetStreamer.h"
|
||||||
|
#include "llvm/ADT/Triple.h"
|
||||||
#include "llvm/MC/MCCodeGenInfo.h"
|
#include "llvm/MC/MCCodeGenInfo.h"
|
||||||
#include "llvm/MC/MCELFStreamer.h"
|
#include "llvm/MC/MCELFStreamer.h"
|
||||||
#include "llvm/MC/MCInstrInfo.h"
|
#include "llvm/MC/MCInstrInfo.h"
|
||||||
@@ -40,21 +41,10 @@ using namespace llvm;
|
|||||||
|
|
||||||
static std::string ParseMipsTriple(StringRef TT, StringRef CPU) {
|
static std::string ParseMipsTriple(StringRef TT, StringRef CPU) {
|
||||||
std::string MipsArchFeature;
|
std::string MipsArchFeature;
|
||||||
size_t DashPosition = 0;
|
Triple TheTriple(TT);
|
||||||
StringRef TheTriple;
|
|
||||||
|
|
||||||
// Let's see if there is a dash, like mips-unknown-linux.
|
if (TheTriple.getArch() == Triple::mips ||
|
||||||
DashPosition = TT.find('-');
|
TheTriple.getArch() == Triple::mipsel) {
|
||||||
|
|
||||||
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 (CPU.empty() || CPU == "mips32") {
|
if (CPU.empty() || CPU == "mips32") {
|
||||||
MipsArchFeature = "+mips32";
|
MipsArchFeature = "+mips32";
|
||||||
} else if (CPU == "mips32r2") {
|
} else if (CPU == "mips32r2") {
|
||||||
|
Reference in New Issue
Block a user