Currently clang's medium code model treats all data as large, putting them in a large data section and using more expensive instruction sequences to access them. Following gcc's -mlarge-data-threshold, which allows putting data under a certain size in a normal data section as opposed to a large data section. This allows using cheaper code sequences to access some portion of data in the binary (which will be implemented in LLVM in a future patch). And under the medium codel mode, only put data above the large data threshold into large data sections, not all data. Reviewed By: MaskRay, rnk Differential Revision: https://reviews.llvm.org/D149288
48 lines
2.3 KiB
LLVM
48 lines
2.3 KiB
LLVM
; RUN: llc < %s -relocation-model=pic -filetype=obj -code-model=small -o %t
|
|
; RUN: llvm-readelf -S %t | FileCheck %s --check-prefix=SMALL
|
|
; RUN: llc < %s -relocation-model=pic -filetype=obj -code-model=medium -o %t
|
|
; RUN: llvm-readelf -S %t | FileCheck %s --check-prefix=LARGE
|
|
; RUN: llc < %s -relocation-model=pic -filetype=obj -code-model=medium -large-data-threshold=79 -o %t
|
|
; RUN: llvm-readelf -S %t | FileCheck %s --check-prefix=LARGE
|
|
; RUN: llc < %s -relocation-model=pic -filetype=obj -code-model=medium -large-data-threshold=80 -o %t
|
|
; RUN: llvm-readelf -S %t | FileCheck %s --check-prefix=SMALL
|
|
; RUN: llc < %s -relocation-model=pic -filetype=obj -code-model=large -o %t
|
|
; RUN: llvm-readelf -S %t | FileCheck %s --check-prefix=SMALL
|
|
|
|
; RUN: llc < %s -relocation-model=pic -filetype=obj -code-model=small -data-sections -o %t
|
|
; RUN: llvm-readelf -S %t | FileCheck %s --check-prefix=SMALL-DS
|
|
; RUN: llc < %s -relocation-model=pic -filetype=obj -code-model=medium -data-sections -o %t
|
|
; RUN: llvm-readelf -S %t | FileCheck %s --check-prefix=LARGE-DS
|
|
; RUN: llc < %s -relocation-model=pic -filetype=obj -code-model=large -data-sections -o %t
|
|
; RUN: llvm-readelf -S %t | FileCheck %s --check-prefix=SMALL-DS
|
|
|
|
; SMALL: .data {{.*}} WA {{.*}}
|
|
; SMALL: .bss {{.*}} WA {{.*}}
|
|
; SMALL: .rodata {{.*}} A {{.*}}
|
|
; SMALL: .data.rel.ro {{.*}} WA {{.*}}
|
|
|
|
; SMALL-DS: .data.data {{.*}} WA {{.*}}
|
|
; SMALL-DS: .bss.bss {{.*}} WA {{.*}}
|
|
; SMALL-DS: .rodata.rodata {{.*}} A {{.*}}
|
|
; SMALL-DS: .data.rel.ro.relro {{.*}} WA {{.*}}
|
|
|
|
; LARGE: .ldata {{.*}} WAl {{.*}}
|
|
; LARGE: .lbss {{.*}} WAl {{.*}}
|
|
; LARGE: .lrodata {{.*}} Al {{.*}}
|
|
; LARGE: .ldata.rel.ro {{.*}} WAl {{.*}}
|
|
|
|
; LARGE-DS: .ldata.data {{.*}} WAl {{.*}}
|
|
; LARGE-DS: .lbss.bss {{.*}} WAl {{.*}}
|
|
; LARGE-DS: .lrodata.rodata {{.*}} Al {{.*}}
|
|
; LARGE-DS: .ldata.rel.ro.relro {{.*}} WAl {{.*}}
|
|
|
|
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
|
target triple = "x86_64--linux"
|
|
|
|
@data = internal global [10 x i64] [i64 1, i64 2, i64 0, i64 0, i64 0, i64 0, i64 0, i64 0, i64 0, i64 0]
|
|
@bss = internal global [10 x i64] zeroinitializer
|
|
@rodata = internal constant [10 x i64] zeroinitializer
|
|
@relro = internal constant [10 x ptr] [ptr @func, ptr @func, ptr @func, ptr @func, ptr @func, ptr @func, ptr @func, ptr @func, ptr @func, ptr @func]
|
|
|
|
declare void @func()
|