Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ARM] Support -mexecute-only with -mlong-calls.
Instead of using constant pools, use movw movt pair. Differential Revision: https://reviews.llvm.org/D136203
- Loading branch information
1 parent
d30727f
commit 7e8af2f
Showing
4 changed files
with
91 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
llvm/test/CodeGen/Thumb2/thumb2-execute-only-long-calls.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
; RUN: llc < %s -mtriple=thumbv7em-arm-none-eabi -relocation-model=static | FileCheck %s -check-prefixes=CHECK,STATIC | ||
; RUN: llc < %s -mtriple=thumbv7em-arm-none-eabi -relocation-model=rwpi | FileCheck %s -check-prefixes=CHECK,RWPI | ||
|
||
define void @fn() #0 { | ||
entry: | ||
; CHECK-LABEL: fn: | ||
; CHECK: ldr [[REG:r[0-9]+]], .LCPI0_0 | ||
; CHECK-NEXT: blx [[REG]] | ||
; CHECK: .LCPI0_0: | ||
; CHECK-NEXT: .long bar | ||
call void @bar() | ||
ret void | ||
} | ||
|
||
define void @execute_only_fn() #1 { | ||
; STATIC-LABEL: execute_only_fn: | ||
; STATIC: movw [[REG0:r[0-9]+]], :lower16:bar | ||
; STATIC-NEXT: movt [[REG0]], :upper16:bar | ||
; STATIC-NEXT: blx [[REG0]] | ||
; STATIC-NOT: .LCPI0_0: | ||
|
||
; RWPI-LABEL: execute_only_fn: | ||
; RWPI: movw [[REG0:r[0-9]+]], :lower16:bar | ||
; RWPI-NEXT: movt [[REG0]], :upper16:bar | ||
; RWPI-NEXT: blx [[REG0]] | ||
; RWPI-NOT: .LCPI0_0: | ||
entry: | ||
call void @bar() | ||
ret void | ||
} | ||
|
||
attributes #0 = { noinline optnone "target-features"="+thumb-mode,+long-calls" } | ||
attributes #1 = { noinline optnone "target-features"="+execute-only,+thumb-mode,+long-calls" } | ||
|
||
declare dso_local void @bar() |