2007-01-19 15:51:42 +08:00
|
|
|
//===-- ARMSubtarget.cpp - ARM Subtarget Information ------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-30 04:36:04 +08:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2007-01-19 15:51:42 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file implements the ARM specific subclass of TargetSubtarget.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "ARMSubtarget.h"
|
|
|
|
#include "ARMGenSubtarget.inc"
|
|
|
|
#include "llvm/Module.h"
|
|
|
|
using namespace llvm;
|
|
|
|
|
2007-02-23 11:14:31 +08:00
|
|
|
ARMSubtarget::ARMSubtarget(const Module &M, const std::string &FS, bool thumb)
|
2007-01-20 03:22:40 +08:00
|
|
|
: ARMArchVersion(V4T)
|
|
|
|
, HasVFP2(false)
|
2007-02-23 11:14:31 +08:00
|
|
|
, IsThumb(thumb)
|
2007-01-20 03:22:40 +08:00
|
|
|
, UseThumbBacktraces(false)
|
|
|
|
, IsR9Reserved(false)
|
2007-02-14 03:52:28 +08:00
|
|
|
, stackAlignment(4)
|
|
|
|
, TargetType(isELF) // Default to ELF unless otherwise specified.
|
|
|
|
, TargetABI(ARM_ABI_APCS) {
|
2007-01-19 15:51:42 +08:00
|
|
|
|
|
|
|
// Determine default and user specified characteristics
|
|
|
|
std::string CPU = "generic";
|
|
|
|
|
|
|
|
// Parse features string.
|
|
|
|
ParseSubtargetFeatures(FS, CPU);
|
|
|
|
|
|
|
|
// Set the boolean corresponding to the current target triple, or the default
|
|
|
|
// if one cannot be determined, to true.
|
|
|
|
const std::string& TT = M.getTargetTriple();
|
|
|
|
if (TT.length() > 5) {
|
2007-01-20 03:22:40 +08:00
|
|
|
if (TT.find("-darwin") != std::string::npos)
|
|
|
|
TargetType = isDarwin;
|
2007-01-19 15:51:42 +08:00
|
|
|
} else if (TT.empty()) {
|
|
|
|
#if defined(__APPLE__)
|
2007-01-20 03:22:40 +08:00
|
|
|
TargetType = isDarwin;
|
2007-01-19 15:51:42 +08:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2007-02-14 03:52:28 +08:00
|
|
|
if (TT.find("eabi") != std::string::npos)
|
|
|
|
TargetABI = ARM_ABI_AAPCS;
|
|
|
|
|
|
|
|
if (isAAPCS_ABI())
|
|
|
|
stackAlignment = 8;
|
|
|
|
|
2007-01-20 03:22:40 +08:00
|
|
|
if (isTargetDarwin()) {
|
2007-01-19 15:51:42 +08:00
|
|
|
UseThumbBacktraces = true;
|
|
|
|
IsR9Reserved = true;
|
2007-02-14 03:52:28 +08:00
|
|
|
}
|
2007-01-19 15:51:42 +08:00
|
|
|
}
|