From d4022c3fbb0705abdc8eddc3ee4a5059f5ef8094 Mon Sep 17 00:00:00 2001 From: Anton Korobeynikov Date: Fri, 29 May 2009 23:41:08 +0000 Subject: [PATCH] Add placeholder for thumb2 stuff git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72593 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARM.td | 15 ++++++++++----- lib/Target/ARM/ARMInstrInfo.td | 11 ++++++----- lib/Target/ARM/ARMInstrThumb2.td | 12 ++++++++++++ lib/Target/ARM/ARMSubtarget.cpp | 18 +++++++++++++----- lib/Target/ARM/ARMSubtarget.h | 17 ++++++++++++----- 5 files changed, 53 insertions(+), 20 deletions(-) create mode 100644 lib/Target/ARM/ARMInstrThumb2.td diff --git a/lib/Target/ARM/ARM.td b/lib/Target/ARM/ARM.td index 12789d93ee6..4ac6857d22d 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 d2e4c34e9cf..680e77234db 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 00000000000..168fb45f11e --- /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 edeea2ef876..96daca8067d 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 39e85b02cee..370817d59c7 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; } -- 2.34.1