r219735 - ARM: remove ARM/Thumb distinction for preferred alignment.
Eric Christopher
echristo at gmail.com
Tue Oct 14 16:02:05 PDT 2014
Thanks Tim! :)
-eric
On Tue, Oct 14, 2014 at 3:12 PM, Tim Northover <tnorthover at apple.com> wrote:
> Author: tnorthover
> Date: Tue Oct 14 17:12:21 2014
> New Revision: 219735
>
> URL: http://llvm.org/viewvc/llvm-project?rev=219735&view=rev
> Log:
> ARM: remove ARM/Thumb distinction for preferred alignment.
>
> Thumb1 has legitimate reasons for preferring 32-bit alignment of types
> i1/i8/i16, since the 16-bit encoding of "add rD, sp, #imm" requires #imm to be
> a multiple of 4. However, this is a trade-off betweem code size and RAM usage;
> the DataLayout string is not the best place to represent it even if desired.
>
> So this patch removes the extra Thumb requirements, hopefully making ARM and
> Thumb completely compatible in this respect.
>
> Modified:
> cfe/trunk/lib/Basic/Targets.cpp
> cfe/trunk/test/CodeGen/target-data.c
>
> Modified: cfe/trunk/lib/Basic/Targets.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=219735&r1=219734&r2=219735&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Basic/Targets.cpp (original)
> +++ cfe/trunk/lib/Basic/Targets.cpp Tue Oct 14 17:12:21 2014
> @@ -3728,42 +3728,27 @@ class ARMTargetInfo : public TargetInfo
>
> ZeroLengthBitfieldBoundary = 0;
>
> - if (IsThumb) {
> - // Thumb1 add sp, #imm requires the immediate value be multiple of 4,
> - // so set preferred for small types to 32.
> - if (T.isOSBinFormatMachO()) {
> - DescriptionString = BigEndian ?
> - "E-m:o-p:32:32-i1:8:32-i8:8:32-i16:16:32-i64:64-"
> - "v128:64:128-a:0:32-n32-S64" :
> - "e-m:o-p:32:32-i1:8:32-i8:8:32-i16:16:32-i64:64-"
> - "v128:64:128-a:0:32-n32-S64";
> - } else if (T.isOSWindows()) {
> - // FIXME: this is invalid for WindowsCE
> - assert(!BigEndian && "Windows on ARM does not support big endian");
> - DescriptionString = "e"
> - "-m:e"
> - "-p:32:32"
> - "-i1:8:32-i8:8:32-i16:16:32-i64:64"
> - "-v128:64:128"
> - "-a:0:32"
> - "-n32"
> - "-S64";
> - } else {
> - DescriptionString = BigEndian ?
> - "E-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-i64:64-"
> - "v128:64:128-a:0:32-n32-S64" :
> - "e-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-i64:64-"
> - "v128:64:128-a:0:32-n32-S64";
> - }
> + // Thumb1 add sp, #imm requires the immediate value be multiple of 4,
> + // so set preferred for small types to 32.
> + if (T.isOSBinFormatMachO()) {
> + DescriptionString =
> + BigEndian ? "E-m:o-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
> + : "e-m:o-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64";
> + } else if (T.isOSWindows()) {
> + // FIXME: this is invalid for WindowsCE
> + assert(!BigEndian && "Windows on ARM does not support big endian");
> + DescriptionString = "e"
> + "-m:e"
> + "-p:32:32"
> + "-i64:64"
> + "-v128:64:128"
> + "-a:0:32"
> + "-n32"
> + "-S64";
> } else {
> - if (T.isOSBinFormatMachO())
> - DescriptionString =
> - BigEndian ? "E-m:o-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
> - : "e-m:o-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64";
> - else
> - DescriptionString =
> - BigEndian ? "E-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
> - : "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64";
> + DescriptionString =
> + BigEndian ? "E-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
> + : "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64";
> }
>
> // FIXME: Enumerated types are variable width in straight AAPCS.
> @@ -3794,31 +3779,16 @@ class ARMTargetInfo : public TargetInfo
> /// gcc.
> ZeroLengthBitfieldBoundary = 32;
>
> - if (IsThumb) {
> - // Thumb1 add sp, #imm requires the immediate value be multiple of 4,
> - // so set preferred for small types to 32.
> - if (T.isOSBinFormatMachO())
> - DescriptionString = BigEndian ?
> - "E-m:o-p:32:32-i1:8:32-i8:8:32-i16:16:32-f64:32:64"
> - "-v64:32:64-v128:32:128-a:0:32-n32-S32" :
> - "e-m:o-p:32:32-i1:8:32-i8:8:32-i16:16:32-f64:32:64"
> - "-v64:32:64-v128:32:128-a:0:32-n32-S32";
> - else
> - DescriptionString = BigEndian ?
> - "E-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-f64:32:64"
> - "-v64:32:64-v128:32:128-a:0:32-n32-S32" :
> - "e-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-f64:32:64"
> - "-v64:32:64-v128:32:128-a:0:32-n32-S32";
> - } else {
> - if (T.isOSBinFormatMachO())
> - DescriptionString = BigEndian ?
> - "E-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32" :
> - "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32";
> - else
> - DescriptionString = BigEndian ?
> - "E-m:e-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32" :
> - "e-m:e-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32";
> - }
> + if (T.isOSBinFormatMachO())
> + DescriptionString =
> + BigEndian
> + ? "E-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"
> + : "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32";
> + else
> + DescriptionString =
> + BigEndian
> + ? "E-m:e-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"
> + : "e-m:e-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32";
>
> // FIXME: Override "preferred align" for double and long long.
> }
>
> Modified: cfe/trunk/test/CodeGen/target-data.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/target-data.c?rev=219735&r1=219734&r2=219735&view=diff
> ==============================================================================
> --- cfe/trunk/test/CodeGen/target-data.c (original)
> +++ cfe/trunk/test/CodeGen/target-data.c Tue Oct 14 17:12:21 2014
> @@ -128,7 +128,7 @@
>
> // RUN: %clang_cc1 -triple thumb-unknown-gnueabi -o - -emit-llvm %s | \
> // RUN: FileCheck %s -check-prefix=THUMB
> -// THUMB: target datalayout = "e-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-i64:64-v128:64:128-a:0:32-n32-S64"
> +// THUMB: target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
>
> // RUN: %clang_cc1 -triple arm-unknown-gnueabi -o - -emit-llvm %s | \
> // RUN: FileCheck %s -check-prefix=ARM
> @@ -136,7 +136,7 @@
>
> // RUN: %clang_cc1 -triple thumb-unknown -o - -emit-llvm -target-abi apcs-gnu \
> // RUN: %s | FileCheck %s -check-prefix=THUMB-GNU
> -// THUMB-GNU: target datalayout = "e-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"
> +// THUMB-GNU: target datalayout = "e-m:e-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"
>
> // RUN: %clang_cc1 -triple arm-unknown -o - -emit-llvm -target-abi apcs-gnu \
> // RUN: %s | FileCheck %s -check-prefix=ARM-GNU
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list