Chris Lattner | 7c90f73 | 2006-02-05 05:50:24 +0000 | [diff] [blame^] | 1 | //===- SparcSubtarget.cpp - SPARC Subtarget Information -------------------===// |
Chris Lattner | 0d170a7 | 2006-01-26 06:51:21 +0000 | [diff] [blame] | 2 | // |
| 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 Lattner | 7c90f73 | 2006-02-05 05:50:24 +0000 | [diff] [blame^] | 14 | #include "SparcSubtarget.h" |
| 15 | #include "SparcGenSubtarget.inc" |
Chris Lattner | 0d170a7 | 2006-01-26 06:51:21 +0000 | [diff] [blame] | 16 | using namespace llvm; |
| 17 | |
Chris Lattner | 6f63001 | 2006-01-30 04:57:43 +0000 | [diff] [blame] | 18 | // FIXME: temporary. |
| 19 | #include "llvm/Support/CommandLine.h" |
| 20 | namespace { |
| 21 | cl::opt<bool> EnableV9("enable-sparc-v9-insts", cl::Hidden, |
| 22 | cl::desc("Enable V9 instructions in the V8 target")); |
| 23 | } |
| 24 | |
Chris Lattner | 7c90f73 | 2006-02-05 05:50:24 +0000 | [diff] [blame^] | 25 | SparcSubtarget::SparcSubtarget(const Module &M, const std::string &FS) { |
Chris Lattner | 184cc4a | 2006-01-27 22:38:36 +0000 | [diff] [blame] | 26 | // Set the default features. |
| 27 | IsV9 = false; |
| 28 | V8DeprecatedInsts = false; |
| 29 | IsVIS = false; |
| 30 | |
Chris Lattner | 0d170a7 | 2006-01-26 06:51:21 +0000 | [diff] [blame] | 31 | // Determine default and user specified characteristics |
| 32 | std::string CPU = "generic"; |
| 33 | |
| 34 | // FIXME: autodetect host here! |
Chris Lattner | 6f63001 | 2006-01-30 04:57:43 +0000 | [diff] [blame] | 35 | CPU = "v9"; // What is a good way to detect V9? |
Chris Lattner | 0d170a7 | 2006-01-26 06:51:21 +0000 | [diff] [blame] | 36 | |
| 37 | // Parse features string. |
| 38 | ParseSubtargetFeatures(FS, CPU); |
| 39 | |
Chris Lattner | 6f63001 | 2006-01-30 04:57:43 +0000 | [diff] [blame] | 40 | // Unless explicitly enabled, disable the V9 instructions. |
| 41 | if (!EnableV9) |
| 42 | IsV9 = false; |
Chris Lattner | 4dcfaac | 2006-01-26 07:22:22 +0000 | [diff] [blame] | 43 | }; |