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