LLVM API Documentation

SparcSubtarget.cpp

Go to the documentation of this file.
00001 //===- SparcSubtarget.cpp - SPARC Subtarget Information -------------------===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file was developed by Chris Lattner and is distributed under the
00006 // University of Illinois Open Source License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file implements the SPARC specific subclass of TargetSubtarget.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #include "SparcSubtarget.h"
00015 #include "SparcGenSubtarget.inc"
00016 using namespace llvm;
00017 
00018 // FIXME: temporary.
00019 #include "llvm/Support/CommandLine.h"
00020 namespace {
00021   cl::opt<bool> EnableV9("enable-sparc-v9-insts", cl::Hidden,
00022                           cl::desc("Enable V9 instructions in the V8 target"));
00023 }
00024 
00025 SparcSubtarget::SparcSubtarget(const Module &M, const std::string &FS) {
00026   // Set the default features.
00027   IsV9 = false;
00028   V8DeprecatedInsts = false;
00029   IsVIS = false;
00030   
00031   // Determine default and user specified characteristics
00032   std::string CPU = "generic";
00033 
00034   // FIXME: autodetect host here!
00035   CPU = "v9";   // What is a good way to detect V9?
00036   
00037   // Parse features string.
00038   ParseSubtargetFeatures(FS, CPU);
00039 
00040   // Unless explicitly enabled, disable the V9 instructions.
00041   if (!EnableV9)
00042     IsV9 = false;
00043 }