SparcSubtarget.cpp revision 31d157ae1ac2cd9c787dc3c1d28e64c682803844
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/Support/TargetRegistry.h"
17
18#define GET_SUBTARGETINFO_TARGET_DESC
19#define GET_SUBTARGETINFO_CTOR
20#include "SparcGenSubtargetInfo.inc"
21
22using namespace llvm;
23
24void SparcSubtarget::anchor() { }
25
26SparcSubtarget::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