-
Notifications
You must be signed in to change notification settings - Fork 322
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
[lldb] Make GetClangTypeNode aware of SIMD types. #3322
base: stable/20210726
Are you sure you want to change the base?
[lldb] Make GetClangTypeNode aware of SIMD types. #3322
Conversation
The compiler has some special handling for SIMD types, implement the same rules on TypeSystemSwiftTypeRef on GetClangTypeNode.
479e65a
to
ddcaae6
Compare
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.
Thanks!
|
||
// Check if this is a SIMD type. For a vector this is something like | ||
// type __attribute__((ext_vector_type(dimension))). | ||
if (!clang_name.contains("__attribute__((ext_vector_type")) |
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.
Maybe it would be cleaner to use ClangUtil::GetQualType(clang_type)->hasAttr()
?
// kind=Structure | ||
// kind=Module, text="Swift" | ||
// kind=Identifier, text="Type" | ||
NodePointer element_type_node = |
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.
Maybe factor out a static DemangleNode* GetBoundGenericStruct(Name, TypeParam)
?
NodePointer type_list = dem.createNode(Node::Kind::TypeList); | ||
type_list->addChild(element_type_node, dem); | ||
NodePointer identifier = | ||
dem.createNode(Node::Kind::Identifier, "SIMD" + std::to_string(size)); |
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.
This is a micro-optimization that will not matter, but we could do this with fewer memory allocations by using
SmallString<6> name;
llvm::raw_string_ostream(name)<<"SIMD"<<size;
// Check if this is a SIMD type. SIMD structs are matrixes, and they're | ||
// in the format simd_typeNxN. | ||
// Regex: start with simd_ and end with NxN. | ||
std::regex simd_matrix_recognizer("^simd_.*[0-9]+x[0-9]+"); |
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.
IIRC, there was some supported platform that didn't have a regex implementation. Maybe grep for regex in the lldb sources. If there is no comment about it there then this is probably no longer an issue.
The compiler has some special handling for SIMD types, implement the
same rules on TypeSystemSwiftTypeRef on GetClangTypeNode.