FLANG
LangOptions.h
1//===-- include/flang/Support/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_SUPPORT_LANGOPTIONS_H_
16#define FORTRAN_SUPPORT_LANGOPTIONS_H_
17
18#include <string>
19#include <vector>
20
21#include "llvm/Frontend/OpenMP/OMPVersion.h"
22#include "llvm/TargetParser/Triple.h"
23
24namespace Fortran::common {
25
29
30public:
31 enum SignedOverflowBehaviorTy {
32 // -fno-wrapv (default behavior in Flang)
33 SOB_Undefined,
34
35 // -fwrapv
36 SOB_Defined,
37 };
38
39 enum FPModeKind {
40 // Do not fuse FP ops
41 FPM_Off,
42
43 // Aggressively fuse FP ops (E.g. FMA).
44 FPM_Fast,
45 };
46
50 enum FPExceptionTrapKind : unsigned {
51 FPE_Invalid = 1,
52 FPE_Denormal = 2,
53 FPE_DivByZero = 4,
54 FPE_Overflow = 8,
55 FPE_Underflow = 16,
56 FPE_Inexact = 32,
57 };
58
59#define LANGOPT(Name, Bits, Default) unsigned Name : Bits;
60#define ENUM_LANGOPT(Name, Type, Bits, Default)
61#include "LangOptions.def"
62
63protected:
64#define LANGOPT(Name, Bits, Default)
65#define ENUM_LANGOPT(Name, Type, Bits, Default) unsigned Name : Bits;
66#include "LangOptions.def"
67};
68
71class LangOptions : public LangOptionsBase {
72
73public:
74 // Define accessors/mutators for code generation options of enumeration type.
75#define LANGOPT(Name, Bits, Default)
76#define ENUM_LANGOPT(Name, Type, Bits, Default) \
77 Type get##Name() const { return static_cast<Type>(Name); } \
78 void set##Name(Type Value) { \
79 assert(static_cast<unsigned>(Value) < (1u << Bits)); \
80 Name = static_cast<unsigned>(Value); \
81 }
82#include "LangOptions.def"
83
86 std::string OMPHostIRFile;
87
89 std::vector<llvm::Triple> OMPTargetTriples;
90
91 llvm::omp::Version getOpenMPVersion() const {
92 return llvm::omp::Version(OpenMPVersion);
93 }
94
96};
97
98} // end namespace Fortran::common
99
100#endif // FORTRAN_SUPPORT_LANGOPTIONS_H_
Definition LangOptions.h:28
FPExceptionTrapKind
Definition LangOptions.h:50
Definition LangOptions.h:71
std::vector< llvm::Triple > OMPTargetTriples
List of triples passed in using -fopenmp-targets.
Definition LangOptions.h:89
std::string OMPHostIRFile
signed integer overflow handling
Definition LangOptions.h:86
Definition bit-population-count.h:20