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"
19 ARMSubtarget::ARMSubtarget(const Module
&M
, const std::string
&FS
, bool thumb
)
23 , UseThumbBacktraces(false)
26 , TargetType(isELF
) // Default to ELF unless otherwise specified.
27 , TargetABI(ARM_ABI_APCS
) {
29 // Determine default and user specified characteristics
30 std::string CPU
= "generic";
32 // Parse features string.
33 ParseSubtargetFeatures(FS
, CPU
);
35 // Set the boolean corresponding to the current target triple, or the default
36 // if one cannot be determined, to true.
37 const std::string
& TT
= M
.getTargetTriple();
38 if (TT
.length() > 5) {
39 if (TT
.find("-darwin") != std::string::npos
)
40 TargetType
= isDarwin
;
41 } else if (TT
.empty()) {
42 #if defined(__APPLE__)
43 TargetType
= isDarwin
;
47 if (TT
.find("eabi") != std::string::npos
)
48 TargetABI
= ARM_ABI_AAPCS
;
53 if (isTargetDarwin()) {
54 UseThumbBacktraces
= true;