
This patch moves the CommonArgs utilities into a location visible by the Frontend Drivers, so that the Frontend Drivers may share option parsing code with the Compiler Driver. This is useful when the Frontend Drivers would like to verify that their incoming options are well-formed and also not reinvent the option parsing wheel. We already see code in the Clang/Flang Drivers that is parsing and verifying its incoming options. E.g. OPT_ffp_contract. This option is parsed in the Compiler Driver, Clang Driver, and Flang Driver, all with slightly different parsing code. It would be nice if the Frontend Drivers were not required to duplicate this Compiler Driver code. That way there is no/low maintenance burden on keeping all these parsing functions in sync. Along those lines, the Frontend Drivers will now have a useful mechanism to verify their incoming options are well-formed. Currently, the Frontend Drivers trust that the Compiler Driver is not passing back junk in some cases. The Language Drivers may even accept junk with no error at all. E.g.: `clang -cc1 -mprefer-vector-width=junk test.c' With this patch, we'll now be able to tighten up incomming options to the Frontend drivers in a lightweight way. --------- Co-authored-by: Cameron McInally <cmcinally@nvidia.com> Co-authored-by: Shafik Yaghmour <shafik.yaghmour@intel.com>
19 lines
974 B
Fortran
19 lines
974 B
Fortran
! Test that -mprefer-vector-width works as expected.
|
|
|
|
! RUN: %flang_fc1 -emit-llvm -o - %s 2>&1| FileCheck %s --check-prefix=CHECK-DEF
|
|
! RUN: %flang_fc1 -mprefer-vector-width=none -emit-llvm -o - %s 2>&1| FileCheck %s --check-prefixes=CHECK,CHECK-NONE
|
|
! RUN: %flang_fc1 -mprefer-vector-width=128 -emit-llvm -o - %s 2>&1| FileCheck %s --check-prefixes=CHECK,CHECK-128
|
|
! RUN: %flang_fc1 -mprefer-vector-width=256 -emit-llvm -o - %s 2>&1| FileCheck %s --check-prefixes=CHECK,CHECK-256
|
|
! RUN: not %flang_fc1 -mprefer-vector-width=xxx -emit-llvm -o - %s 2>&1| FileCheck %s --check-prefixes=CHECK-INVALID
|
|
|
|
subroutine func
|
|
end subroutine func
|
|
|
|
! CHECK: define {{.+}} @func{{.*}} #[[ATTRS:[0-9]+]]
|
|
! CHECK: attributes #[[ATTRS]] =
|
|
! CHECK-DEF-NOT: "prefer-vector-width"
|
|
! CHECK-NONE-SAME: "prefer-vector-width"="none"
|
|
! CHECK-128-SAME: "prefer-vector-width"="128"
|
|
! CHECK-256-SAME: "prefer-vector-width"="256"
|
|
! CHECK-INVALID: error: invalid value 'xxx' in 'mprefer-vector-width='
|