[llvm-commits] [llvm] r72593 - in /llvm/trunk/lib/Target/ARM: ARM.td ARMInstrInfo.td ARMInstrThumb2.td ARMSubtarget.cpp ARMSubtarget.h
Evan Cheng
evan.cheng at apple.com
Sat May 30 01:07:43 PDT 2009
Hi Anton,
> def IsThumb2 : Predicate<"Subtarget->isThumb2()">;
I don't think we want to distinguish thumb2 from thumb1. Thumb2 is an
ISA extension, it should not be considered a separate ISA from thumb1.
I would think it makes more sense to have just two modes: arm vs thumb
mode. When in thumb mode, if thumb2 ISA is available, then that
implies these instructions are available. How about defining the
predicate IsThumb2 as something like "(Subtarget->isThumb() &&
Subtarget->hasThumb2())"?
What do you think?
Evan
More comments below:
On May 29, 2009, at 4:41 PM, Anton Korobeynikov wrote:
> Author: asl
> Date: Fri May 29 18:41:08 2009
> New Revision: 72593
>
> URL: http://llvm.org/viewvc/llvm-project?rev=72593&view=rev
> Log:
> Add placeholder for thumb2 stuff
>
> Added:
> llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td
> Modified:
> llvm/trunk/lib/Target/ARM/ARM.td
> llvm/trunk/lib/Target/ARM/ARMInstrInfo.td
> llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp
> llvm/trunk/lib/Target/ARM/ARMSubtarget.h
>
> Modified: llvm/trunk/lib/Target/ARM/ARM.td
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARM.td?rev=72593&r1=72592&r2=72593&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/Target/ARM/ARM.td (original)
> +++ llvm/trunk/lib/Target/ARM/ARM.td Fri May 29 18:41:08 2009
> @@ -31,11 +31,13 @@
> 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">;
ThumbMode -> HasThumb2?
"Enable Thumb2 instructions" -> "Supports Thumb2 instructions"?
>
> //
> =
> =
> =
> ----------------------------------------------------------------------=
> ==//
> // ARM Processors supported.
> @@ -90,8 +92,11 @@
> 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
>
> Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.td?rev=72593&r1=72592&r2=72593&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.td (original)
> +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Fri May 29 18:41:08 2009
> @@ -90,11 +90,12 @@
> //
> =
> =
> =
> ----------------------------------------------------------------------=
> ==//
> // 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.
>
> Added: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=72593&view=auto
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (added)
> +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Fri May 29 18:41:08
> 2009
> @@ -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.
> +//
> +//
> =
> =
> =
> ----------------------------------------------------------------------=
> ==//
>
> Modified: llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp?rev=72593&r1=72592&r2=72593&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp (original)
> +++ llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp Fri May 29 18:41:08
> 2009
> @@ -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))
As I said earlier, I don't think this is necessary.
> , UseThumbBacktraces(false)
> , IsR9Reserved(false)
> , stackAlignment(4)
> @@ -36,19 +37,26 @@
> 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;
This is not necessary. We don't want thumb2-foo-bar. We have -
march=arm and -march=thumb, but no -march=thumb2.
> + } else if (SubVer == '5') {
> ARMArchVersion = V5T;
> if (Len >= Idx+3 && TT[Idx+1] == 't' && TT[Idx+2] == 'e')
> ARMArchVersion = V5TE;
>
> Modified: llvm/trunk/lib/Target/ARM/ARMSubtarget.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSubtarget.h?rev=72593&r1=72592&r2=72593&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/Target/ARM/ARMSubtarget.h (original)
> +++ llvm/trunk/lib/Target/ARM/ARMSubtarget.h Fri May 29 18:41:08 2009
> @@ -30,15 +30,21 @@
> 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 @@
> /// 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 @@
> 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; }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list