1 //===- SparcSubtarget.cpp - SPARC Subtarget Information -------------------===// 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 SPARC specific subclass of TargetSubtargetInfo. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #include "SparcSubtarget.h" 15 #include "Sparc.h" 16 #include "llvm/Target/TargetRegistry.h" 17 18 #define GET_SUBTARGETINFO_ENUM 19 #define GET_SUBTARGETINFO_MC_DESC 20 #define GET_SUBTARGETINFO_TARGET_DESC 21 #define GET_SUBTARGETINFO_CTOR 22 #include "SparcGenSubtargetInfo.inc" 23 24 using namespace llvm; 25 26 SparcSubtarget::SparcSubtarget(const std::string &TT, const std::string &CPU, 27 const std::string &FS, bool is64Bit) : 28 SparcGenSubtargetInfo(TT, CPU, FS), 29 IsV9(false), 30 V8DeprecatedInsts(false), 31 IsVIS(false), 32 Is64Bit(is64Bit) { 33 34 // Determine default and user specified characteristics 35 std::string CPUName = CPU; 36 if (CPUName.empty()) { 37 if (is64Bit) 38 CPUName = "v9"; 39 else 40 CPUName = "v8"; 41 } 42 IsV9 = CPUName == "v9"; 43 44 // Parse features string. 45 ParseSubtargetFeatures(CPUName, FS); 46 } 47 48 MCSubtargetInfo *createSparcMCSubtargetInfo(StringRef TT, StringRef CPU, 49 StringRef FS) { 50 MCSubtargetInfo *X = new MCSubtargetInfo(); 51 InitSparcMCSubtargetInfo(X, TT, CPU, FS); 52 return X; 53 } 54 55 extern "C" void LLVMInitializeSparcMCSubtargetInfo() { 56 TargetRegistry::RegisterMCSubtargetInfo(TheSparcTarget, 57 createSparcMCSubtargetInfo); 58 } 59