-
Notifications
You must be signed in to change notification settings - Fork 137
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
Add align pragma for scalar data types (integer, logical, real, complex) #1427
Conversation
Hi @GARRYHU, It appears that our two pull requests(my pr link) contain a lot of code overlap. I am of the opinion that we could work together to extract shared infrastructure and then continue with the subsequent tasks. Are you interested in this? |
Sure, I am glad to do that. |
@GARRYHU Thank you for your PR. As @JiaweiHawk already pointed out, there is probably an opportunity for you two to work together. We have already been reviewing #1360 for quite some time, so I suggest we get that one merged first, then you can submit a new version of this PR that's rebased on top of that one. How does that sound? |
OK, we will work together to make #1360 merged first! |
@GARRYHU @JiaweiHawk Now that #1360 has been merged, what is your plan for this PR? Will you rewrite it based on the latest master branch? |
I'll try to rewrite my part based on the latest master branch next week (after my final exam)! |
@bryanpkc After the refactoring work @JiaweiHawk and I did on #1360, the new version can support not only the alignment of data types like array, but also scalar data types (integer, logical, real, complex). Therefore, I just need to add some testcases for scalar data types on the basis of #1360. I have rebased this PR to add the testcases. |
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.
Note that the sole commit in this PR is only about adding the test cases, not the feature advertised by the PR topic. As the test case looks ok and the regexp used in it seem generic enough, I'm approving it anyway.
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.
LGTM too.
Add support for aligning the first address of scalar data types (integer, logical, real, complex) with align pragma like "!dir$ align n".
For example:
The align pragma enables the first address of variable "a" to be an integer multiple of 128.
The overall idea for this patch is as follows:
do_sw()
ST_VAR
symbol table to store the align valueALIGN_PRAGMA *align_pragma_base
to store all the align pragmas info parsed in the first passlower_symbol()
ST_VAR
symbol table to store the align valueread_symbol()
LL_Object::align_bytes
field with the symbol's align field when creating an LLVM variable objectThis patch can be combined with #1360, which adds align pragma support for derived types and fixed shape array/character types. These two patches enable flang to support align pragma for most common data types.
I test locally through
make check-flang-long
, and also pass some custom tests and add them to the test folder.