Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RISCV] Put data smaller than eight bytes to small data section
Because of gp = sdata_start_address + 0x800, gp with signed twelve-bit offset could covert most of the small data section. Linker relaxation could transfer the multiple data accessing instructions to a gp base with signed twelve-bit offset instruction. Differential Revision: https://reviews.llvm.org/D57493 llvm-svn: 358150
- Loading branch information
Showing
8 changed files
with
186 additions
and
0 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
; RUN: llc -mtriple=riscv32 < %s | FileCheck -check-prefix=RV32 %s | ||
; RUN: llc -mtriple=riscv64 < %s | FileCheck -check-prefix=RV64 %s | ||
|
||
@v = dso_local global i32 0, align 4 | ||
@r = dso_local global i64 7, align 8 | ||
|
||
; SmallDataLimit set to 0, so we expect no data will put in sbss and sdata. | ||
!llvm.module.flags = !{!0} | ||
!0 = !{i32 1, !"SmallDataLimit", i32 0} | ||
|
||
; RV32-NOT: .section .sbss | ||
; RV32-NOT: .section .sdata | ||
; RV64-NOT: .section .sbss | ||
; RV64-NOT: .section .sdata |
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,15 @@ | ||
; RUN: llc -mtriple=riscv32 < %s | FileCheck -check-prefix=RV32 %s | ||
; RUN: llc -mtriple=riscv64 < %s | FileCheck -check-prefix=RV64 %s | ||
|
||
@v = dso_local global i32 0, align 4 | ||
@r = dso_local global i64 7, align 8 | ||
|
||
; SmallDataLimit set to 4, so we expect @v will be put in sbss, | ||
; but @r won't be put in sdata. | ||
!llvm.module.flags = !{!0} | ||
!0 = !{i32 1, !"SmallDataLimit", i32 4} | ||
|
||
; RV32: .section .sbss | ||
; RV32-NOT: .section .sdata | ||
; RV64: .section .sbss | ||
; RV64-NOT: .section .sdata |
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,15 @@ | ||
; RUN: llc -mtriple=riscv32 < %s | FileCheck -check-prefix=RV32 %s | ||
; RUN: llc -mtriple=riscv64 < %s | FileCheck -check-prefix=RV64 %s | ||
|
||
@v = dso_local global i32 0, align 4 | ||
@r = dso_local global i64 7, align 8 | ||
|
||
; SmallDataLimit set to 8, so we expect @v will be put in sbss | ||
; and @r will be put in sdata. | ||
!llvm.module.flags = !{!0} | ||
!0 = !{i32 1, !"SmallDataLimit", i32 8} | ||
|
||
; RV32: .section .sbss | ||
; RV32: .section .sdata | ||
; RV64: .section .sbss | ||
; RV64: .section .sdata |
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,16 @@ | ||
; RUN: llc -mtriple=riscv32 < %s | FileCheck -check-prefix=RV32 %s | ||
; RUN: llc -mtriple=riscv64 < %s | FileCheck -check-prefix=RV64 %s | ||
|
||
@v = internal global i32 0, align 4 | ||
@r = internal global i64 7, align 8 | ||
|
||
; @v and @r are local symbols. | ||
; SmallDataLimit set to 8, so we expect @v will be put in sbss | ||
; and @r will be put in sdata. | ||
!llvm.module.flags = !{!0} | ||
!0 = !{i32 1, !"SmallDataLimit", i32 8} | ||
|
||
; RV32: .section .sbss | ||
; RV32: .section .sdata | ||
; RV64: .section .sbss | ||
; RV64: .section .sdata |