2007-01-19 07:51:42 +00:00
|
|
|
//===-- ARMSubtarget.cpp - ARM Subtarget Information ------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:36:04 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2007-01-19 07:51:42 +00: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 03:14:31 +00:00
|
|
|
ARMSubtarget::ARMSubtarget(const Module &M, const std::string &FS, bool thumb)
|
2007-01-19 19:22:40 +00:00
|
|
|
: ARMArchVersion(V4T)
|
|
|
|
, HasVFP2(false)
|
2007-02-23 03:14:31 +00:00
|
|
|
, IsThumb(thumb)
|
2007-01-19 19:22:40 +00:00
|
|
|
, UseThumbBacktraces(false)
|
|
|
|
, IsR9Reserved(false)
|
2007-02-13 19:52:28 +00:00
|
|
|
, stackAlignment(4)
|
|
|
|
, TargetType(isELF) // Default to ELF unless otherwise specified.
|
|
|
|
, TargetABI(ARM_ABI_APCS) {
|
2007-01-19 07:51:42 +00: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-19 19:22:40 +00:00
|
|
|
if (TT.find("-darwin") != std::string::npos)
|
|
|
|
TargetType = isDarwin;
|
2007-01-19 07:51:42 +00:00
|
|
|
} else if (TT.empty()) {
|
|
|
|
#if defined(__APPLE__)
|
2007-01-19 19:22:40 +00:00
|
|
|
TargetType = isDarwin;
|
2007-01-19 07:51:42 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2007-02-13 19:52:28 +00:00
|
|
|
if (TT.find("eabi") != std::string::npos)
|
|
|
|
TargetABI = ARM_ABI_AAPCS;
|
|
|
|
|
|
|
|
if (isAAPCS_ABI())
|
|
|
|
stackAlignment = 8;
|
|
|
|
|
2007-01-19 19:22:40 +00:00
|
|
|
if (isTargetDarwin()) {
|
2007-01-19 07:51:42 +00:00
|
|
|
UseThumbBacktraces = true;
|
|
|
|
IsR9Reserved = true;
|
2007-02-13 19:52:28 +00:00
|
|
|
}
|
2007-01-19 07:51:42 +00:00
|
|
|
}
|