Add placeholder for thumb2 stuff

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72593 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Anton Korobeynikov 2009-05-29 23:41:08 +00:00
parent 3c04296b83
commit d4022c3fbb
5 changed files with 53 additions and 20 deletions

View File

@ -31,11 +31,13 @@ def ArchV6 : SubtargetFeature<"v6", "ARMArchVersion", "V6",
def ArchV7A : SubtargetFeature<"v7a", "ARMArchVersion", "V7A",
"ARM v7A">;
def FeatureVFP2 : SubtargetFeature<"vfp2", "ARMFPUType", "VFPv2",
"Enable VFP2 instructions ">;
"Enable VFP2 instructions">;
def FeatureVFP3 : SubtargetFeature<"vfp3", "ARMFPUType", "VFPv3",
"Enable VFP3 instructions ">;
"Enable VFP3 instructions">;
def FeatureNEON : SubtargetFeature<"neon", "ARMFPUType", "NEON",
"Enable NEON instructions ">;
"Enable NEON instructions">;
def FeatureThumb2 : SubtargetFeature<"thumb2", "ThumbMode", "Thumb2",
"Enable Thumb2 instructions">;
//===----------------------------------------------------------------------===//
// ARM Processors supported.
@ -90,8 +92,11 @@ def : Proc<"arm1176jzf-s", [ArchV6, FeatureVFP2]>;
def : Proc<"mpcorenovfp", [ArchV6]>;
def : Proc<"mpcore", [ArchV6, FeatureVFP2]>;
def : Proc<"cortex-a8", [ArchV7A, FeatureNEON]>;
def : Proc<"cortex-a9", [ArchV7A, FeatureNEON]>;
def : Proc<"arm1156t2-s", [ArchV6, FeatureThumb2]>;
def : Proc<"arm1156t2f-s", [ArchV6, FeatureThumb2, FeatureVFP2]>;
def : Proc<"cortex-a8", [ArchV7A, FeatureThumb2, FeatureNEON]>;
def : Proc<"cortex-a9", [ArchV7A, FeatureThumb2, FeatureNEON]>;
//===----------------------------------------------------------------------===//
// Register File Description

View File

@ -90,11 +90,12 @@ def ARMeh_sjlj_setjmp: SDNode<"ARMISD::EH_SJLJ_SETJMP", SDT_ARMEH_SJLJ_Setjmp>;
//===----------------------------------------------------------------------===//
// ARM Instruction Predicate Definitions.
//
def HasV5T : Predicate<"Subtarget->hasV5TOps()">;
def HasV5TE : Predicate<"Subtarget->hasV5TEOps()">;
def HasV6 : Predicate<"Subtarget->hasV6Ops()">;
def IsThumb : Predicate<"Subtarget->isThumb()">;
def IsARM : Predicate<"!Subtarget->isThumb()">;
def HasV5T : Predicate<"Subtarget->hasV5TOps()">;
def HasV5TE : Predicate<"Subtarget->hasV5TEOps()">;
def HasV6 : Predicate<"Subtarget->hasV6Ops()">;
def IsThumb : Predicate<"Subtarget->isThumb()">;
def IsThumb2 : Predicate<"Subtarget->isThumb2()">;
def IsARM : Predicate<"!Subtarget->isThumb()">;
//===----------------------------------------------------------------------===//
// ARM Flag Definitions.

View File

@ -0,0 +1,12 @@
//===- ARMInstrThumb2.td - Thumb2 support for ARM -------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file describes the Thumb2 instruction set.
//
//===----------------------------------------------------------------------===//

View File

@ -16,10 +16,11 @@
#include "llvm/Module.h"
using namespace llvm;
ARMSubtarget::ARMSubtarget(const Module &M, const std::string &FS, bool thumb)
ARMSubtarget::ARMSubtarget(const Module &M, const std::string &FS,
bool isThumb)
: ARMArchVersion(V4T)
, ARMFPUType(None)
, IsThumb(thumb)
, ThumbMode((isThumb ? Thumb1 : ThumbNone))
, UseThumbBacktraces(false)
, IsR9Reserved(false)
, stackAlignment(4)
@ -36,19 +37,26 @@ ARMSubtarget::ARMSubtarget(const Module &M, const std::string &FS, bool thumb)
const std::string& TT = M.getTargetTriple();
unsigned Len = TT.length();
unsigned Idx = 0;
if (Len >= 5 && TT.substr(0, 4) == "armv")
Idx = 4;
else if (Len >= 6 && TT.substr(0, 6) == "thumb") {
IsThumb = true;
isThumb = true;
if (Len >= 7 && TT[5] == 'v')
Idx = 6;
}
if (Idx) {
unsigned SubVer = TT[Idx];
if (SubVer > '4' && SubVer <= '9') {
if (SubVer >= '6')
if (SubVer >= '7') {
ARMArchVersion = V7A;
if (isThumb)
ThumbMode = Thumb2;
} else if (SubVer == '6') {
ARMArchVersion = V6;
else if (SubVer == '5') {
if (isThumb && Len >= Idx+3 && TT[Idx+1] == 't' && TT[Idx+2] == '2')
ThumbMode = Thumb2;
} else if (SubVer == '5') {
ARMArchVersion = V5T;
if (Len >= Idx+3 && TT[Idx+1] == 't' && TT[Idx+2] == 'e')
ARMArchVersion = V5TE;

View File

@ -30,15 +30,21 @@ protected:
None, VFPv2, VFPv3, NEON
};
enum ThumbTypeEnum {
ThumbNone,
Thumb1,
Thumb2
};
/// ARMArchVersion - ARM architecture version: V4T (base), V5T, V5TE,
/// V6, V7A.
/// V6, V6T2, V7A.
ARMArchEnum ARMArchVersion;
/// ARMFPUType - Floating Point Unit type.
ARMFPEnum ARMFPUType;
/// IsThumb - True if we are in thumb mode, false if in ARM mode.
bool IsThumb;
/// ThumbMode - ARM if in ARM mode, otherwise indicates Thumb version.
ThumbTypeEnum ThumbMode;
/// UseThumbBacktraces - True if we use thumb style backtraces.
bool UseThumbBacktraces;
@ -66,7 +72,7 @@ protected:
/// This constructor initializes the data members to match that
/// of the specified module.
///
ARMSubtarget(const Module &M, const std::string &FS, bool thumb);
ARMSubtarget(const Module &M, const std::string &FS, bool isThumb);
/// getMaxInlineSizeThreshold - Returns the maximum memset / memcpy size
/// that still makes it profitable to inline the call.
@ -96,7 +102,8 @@ protected:
bool isAPCS_ABI() const { return TargetABI == ARM_ABI_APCS; }
bool isAAPCS_ABI() const { return TargetABI == ARM_ABI_AAPCS; }
bool isThumb() const { return IsThumb; }
bool isThumb() const { return ThumbMode >= Thumb1; }
bool isThumb2() const { return ThumbMode >= Thumb2; }
bool useThumbBacktraces() const { return UseThumbBacktraces; }
bool isR9Reserved() const { return IsR9Reserved; }