1 //===- MipsSubtarget.cpp - Mips Subtarget Information -----------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file implements the Mips specific subclass of TargetSubtarget. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #include "MipsSubtarget.h" 15 #include "Mips.h" 16 #include "MipsGenSubtarget.inc" 17 #include "llvm/Module.h" 18 #include "llvm/Support/CommandLine.h" 19 using namespace llvm; 20 21 cl::opt<bool> NotABICall("disable-mips-abicall", cl::Hidden, 22 cl::desc("Disable code for SVR4-style dynamic objects")); 23 cl::opt<bool> AbsoluteCall("enable-mips-absolute-call", cl::Hidden, 24 cl::desc("Enable absolute call within abicall")); 25 cl::opt<unsigned> SSThreshold("mips-ssection-threshold", cl::Hidden, 26 cl::desc("Small data and bss section threshold size (default=8)"), 27 cl::init(8)); 28 29 MipsSubtarget::MipsSubtarget(const TargetMachine &TM, const Module &M, 30 const std::string &FS, bool little) : 31 MipsArchVersion(Mips1), MipsABI(O32), IsLittle(little), IsSingleFloat(false), 32 IsFP64bit(false), IsGP64bit(false), HasVFPU(false), HasSEInReg(false), 33 HasABICall(true), HasAbsoluteCall(false), IsLinux(true) 34 { 35 std::string CPU = "mips1"; 36 37 // Parse features string. 38 ParseSubtargetFeatures(FS, CPU); 39 const std::string& TT = M.getTargetTriple(); 40 41 // Small section size threshold 42 SSectionThreshold = SSThreshold; 43 44 // Is the target system Linux ? 45 if (TT.find("linux") == std::string::npos) 46 IsLinux = false; 47 48 // When only the target triple is specified and is 49 // a allegrex target, set the features. We also match 50 // big and little endian allegrex cores (dont really 51 // know if a big one exists) 52 if (TT.find("mipsallegrex") != std::string::npos) { 53 MipsABI = EABI; 54 IsSingleFloat = true; 55 MipsArchVersion = Mips2; 56 HasVFPU = true; // Enables Allegrex Vector FPU (not supported yet) 57 HasSEInReg = true; 58 } 59 60 // Abicall is the default for O32 ABI and is ignored 61 // for EABI. 62 if (NotABICall || isABI_EABI()) 63 HasABICall = false; 64 65 // TODO: disable when handling 64 bit symbols in the future. 66 if (HasABICall && AbsoluteCall) 67 HasAbsoluteCall = true; 68 } 69