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
46#define LANGOPT(Name, Bits, Default) unsigned Name : Bits;
47#define ENUM_LANGOPT(Name, Type, Bits, Default)
48#include "LangOptions.def"
49
50protected:
51#define LANGOPT(Name, Bits, Default)
52#define ENUM_LANGOPT(Name, Type, Bits, Default) unsigned Name : Bits;
53#include "LangOptions.def"
54};
55
58class LangOptions : public LangOptionsBase {
59
60public:
61 // Define accessors/mutators for code generation options of enumeration type.
62#define LANGOPT(Name, Bits, Default)
63#define ENUM_LANGOPT(Name, Type, Bits, Default) \
64 Type get##Name() const { return static_cast<Type>(Name); } \
65 void set##Name(Type Value) { \
66 assert(static_cast<unsigned>(Value) < (1u << Bits)); \
67 Name = static_cast<unsigned>(Value); \
68 }
69#include "LangOptions.def"
70
73 std::string OMPHostIRFile;
74
76 std::vector<llvm::Triple> OMPTargetTriples;
77
78 LangOptions();
79};
80
81} // end namespace Fortran::common
82
83#endif // FORTRAN_SUPPORT_LANGOPTIONS_H_
Definition LangOptions.h:27
std::vector< llvm::Triple > OMPTargetTriples
List of triples passed in using -fopenmp-targets.
Definition LangOptions.h:76
std::string OMPHostIRFile
signed integer overflow handling
Definition LangOptions.h:73
Definition bit-population-count.h:20