32class TargetCharacteristics {
34 TargetCharacteristics();
35 TargetCharacteristics &operator=(
const TargetCharacteristics &) =
default;
37 bool isBigEndian()
const {
return isBigEndian_; }
38 void set_isBigEndian(
bool isBig =
true);
40 bool haltingSupportIsUnknownAtCompileTime()
const {
41 return haltingSupportIsUnknownAtCompileTime_;
43 void set_haltingSupportIsUnknownAtCompileTime(
bool yes =
true) {
44 haltingSupportIsUnknownAtCompileTime_ = yes;
47 bool areSubnormalsFlushedToZero()
const {
48 return areSubnormalsFlushedToZero_;
50 void set_areSubnormalsFlushedToZero(
bool yes =
true);
53 bool hasSubnormalFlushingControl(
int kind)
const;
55 bool hasSubnormalFlushingControl(
bool any =
false)
const;
56 void set_hasSubnormalFlushingControl(
int kind,
bool yes =
true);
60 bool hasSubnormalExceptionSupport(
int kind)
const;
62 bool hasSubnormalExceptionSupport()
const;
63 void set_hasSubnormalExceptionSupport(
int kind,
bool yes =
true);
65 Rounding roundingMode()
const {
return roundingMode_; }
68 void set_ieeeFeature(IeeeFeature ieeeFeature,
bool yes =
true) {
70 ieeeFeatures_.set(ieeeFeature);
72 ieeeFeatures_.reset(ieeeFeature);
76 std::size_t procedurePointerByteSize()
const {
77 return procedurePointerByteSize_;
79 std::size_t procedurePointerAlignment()
const {
80 return procedurePointerAlignment_;
82 std::size_t descriptorAlignment()
const {
return descriptorAlignment_; }
83 std::size_t maxByteSize()
const {
return maxByteSize_; }
84 std::size_t maxAlignment()
const {
return maxAlignment_; }
86 static bool CanSupportType(common::TypeCategory, std::int64_t kind);
87 bool EnableType(common::TypeCategory category, std::int64_t kind,
88 std::size_t byteSize, std::size_t align);
89 void DisableType(common::TypeCategory category, std::int64_t kind);
91 std::size_t GetByteSize(
92 common::TypeCategory category, std::int64_t kind)
const;
93 std::size_t GetAlignment(
94 common::TypeCategory category, std::int64_t kind)
const;
95 bool IsTypeEnabled(common::TypeCategory category, std::int64_t kind)
const;
97 int SelectedIntKind(std::int64_t precision = 0)
const;
98 int SelectedLogicalKind(std::int64_t bits = 1)
const;
99 int SelectedRealKind(std::int64_t precision = 0, std::int64_t range = 0,
100 std::int64_t radix = 2)
const;
104 const std::string &compilerOptionsString()
const {
105 return compilerOptionsString_;
107 TargetCharacteristics &set_compilerOptionsString(std::string x) {
108 compilerOptionsString_ = x;
112 const std::string &compilerVersionString()
const {
113 return compilerVersionString_;
115 TargetCharacteristics &set_compilerVersionString(std::string x) {
116 compilerVersionString_ = x;
120 bool isPPC()
const {
return isPPC_; }
121 void set_isPPC(
bool isPPC =
false);
123 bool isSPARC()
const {
return isSPARC_; }
124 void set_isSPARC(
bool isSPARC =
false);
126 bool isOSWindows()
const {
return isOSWindows_; }
127 void set_isOSWindows(
bool isOSWindows =
false) {
128 isOSWindows_ = isOSWindows;
131 IeeeFeatures &ieeeFeatures() {
return ieeeFeatures_; }
132 const IeeeFeatures &ieeeFeatures()
const {
return ieeeFeatures_; }
134 std::size_t integerKindForPointer() {
return integerKindForPointer_; }
135 void set_integerKindForPointer(std::size_t newKind) {
136 integerKindForPointer_ = newKind;
140 static constexpr int maxKind{common::maxKind};
141 std::uint8_t byteSize_[common::TypeCategory_enumSize][maxKind + 1]{};
142 std::uint8_t align_[common::TypeCategory_enumSize][maxKind + 1]{};
143 bool isBigEndian_{
false};
145 bool isSPARC_{
false};
146 bool isOSWindows_{
false};
147 bool haltingSupportIsUnknownAtCompileTime_{
false};
148 bool areSubnormalsFlushedToZero_{
false};
149 bool hasSubnormalFlushingControl_[maxKind + 1]{};
150 bool hasSubnormalExceptionSupport_[maxKind + 1]{};
151 Rounding roundingMode_{defaultRounding};
152 std::size_t procedurePointerByteSize_{8};
153 std::size_t procedurePointerAlignment_{8};
154 std::size_t descriptorAlignment_{8};
155 std::size_t maxByteSize_{8 };
156 std::size_t maxAlignment_{8 };
157 std::string compilerOptionsString_;
158 std::string compilerVersionString_;
159 IeeeFeatures ieeeFeatures_{IeeeFeature::Denormal, IeeeFeature::Divide,
160 IeeeFeature::Flags, IeeeFeature::Halting, IeeeFeature::Inf,
161 IeeeFeature::Io, IeeeFeature::NaN, IeeeFeature::Rounding,
162 IeeeFeature::Sqrt, IeeeFeature::Standard, IeeeFeature::Subnormal,
163 IeeeFeature::UnderflowControl};
164 std::size_t integerKindForPointer_{8};