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