Skip to content
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

Use convert-to-llvm pass for conversions to LLVMIR Dialect #1679

Open
wants to merge 14 commits into
base: target_attr
Choose a base branch
from

Conversation

umangyadav
Copy link
Member

@umangyadav umangyadav commented Oct 9, 2024

This is more of a refactor and WIP. Would require some discussions with upstream.
Depends on #1666

cc: @fabianmcg

@umangyadav umangyadav requested a review from krzysz00 October 9, 2024 18:38
@umangyadav umangyadav changed the base branch from develop to target_attr October 9, 2024 18:48
Copy link
Collaborator

@krzysz00 krzysz00 left a comment

Choose a reason for hiding this comment

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

Overall, approved

However, I'm not checking the box because I think this set of changes should be sent upstream first and then backported to us

@umangyadav umangyadav marked this pull request as ready for review October 9, 2024 20:31
Copy link
Collaborator

@krzysz00 krzysz00 left a comment

Choose a reason for hiding this comment

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

Re the utility function I was considering, now that I've looked at the structure of the code, I'm seeing another approach, one which'll make ConvertToLLVM less special.

Specifically, take that addTypeAttributeConversion() call and move it into the constructor for LLVMTypeConverter ... and have it take the Attribute -> uint32_t map as an element of LowerToLLVMOptions .

(While doing that, I'd go ahead and extend the DataLayout class with a getEntries() sort of iterator so you can loop through all the entries in that cache)

That way, anyone constructing their LowerToLLVMOptions() with a DataLayoutAnalysis automatically gets this functionality.

auto typeConverter = std::make_shared<LLVMTypeConverter>(context, options);

DenseMap<Attribute, uint64_t> addressSpaceMap;
if (DataLayoutOpInterface iface = dyn_cast<DataLayoutOpInterface>(op)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is another usage of getAtOrAbove()

Copy link
Collaborator

Choose a reason for hiding this comment

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

... no, it isn't, but it could be, if DataLayout (the class) grew a method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants