mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 04:26:37 +00:00

This patch implements the -mcmodel flag from clang, allowing the Code Model to be changed for the LLVM module. The same set of mcmodel flags are accepted as in clang and the same Code Model attributes are added to the LLVM module for those flags. Also add `-mlarge-data-threshold` for x86-64, which is automatically set by the shared command-line code (see below). This is also added as an attribute into the LLVM module and on the target machine. A function is created for `addMCModel` that is copied out of clang's argument handling so that it can be shared with flang. --------- Co-authored-by: Mats Petersson <mats.petersson@arm.com>
22 lines
1.1 KiB
Fortran
22 lines
1.1 KiB
Fortran
! REQUIRES: x86-registered-target
|
|
|
|
! RUN: %flang_fc1 -triple x86_64-unknown-unknown -emit-llvm %s -o - -mcmodel=medium | FileCheck %s --check-prefix=IR-DEFAULT
|
|
! RUN: %flang_fc1 -triple x86_64-unknown-unknown -emit-llvm %s -o - -mcmodel=medium -mlarge-data-threshold=200 | FileCheck %s --check-prefix=IR-CUSTOM
|
|
! RUN: %flang_fc1 -triple x86_64-unknown-unknown -emit-llvm %s -o - -mcmodel=large -mlarge-data-threshold=200 | FileCheck %s --check-prefix=IR-CUSTOM
|
|
! RUN: %flang_fc1 -triple x86_64-unknown-unknown -emit-llvm %s -o - -mcmodel=small -mlarge-data-threshold=200 | FileCheck %s --check-prefix=IR-SMALL
|
|
! RUN: %flang_fc1 -triple x86_64-unknown-unknown -S %s -o - -mcmodel=medium -mlarge-data-threshold=200 | FileCheck %s --check-prefix=ASM-SMALL
|
|
! RUN: %flang_fc1 -triple x86_64-unknown-unknown -S %s -o - -mcmodel=medium -mlarge-data-threshold=2 | FileCheck %s --check-prefix=ASM-LARGE
|
|
|
|
! IR-DEFAULT: !{i32 1, !"Large Data Threshold", i64 0}
|
|
! IR-CUSTOM: !{i32 1, !"Large Data Threshold", i64 200}
|
|
! IR-SMALL-NOT: !"Large Data Threshold"
|
|
|
|
! ASM-SMALL-NOT: movabsq
|
|
! ASM-LARGE: movabsq
|
|
|
|
function f
|
|
integer :: f
|
|
integer, save :: i
|
|
f = i
|
|
end function f
|