forked from OSchip/llvm-project
[ARM] Remove FeatureNoARM implies ModeThumb.
Summary:
By removing FeatureNoARM implies ModeThumb, we can detect cases where a
function's target-features contain -thumb-mode (enables ARM codegen for the
function), but the architecture does not support ARM mode. Previously, the
implication caused the FeatureNoARM bit to be cleared for functions with
-thumb-mode, making the assertion in ARMSubtarget::ARMSubtarget [1]
pointless for such functions.
This assertion is the only guard against generating ARM code for
architectures without ARM codegen support. Is there a place where we
could easily generate error messages for the user? At the moment, we
would generate ARM code for Thumb-only architectures. X86 has the same
behavior as ARM, as in it only has an assertion and no error message,
but I think for ARM an error message would be helpful. What do you
think?
For the example below, `llc -mtriple=armv7m-eabi test.ll -o -` will
generate ARM assembler (or fail with an assertion error with this patch).
Note that if we run the resulting assembler through llvm-mc, we get
an appropriate error message, but not when codegen is handled
through clang.
```
define void @bar() #0 {
entry:
ret void
}
attributes #0 = { "target-features"="-thumb-mode" }
```
[1] c1f7b54cef/lib/Target/ARM/ARMSubtarget.cpp (L147)
Reviewers: t.p.northover, rengolin, peter.smith, aadg, silviu.baranga, richard.barton.arm, echristo
Reviewed By: rengolin, echristo
Subscribers: efriedma, aemerson, javed.absar, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35569
llvm-svn: 310476
This commit is contained in:
parent
d9017cc65e
commit
fc4b3951e9
|
@ -341,9 +341,7 @@ def FeatureThumb2 : SubtargetFeature<"thumb2", "HasThumb2", "true",
|
||||||
"Enable Thumb2 instructions">;
|
"Enable Thumb2 instructions">;
|
||||||
|
|
||||||
def FeatureNoARM : SubtargetFeature<"noarm", "NoARM", "true",
|
def FeatureNoARM : SubtargetFeature<"noarm", "NoARM", "true",
|
||||||
"Does not support ARM mode execution",
|
"Does not support ARM mode execution">;
|
||||||
[ModeThumb]>;
|
|
||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// ARM ISAa.
|
// ARM ISAa.
|
||||||
|
@ -504,11 +502,13 @@ def ARMv6kz : Architecture<"armv6kz", "ARMv6kz", [HasV6KOps,
|
||||||
|
|
||||||
def ARMv6m : Architecture<"armv6-m", "ARMv6m", [HasV6MOps,
|
def ARMv6m : Architecture<"armv6-m", "ARMv6m", [HasV6MOps,
|
||||||
FeatureNoARM,
|
FeatureNoARM,
|
||||||
|
ModeThumb,
|
||||||
FeatureDB,
|
FeatureDB,
|
||||||
FeatureMClass]>;
|
FeatureMClass]>;
|
||||||
|
|
||||||
def ARMv6sm : Architecture<"armv6s-m", "ARMv6sm", [HasV6MOps,
|
def ARMv6sm : Architecture<"armv6s-m", "ARMv6sm", [HasV6MOps,
|
||||||
FeatureNoARM,
|
FeatureNoARM,
|
||||||
|
ModeThumb,
|
||||||
FeatureDB,
|
FeatureDB,
|
||||||
FeatureMClass]>;
|
FeatureMClass]>;
|
||||||
|
|
||||||
|
@ -536,6 +536,7 @@ def ARMv7r : Architecture<"armv7-r", "ARMv7r", [HasV7Ops,
|
||||||
def ARMv7m : Architecture<"armv7-m", "ARMv7m", [HasV7Ops,
|
def ARMv7m : Architecture<"armv7-m", "ARMv7m", [HasV7Ops,
|
||||||
FeatureThumb2,
|
FeatureThumb2,
|
||||||
FeatureNoARM,
|
FeatureNoARM,
|
||||||
|
ModeThumb,
|
||||||
FeatureDB,
|
FeatureDB,
|
||||||
FeatureHWDivThumb,
|
FeatureHWDivThumb,
|
||||||
FeatureMClass]>;
|
FeatureMClass]>;
|
||||||
|
@ -543,6 +544,7 @@ def ARMv7m : Architecture<"armv7-m", "ARMv7m", [HasV7Ops,
|
||||||
def ARMv7em : Architecture<"armv7e-m", "ARMv7em", [HasV7Ops,
|
def ARMv7em : Architecture<"armv7e-m", "ARMv7em", [HasV7Ops,
|
||||||
FeatureThumb2,
|
FeatureThumb2,
|
||||||
FeatureNoARM,
|
FeatureNoARM,
|
||||||
|
ModeThumb,
|
||||||
FeatureDB,
|
FeatureDB,
|
||||||
FeatureHWDivThumb,
|
FeatureHWDivThumb,
|
||||||
FeatureMClass,
|
FeatureMClass,
|
||||||
|
@ -598,6 +600,7 @@ def ARMv8r : Architecture<"armv8-r", "ARMv8r", [HasV8Ops,
|
||||||
def ARMv8mBaseline : Architecture<"armv8-m.base", "ARMv8mBaseline",
|
def ARMv8mBaseline : Architecture<"armv8-m.base", "ARMv8mBaseline",
|
||||||
[HasV8MBaselineOps,
|
[HasV8MBaselineOps,
|
||||||
FeatureNoARM,
|
FeatureNoARM,
|
||||||
|
ModeThumb,
|
||||||
FeatureDB,
|
FeatureDB,
|
||||||
FeatureHWDivThumb,
|
FeatureHWDivThumb,
|
||||||
FeatureV7Clrex,
|
FeatureV7Clrex,
|
||||||
|
@ -608,6 +611,7 @@ def ARMv8mBaseline : Architecture<"armv8-m.base", "ARMv8mBaseline",
|
||||||
def ARMv8mMainline : Architecture<"armv8-m.main", "ARMv8mMainline",
|
def ARMv8mMainline : Architecture<"armv8-m.main", "ARMv8mMainline",
|
||||||
[HasV8MMainlineOps,
|
[HasV8MMainlineOps,
|
||||||
FeatureNoARM,
|
FeatureNoARM,
|
||||||
|
ModeThumb,
|
||||||
FeatureDB,
|
FeatureDB,
|
||||||
FeatureHWDivThumb,
|
FeatureHWDivThumb,
|
||||||
Feature8MSecExt,
|
Feature8MSecExt,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# RUN: llc -o - %s -mtriple=arm-arm-none-eabi -mcpu=cortex-m0 -run-pass scavenger-test | FileCheck %s
|
# RUN: llc -o - %s -mtriple=thumb-arm-none-eabi -mcpu=cortex-m0 -run-pass scavenger-test | FileCheck %s
|
||||||
---
|
---
|
||||||
# CHECK-LABEL: name: scavengebug0
|
# CHECK-LABEL: name: scavengebug0
|
||||||
# Make sure we are not spilling/using a physreg used in the very last
|
# Make sure we are not spilling/using a physreg used in the very last
|
||||||
|
|
Loading…
Reference in New Issue