Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions flang/include/flang/Evaluate/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ class TargetCharacteristics {
IeeeFeatures &ieeeFeatures() { return ieeeFeatures_; }
const IeeeFeatures &ieeeFeatures() const { return ieeeFeatures_; }

std::size_t pointerSize() { return pointerSize_; }
void set_pointerSize(std::size_t pointerSize) { pointerSize_ = pointerSize; }

private:
static constexpr int maxKind{common::maxKind};
std::uint8_t byteSize_[common::TypeCategory_enumSize][maxKind + 1]{};
Expand All @@ -156,6 +159,7 @@ class TargetCharacteristics {
IeeeFeature::Io, IeeeFeature::NaN, IeeeFeature::Rounding,
IeeeFeature::Sqrt, IeeeFeature::Standard, IeeeFeature::Subnormal,
IeeeFeature::UnderflowControl};
std::size_t pointerSize_{8 /* bytes */};
};

} // namespace Fortran::evaluate
Expand Down
3 changes: 3 additions & 0 deletions flang/include/flang/Tools/TargetSetup.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ namespace Fortran::tools {
if (targetTriple.isOSWindows())
targetCharacteristics.set_isOSWindows(true);

targetCharacteristics.set_pointerSize(
targetTriple.getArchPointerBitWidth() / 8);

// TODO: use target machine data layout to set-up the target characteristics
// type size and alignment info.
}
Expand Down
2 changes: 1 addition & 1 deletion flang/lib/Semantics/resolve-names.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6690,7 +6690,7 @@ void DeclarationVisitor::Post(const parser::BasedPointer &bp) {
}
pointer->set(Symbol::Flag::CrayPointer);
const DeclTypeSpec &pointerType{MakeNumericType(
TypeCategory::Integer, context().defaultKinds().subscriptIntegerKind())};
TypeCategory::Integer, context().targetCharacteristics().pointerSize())};
const auto *type{pointer->GetType()};
if (!type) {
pointer->SetType(pointerType);
Expand Down
Loading