1 //===- MipsSubtarget.cpp - Mips Subtarget Information -----------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements the Mips specific subclass of TargetSubtargetInfo.
12 //===----------------------------------------------------------------------===//
14 #include "MipsSubtarget.h"
16 #include "llvm/Target/TargetRegistry.h"
18 #define GET_SUBTARGETINFO_ENUM
19 #define GET_SUBTARGETINFO_MC_DESC
20 #define GET_SUBTARGETINFO_TARGET_DESC
21 #define GET_SUBTARGETINFO_CTOR
22 #include "MipsGenSubtargetInfo.inc"
26 MipsSubtarget::MipsSubtarget(const std::string
&TT
, const std::string
&CPU
,
27 const std::string
&FS
, bool little
) :
28 MipsGenSubtargetInfo(TT
, CPU
, FS
),
29 MipsArchVersion(Mips1
), MipsABI(O32
), IsLittle(little
), IsSingleFloat(false),
30 IsFP64bit(false), IsGP64bit(false), HasVFPU(false), IsLinux(true),
31 HasSEInReg(false), HasCondMov(false), HasMulDivAdd(false), HasMinMax(false),
32 HasSwap(false), HasBitCount(false)
34 std::string CPUName
= CPU
;
37 MipsArchVersion
= Mips1
;
39 // Parse features string.
40 ParseSubtargetFeatures(CPUName
, FS
);
42 // Initialize scheduling itinerary for the specified CPU.
43 InstrItins
= getInstrItineraryForCPU(CPUName
);
45 // Is the target system Linux ?
46 if (TT
.find("linux") == std::string::npos
)
49 // When only the target triple is specified and is
50 // a allegrex target, set the features. We also match
51 // big and little endian allegrex cores (dont really
52 // know if a big one exists)
53 if (TT
.find("mipsallegrex") != std::string::npos
||
54 TT
.find("psp") != std::string::npos
) {
57 MipsArchVersion
= Mips2
;
58 HasVFPU
= true; // Enables Allegrex Vector FPU (not supported yet)
66 MCSubtargetInfo
*createMipsMCSubtargetInfo(StringRef TT
, StringRef CPU
,
68 MCSubtargetInfo
*X
= new MCSubtargetInfo();
69 InitMipsMCSubtargetInfo(X
, CPU
, FS
);
73 extern "C" void LLVMInitializeMipsMCSubtargetInfo() {
74 TargetRegistry::RegisterMCSubtargetInfo(TheMipsTarget
,
75 createMipsMCSubtargetInfo
);