1 //===-- ARMSubtarget.cpp - ARM Subtarget Information ------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by Evan Cheng and is distributed under the
6 // University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements the ARM specific subclass of TargetSubtarget.
12 //===----------------------------------------------------------------------===//
14 #include "ARMSubtarget.h"
15 #include "ARMGenSubtarget.inc"
16 #include "llvm/Module.h"
17 #include "llvm/Support/CommandLine.h"
20 // FIXME: this is temporary.
21 static cl::opt<bool> Thumb("enable-thumb",
22 cl::desc("Switch to thumb mode in ARM backend"));
24 ARMSubtarget::ARMSubtarget(const Module &M, const std::string &FS)
25 : ARMArchVersion(V4T), HasVFP2(false), IsDarwin(false),
26 UseThumbBacktraces(false), IsR9Reserved(false), stackAlignment(8) {
28 // Determine default and user specified characteristics
29 std::string CPU = "generic";
31 // Parse features string.
32 ParseSubtargetFeatures(FS, CPU);
36 // Set the boolean corresponding to the current target triple, or the default
37 // if one cannot be determined, to true.
38 const std::string& TT = M.getTargetTriple();
39 if (TT.length() > 5) {
40 IsDarwin = TT.find("-darwin") != std::string::npos;
41 } else if (TT.empty()) {
42 #if defined(__APPLE__)
48 UseThumbBacktraces = true;