-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[Reland] [PowerPC] frontend get target feature from backend with cpu name #144594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2d0f536
67f239f
7df292d
c92ac11
ccc594c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,8 @@ | |
#ifndef LLVM_TARGETPARSER_TARGETPARSER_H | ||
#define LLVM_TARGETPARSER_TARGETPARSER_H | ||
|
||
#include "SubtargetFeature.h" | ||
#include "llvm/ADT/ArrayRef.h" | ||
#include "llvm/ADT/StringMap.h" | ||
#include "llvm/ADT/StringRef.h" | ||
#include "llvm/Support/Compiler.h" | ||
|
@@ -190,6 +192,31 @@ insertWaveSizeFeature(StringRef GPU, const Triple &T, | |
StringMap<bool> &Features); | ||
|
||
} // namespace AMDGPU | ||
|
||
struct BasicSubtargetFeatureKV { | ||
const char *Key; ///< K-V key string | ||
unsigned Value; ///< K-V integer value | ||
FeatureBitArray Implies; ///< K-V bit mask | ||
}; | ||
|
||
/// Used to provide key value pairs for feature and CPU bit flags. | ||
struct BasicSubtargetSubTypeKV { | ||
const char *Key; ///< K-V key string | ||
FeatureBitArray Implies; ///< K-V bit mask | ||
|
||
/// Compare routine for std::lower_bound | ||
bool operator<(StringRef S) const { return StringRef(Key) < S; } | ||
|
||
/// Compare routine for std::is_sorted. | ||
bool operator<(const BasicSubtargetSubTypeKV &Other) const { | ||
return StringRef(Key) < StringRef(Other.Key); | ||
} | ||
}; | ||
Comment on lines
+196
to
+214
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be better to move There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point. However, the patch is already quite large. I think it would be better to handle this in a separate NFC patch later. That said, if you strongly recommend it, I can include it in the current patch. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given this is a reland, sure, I'm happy for you to do this refactor later. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried to create NFC patch, which move but there is a data member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. That's quite annoying, I wonder if there's a better way of factoring these very similar definitions, in the hope we can maybe pull out |
||
|
||
std::optional<llvm::StringMap<bool>> | ||
getCPUDefaultTargetFeatures(StringRef CPU, | ||
ArrayRef<BasicSubtargetSubTypeKV> ProcDesc, | ||
ArrayRef<BasicSubtargetFeatureKV> ProcFeatures); | ||
} // namespace llvm | ||
|
||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: up to now, the tablegen blocks were alphabetical by .td file name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the other generated .inc files here don't have "Gen" in their name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Entries in the CMakeLists.txt are ordered based on the tablegen option.
As I know, some tablegen option use Gen in their name for example:
llvm/lib/Target/PowerPC/CMakeLists.txt
llvm/lib/Target/X86/CMakeLists.txt