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 TargetSubtarget.
12 //===----------------------------------------------------------------------===//
14 #include "MipsSubtarget.h"
16 #include "MipsGenSubtarget.inc"
17 #include "llvm/Support/CommandLine.h"
21 NotABICall("disable-mips-abicall", cl::Hidden,
22 cl::desc("Disable code for SVR4-style dynamic objects"));
24 AbsoluteCall("enable-mips-absolute-call", cl::Hidden,
25 cl::desc("Enable absolute call within abicall"));
27 MipsSubtarget::MipsSubtarget(const TargetMachine &TM, const std::string &TT,
28 const std::string &FS, bool little) :
29 MipsArchVersion(Mips1), MipsABI(O32), IsLittle(little), IsSingleFloat(false),
30 IsFP64bit(false), IsGP64bit(false), HasVFPU(false), HasABICall(true),
31 HasAbsoluteCall(false), IsLinux(true), HasSEInReg(false), HasCondMov(false),
32 HasMulDivAdd(false), HasMinMax(false), HasSwap(false), HasBitCount(false)
34 std::string CPU = "mips1";
35 MipsArchVersion = Mips1;
37 // Parse features string.
38 ParseSubtargetFeatures(FS, CPU);
40 // Is the target system Linux ?
41 if (TT.find("linux") == std::string::npos)
44 // When only the target triple is specified and is
45 // a allegrex target, set the features. We also match
46 // big and little endian allegrex cores (dont really
47 // know if a big one exists)
48 if (TT.find("mipsallegrex") != std::string::npos ||
49 TT.find("psp") != std::string::npos) {
52 MipsArchVersion = Mips2;
53 HasVFPU = true; // Enables Allegrex Vector FPU (not supported yet)
60 // Abicall is the default for O32 ABI, but is disabled within EABI and in
62 if (NotABICall || isABI_EABI() || (TM.getRelocationModel() == Reloc::Static))
65 // TODO: disable when handling 64 bit symbols in the future.
66 if (HasABICall && AbsoluteCall)
67 HasAbsoluteCall = true;