aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2009-05-29 23:41:08 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2009-05-29 23:41:08 +0000
commitd4022c3fbb0705abdc8eddc3ee4a5059f5ef8094 (patch)
tree58d6cbf11f9a3be932d48a868b47f699738d8b75 /lib/Target
parent3c04296b837e96f1579b4fc8e94cc1d1848ea2aa (diff)
downloadexternal_llvm-d4022c3fbb0705abdc8eddc3ee4a5059f5ef8094.zip
external_llvm-d4022c3fbb0705abdc8eddc3ee4a5059f5ef8094.tar.gz
external_llvm-d4022c3fbb0705abdc8eddc3ee4a5059f5ef8094.tar.bz2
Add placeholder for thumb2 stuff
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72593 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r--lib/Target/ARM/ARM.td15
-rw-r--r--lib/Target/ARM/ARMInstrInfo.td11
-rw-r--r--lib/Target/ARM/ARMInstrThumb2.td12
-rw-r--r--lib/Target/ARM/ARMSubtarget.cpp18
-rw-r--r--lib/Target/ARM/ARMSubtarget.h17
5 files changed, 53 insertions, 20 deletions
diff --git a/lib/Target/ARM/ARM.td b/lib/Target/ARM/ARM.td
index 12789d9..4ac6857 100644
--- a/lib/Target/ARM/ARM.td
+++ b/lib/Target/ARM/ARM.td
@@ -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
diff --git a/lib/Target/ARM/ARMInstrInfo.td b/lib/Target/ARM/ARMInstrInfo.td
index d2e4c34..680e772 100644
--- a/lib/Target/ARM/ARMInstrInfo.td
+++ b/lib/Target/ARM/ARMInstrInfo.td
@@ -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.
diff --git a/lib/Target/ARM/ARMInstrThumb2.td b/lib/Target/ARM/ARMInstrThumb2.td
new file mode 100644
index 0000000..168fb45
--- /dev/null
+++ b/lib/Target/ARM/ARMInstrThumb2.td
@@ -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.
+//
+//===----------------------------------------------------------------------===//
diff --git a/lib/Target/ARM/ARMSubtarget.cpp b/lib/Target/ARM/ARMSubtarget.cpp
index edeea2e..96daca8 100644
--- a/lib/Target/ARM/ARMSubtarget.cpp
+++ b/lib/Target/ARM/ARMSubtarget.cpp
@@ -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;
diff --git a/lib/Target/ARM/ARMSubtarget.h b/lib/Target/ARM/ARMSubtarget.h
index 39e85b0..370817d 100644
--- a/lib/Target/ARM/ARMSubtarget.h
+++ b/lib/Target/ARM/ARMSubtarget.h
@@ -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; }