Fix the ridiculous SubtargetFeatures API where it implicitly expects CPU name to
[oota-llvm.git] / lib / Target / Sparc / SparcSubtarget.cpp
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 TargetSubtarget.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "SparcSubtarget.h"
15 #include "SparcGenSubtarget.inc"
16 using namespace llvm;
17
18 SparcSubtarget::SparcSubtarget(const std::string &TT, const std::string &CPU,
19                                const std::string &FS,  bool is64Bit) :
20   IsV9(false),
21   V8DeprecatedInsts(false),
22   IsVIS(false),
23   Is64Bit(is64Bit) {
24   
25   // Determine default and user specified characteristics
26   std::string CPUName = CPU;
27   if (CPUName.empty()) {
28     if (is64Bit)
29       CPUName = "v9";
30     else
31       CPUName = "v8";
32   }
33   IsV9 = CPUName == "v9";
34
35   // Parse features string.
36   ParseSubtargetFeatures(FS, CPUName);
37 }