12#ifndef FORTRAN_EVALUATE_TARGET_H_
13#define FORTRAN_EVALUATE_TARGET_H_
15#include "flang/Common/Fortran.h"
16#include "flang/Common/enum-class.h"
17#include "flang/Common/enum-set.h"
18#include "flang/Common/target-rounding.h"
19#include "flang/Evaluate/common.h"
24using common::Rounding;
26ENUM_CLASS(IeeeFeature, Denormal, Divide, Flags, Halting, Inf, Io, NaN,
27 Rounding, Sqrt, Standard, Subnormal, UnderflowControl)
29using IeeeFeatures = common::EnumSet<IeeeFeature, 16>;
36 bool isBigEndian()
const {
return isBigEndian_; }
37 void set_isBigEndian(
bool isBig =
true);
39 bool haltingSupportIsUnknownAtCompileTime()
const {
40 return haltingSupportIsUnknownAtCompileTime_;
42 void set_haltingSupportIsUnknownAtCompileTime(
bool yes =
true) {
43 haltingSupportIsUnknownAtCompileTime_ = yes;
46 bool areSubnormalsFlushedToZero()
const {
47 return areSubnormalsFlushedToZero_;
49 void set_areSubnormalsFlushedToZero(
bool yes =
true);
52 bool hasSubnormalFlushingControl(
int kind)
const;
54 bool hasSubnormalFlushingControl(
bool any =
false)
const;
55 void set_hasSubnormalFlushingControl(
int kind,
bool yes =
true);
57 Rounding roundingMode()
const {
return roundingMode_; }
60 void set_ieeeFeature(IeeeFeature ieeeFeature,
bool yes =
true) {
62 ieeeFeatures_.set(ieeeFeature);
64 ieeeFeatures_.reset(ieeeFeature);
68 std::size_t procedurePointerByteSize()
const {
69 return procedurePointerByteSize_;
71 std::size_t procedurePointerAlignment()
const {
72 return procedurePointerAlignment_;
74 std::size_t descriptorAlignment()
const {
return descriptorAlignment_; }
75 std::size_t maxByteSize()
const {
return maxByteSize_; }
76 std::size_t maxAlignment()
const {
return maxAlignment_; }
78 static bool CanSupportType(common::TypeCategory, std::int64_t kind);
79 bool EnableType(common::TypeCategory category, std::int64_t kind,
80 std::size_t byteSize, std::size_t align);
81 void DisableType(common::TypeCategory category, std::int64_t kind);
83 std::size_t GetByteSize(
84 common::TypeCategory category, std::int64_t kind)
const;
85 std::size_t GetAlignment(
86 common::TypeCategory category, std::int64_t kind)
const;
87 bool IsTypeEnabled(common::TypeCategory category, std::int64_t kind)
const;
89 int SelectedIntKind(std::int64_t precision = 0)
const;
90 int SelectedLogicalKind(std::int64_t bits = 1)
const;
91 int SelectedRealKind(std::int64_t precision = 0, std::int64_t range = 0,
92 std::int64_t radix = 2)
const;
96 const std::string &compilerOptionsString()
const {
97 return compilerOptionsString_;
100 compilerOptionsString_ = x;
104 const std::string &compilerVersionString()
const {
105 return compilerVersionString_;
108 compilerVersionString_ = x;
112 bool isPPC()
const {
return isPPC_; }
113 void set_isPPC(
bool isPPC =
false);
115 bool isSPARC()
const {
return isSPARC_; }
116 void set_isSPARC(
bool isSPARC =
false);
118 bool isOSWindows()
const {
return isOSWindows_; }
119 void set_isOSWindows(
bool isOSWindows =
false) {
120 isOSWindows_ = isOSWindows;
123 IeeeFeatures &ieeeFeatures() {
return ieeeFeatures_; }
124 const IeeeFeatures &ieeeFeatures()
const {
return ieeeFeatures_; }
127 static constexpr int maxKind{16};
128 std::uint8_t byteSize_[common::TypeCategory_enumSize][maxKind + 1]{};
129 std::uint8_t align_[common::TypeCategory_enumSize][maxKind + 1]{};
130 bool isBigEndian_{
false};
132 bool isSPARC_{
false};
133 bool isOSWindows_{
false};
134 bool haltingSupportIsUnknownAtCompileTime_{
false};
135 bool areSubnormalsFlushedToZero_{
false};
136 bool hasSubnormalFlushingControl_[maxKind + 1]{};
137 Rounding roundingMode_{defaultRounding};
138 std::size_t procedurePointerByteSize_{8};
139 std::size_t procedurePointerAlignment_{8};
140 std::size_t descriptorAlignment_{8};
141 std::size_t maxByteSize_{8 };
142 std::size_t maxAlignment_{8 };
143 std::string compilerOptionsString_;
144 std::string compilerVersionString_;
145 IeeeFeatures ieeeFeatures_{IeeeFeature::Denormal, IeeeFeature::Divide,
146 IeeeFeature::Flags, IeeeFeature::Inf, IeeeFeature::Io, IeeeFeature::NaN,
147 IeeeFeature::Rounding, IeeeFeature::Sqrt, IeeeFeature::Standard,
148 IeeeFeature::Subnormal, IeeeFeature::UnderflowControl};
Definition: target-rounding.h:18