Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions clang/lib/Basic/Targets/Hexagon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ void HexagonTargetInfo::getTargetDefines(const LangOptions &Opts,
Builder.defineMacro("__HVXDBL__");
}

if (HasHVXIeeeFp)
Builder.defineMacro("__HVX_IEEE_FP__");

if (hasFeature("audio")) {
Builder.defineMacro("__HEXAGON_AUDIO__");
}
Expand Down Expand Up @@ -148,6 +151,8 @@ bool HexagonTargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
UseLongCalls = true;
else if (F == "-long-calls")
UseLongCalls = false;
else if (F == "+hvx-ieee-fp")
HasHVXIeeeFp = true;
else if (F == "+audio")
HasAudio = true;
}
Expand Down Expand Up @@ -242,6 +247,7 @@ bool HexagonTargetInfo::hasFeature(StringRef Feature) const {
.Case("hvx", HasHVX)
.Case("hvx-length64b", HasHVX64B)
.Case("hvx-length128b", HasHVX128B)
.Case("hvx-ieee-fp", HasHVXIeeeFp)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this backporting a new feature or is it backporting work already in progress on 22.x?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hvx-ieee-fp feature was introduced in f766bc0 which was available in LLVM 14.0.0.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

.Case("long-calls", UseLongCalls)
.Case("audio", HasAudio)
.Default(false);
Expand Down
1 change: 1 addition & 0 deletions clang/lib/Basic/Targets/Hexagon.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class LLVM_LIBRARY_VISIBILITY HexagonTargetInfo : public TargetInfo {
bool HasHVX = false;
bool HasHVX64B = false;
bool HasHVX128B = false;
bool HasHVXIeeeFp = false;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this changes the ABI of the HexagonTargetInfo class which is exported with library visibility.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class isn't part of the public interface of libclang-cpp, and "library visibility" means "visible only inside the library"; see https://github.com/llvm/llvm-project/blob/llvmorg-22.1.2/llvm/include/llvm/Support/Compiler.h#L107-L154:

LLVM_LIBRARY_VISIBILITY - If a class marked with this attribute is linked into a shared library, then the class should be private to the library and not accessible from outside it.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, thank you for clarifying! It does change the class layout, but not at an expected ABI boundary.

bool HasAudio = false;
bool UseLongCalls = false;

Expand Down
Loading
Loading