Warning: This file is not a C or C++ file. It does not have highlighting.
1 | //===------ LangOptions.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 | // This file defines the LangOptions interface, which holds the |
10 | // configuration for LLVM's middle-end and back-end. It controls LLVM's code |
11 | // generation into assembly or machine code. |
12 | // |
13 | //===----------------------------------------------------------------------===// |
14 | |
15 | #ifndef FORTRAN_FRONTEND_LANGOPTIONS_H |
16 | #define FORTRAN_FRONTEND_LANGOPTIONS_H |
17 | |
18 | #include <string> |
19 | |
20 | namespace Fortran::frontend { |
21 | |
22 | /// Bitfields of LangOptions, split out from LangOptions to ensure |
23 | /// that this large collection of bitfields is a trivial class type. |
24 | class LangOptionsBase { |
25 | |
26 | public: |
27 | enum FPModeKind { |
28 | // Do not fuse FP ops |
29 | FPM_Off, |
30 | |
31 | // Aggressively fuse FP ops (E.g. FMA). |
32 | FPM_Fast, |
33 | }; |
34 | |
35 | #define LANGOPT(Name, Bits, Default) unsigned Name : Bits; |
36 | #define ENUM_LANGOPT(Name, Type, Bits, Default) |
37 | #include "flang/Frontend/LangOptions.def" |
38 | |
39 | protected: |
40 | #define LANGOPT(Name, Bits, Default) |
41 | #define ENUM_LANGOPT(Name, Type, Bits, Default) unsigned Name : Bits; |
42 | #include "flang/Frontend/LangOptions.def" |
43 | }; |
44 | |
45 | /// Tracks various options which control the dialect of Fortran that is |
46 | /// accepted. Based on clang::LangOptions |
47 | class LangOptions : public LangOptionsBase { |
48 | |
49 | public: |
50 | // Define accessors/mutators for code generation options of enumeration type. |
51 | #define LANGOPT(Name, Bits, Default) |
52 | #define ENUM_LANGOPT(Name, Type, Bits, Default) \ |
53 | Type get##Name() const { return static_cast<Type>(Name); } \ |
54 | void set##Name(Type Value) { Name = static_cast<unsigned>(Value); } |
55 | #include "flang/Frontend/LangOptions.def" |
56 | |
57 | /// Name of the IR file that contains the result of the OpenMP target |
58 | /// host code generation. |
59 | std::string OMPHostIRFile; |
60 | |
61 | LangOptions(); |
62 | }; |
63 | |
64 | } // end namespace Fortran::frontend |
65 | |
66 | #endif // FORTRAN_FRONTEND_LANGOPTIONS_H |
67 |
Warning: This file is not a C or C++ file. It does not have highlighting.