xref: /llvm-project/llvm/lib/Target/Sparc/SparcSubtarget.cpp (revision 4d1ca96bfc439cc6d97242c81803f69b39a65e10)
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 
16 #define GET_SUBTARGETINFO_ENUM
17 #define GET_SUBTARGETINFO_MC_DESC
18 #define GET_SUBTARGETINFO_TARGET_DESC
19 #define GET_SUBTARGETINFO_CTOR
20 #include "SparcGenSubtargetInfo.inc"
21 
22 using namespace llvm;
23 
24 SparcSubtarget::SparcSubtarget(const std::string &TT, const std::string &CPU,
25                                const std::string &FS,  bool is64Bit) :
26   SparcGenSubtargetInfo(TT, CPU, FS),
27   IsV9(false),
28   V8DeprecatedInsts(false),
29   IsVIS(false),
30   Is64Bit(is64Bit) {
31 
32   // Determine default and user specified characteristics
33   std::string CPUName = CPU;
34   if (CPUName.empty()) {
35     if (is64Bit)
36       CPUName = "v9";
37     else
38       CPUName = "v8";
39   }
40   IsV9 = CPUName == "v9";
41 
42   // Parse features string.
43   ParseSubtargetFeatures(CPUName, FS);
44 }
45