xref: /llvm-project/flang/include/flang/Optimizer/Builder/Runtime/EnvironmentDefaults.h (revision ecec1311fe0521404a11d6f3b90253259c8c3518)
1 //===-- EnvironmentDefaults.h -----------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // EnvironmentDefaults is a list of default values for environment variables
10 // that may be specified at compile time and set by the runtime during
11 // program startup if the variable is not already present in the environment.
12 // EnvironmentDefaults is intended to allow options controlled by environment
13 // variables to also be set on the command line at compile time without needing
14 // to define option-specific runtime calls or duplicate logic within the
15 // runtime. For example, the -fconvert command line option is implemented in
16 // terms of an default value for the FORT_CONVERT environment variable.
17 
18 #ifndef FORTRAN_OPTIMIZER_BUILDER_RUNTIME_ENVIRONMENTDEFAULTS_H
19 #define FORTRAN_OPTIMIZER_BUILDER_RUNTIME_ENVIRONMENTDEFAULTS_H
20 
21 #include <vector>
22 
23 namespace fir {
24 class FirOpBuilder;
25 class GlobalOp;
26 } // namespace fir
27 
28 namespace mlir {
29 class Location;
30 class Value;
31 } // namespace mlir
32 
33 namespace Fortran::lower {
34 struct EnvironmentDefault;
35 } // namespace Fortran::lower
36 
37 namespace fir::runtime {
38 
39 /// Create the list of environment variable defaults for the runtime to set. The
40 /// form of the generated list is defined in the runtime header file
41 /// environment-default-list.h
42 mlir::Value genEnvironmentDefaults(
43     fir::FirOpBuilder &builder, mlir::Location loc,
44     const std::vector<Fortran::lower::EnvironmentDefault> &envDefaults);
45 
46 } // namespace fir::runtime
47 #endif // FORTRAN_OPTIMIZER_BUILDER_RUNTIME_ENVIRONMENTDEFAULTS_H
48