blob: 9940fcf3b1d6d05ff83dfe6d671025bdb26fe1bb [file] [log] [blame]
Chris Lattner7c90f732006-02-05 05:50:24 +00001//===- SparcSubtarget.cpp - SPARC Subtarget Information -------------------===//
Chris Lattner0d170a72006-01-26 06:51:21 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by Chris Lattner and is distributed under the
6// University of Illinois Open Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file implements the SPARC specific subclass of TargetSubtarget.
11//
12//===----------------------------------------------------------------------===//
13
Chris Lattner7c90f732006-02-05 05:50:24 +000014#include "SparcSubtarget.h"
15#include "SparcGenSubtarget.inc"
Chris Lattner0d170a72006-01-26 06:51:21 +000016using namespace llvm;
17
Chris Lattner6f630012006-01-30 04:57:43 +000018// FIXME: temporary.
19#include "llvm/Support/CommandLine.h"
20namespace {
21 cl::opt<bool> EnableV9("enable-sparc-v9-insts", cl::Hidden,
22 cl::desc("Enable V9 instructions in the V8 target"));
23}
24
Chris Lattner7c90f732006-02-05 05:50:24 +000025SparcSubtarget::SparcSubtarget(const Module &M, const std::string &FS) {
Chris Lattner184cc4a2006-01-27 22:38:36 +000026 // Set the default features.
27 IsV9 = false;
28 V8DeprecatedInsts = false;
29 IsVIS = false;
30
Chris Lattner0d170a72006-01-26 06:51:21 +000031 // Determine default and user specified characteristics
32 std::string CPU = "generic";
33
34 // FIXME: autodetect host here!
Chris Lattner6f630012006-01-30 04:57:43 +000035 CPU = "v9"; // What is a good way to detect V9?
Chris Lattner0d170a72006-01-26 06:51:21 +000036
37 // Parse features string.
38 ParseSubtargetFeatures(FS, CPU);
39
Chris Lattner6f630012006-01-30 04:57:43 +000040 // Unless explicitly enabled, disable the V9 instructions.
41 if (!EnableV9)
42 IsV9 = false;
Chris Lattnerd74ea2b2006-05-24 17:04:05 +000043}