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

[InlineAsm] refactor InlineAsm class NFC #65649

Merged
merged 7 commits into from
Sep 11, 2023

Conversation

nickdesaulniers
Copy link
Member

I would like to steal one of these bits to denote whether a kind may be
spilled by the register allocator or not, but I'm afraid to touch of any
this code using bitwise operands.

Make flags a first class type using bitfields, rather than launder data
around via unsigned.

I would like to steal one of these bits to denote whether a kind may be
spilled by the register allocator or not, but I'm afraid to touch of any
this code using bitwise operands.

Make flags a first class type using bitfields, rather than launder data
around via `unsigned`.
llvm/include/llvm/IR/InlineAsm.h Outdated Show resolved Hide resolved
llvm/include/llvm/IR/InlineAsm.h Outdated Show resolved Hide resolved
llvm/include/llvm/IR/InlineAsm.h Outdated Show resolved Hide resolved
Copy link
Collaborator

@bwendling bwendling left a comment

Choose a reason for hiding this comment

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

Please run git clang-format on this change.

llvm/include/llvm/IR/InlineAsm.h Outdated Show resolved Hide resolved
llvm/include/llvm/IR/InlineAsm.h Outdated Show resolved Hide resolved
llvm/include/llvm/IR/InlineAsm.h Outdated Show resolved Hide resolved
llvm/include/llvm/IR/InlineAsm.h Outdated Show resolved Hide resolved
llvm/lib/Target/CSKY/CSKYISelDAGToDAG.cpp Outdated Show resolved Hide resolved
@@ -241,6 +225,7 @@ class InlineAsm final : public Value {
// Addresses are included here as they need to be treated the same by the
// backend, the only difference is that they are not used to actaully
// access memory by the instruction.
// TODO: convert to enum?
Copy link
Member

Choose a reason for hiding this comment

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

+1.

Copy link
Member Author

Choose a reason for hiding this comment

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

If it's ok with you, I'd prefer to do this in a distinct PR, akin to:

commit 2fad6e6 ("[InlineAsm] wrap Kind in enum class NFC")

llvm/include/llvm/IR/InlineAsm.h Outdated Show resolved Hide resolved
@nickdesaulniers
Copy link
Member Author

nickdesaulniers commented Sep 7, 2023

Please run git clang-format on this change.

oh yeah! done. Huh, I miss arc diff warning me about that...

@nickdesaulniers
Copy link
Member Author

Ok, thanks all for the reviews+comments+feedback thus far. I think I've addressed everything; this should be ready for another round of reviews.

@cor3ntin cor3ntin added llvm:SelectionDAG SelectionDAGISel as well and removed llvm:SelectionDAGP labels Sep 9, 2023
Copy link
Collaborator

@qcolombet qcolombet left a comment

Choose a reason for hiding this comment

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

Nice clean-up!
Thanks.

Copy link
Member

@jyknight jyknight left a comment

Choose a reason for hiding this comment

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

Just a sidenote: multiple overlapping Bitfield::Element could be used for "Data", if desired. I don't think it matters here, so approving as is. But, it would be useful if we wanted to add additional fields for only some of the options later (e.g. Mem Constraint code doesn't need as many bits as it's given, so other data could fit next to it in that case).

@nickdesaulniers
Copy link
Member Author

nickdesaulniers commented Sep 11, 2023

Just a sidenote:

Oh right, good idea. Ok, I will clean that up too in follow up PRs.

@nickdesaulniers nickdesaulniers merged commit 93bd428 into llvm:main Sep 11, 2023
3 checks passed
@nickdesaulniers nickdesaulniers deleted the asm_rm3 branch September 11, 2023 16:27
@NathanielMcVicar
Copy link
Contributor

This change appears to have broken the MLIR Windows buildbot (and probably some other Windows bots).
https://lab.llvm.org/buildbot/#/builders/13/builds/39966

C:\buildbot\mlir-x64-windows-ninja\llvm-project\llvm\include\llvm\IR\InlineAsm.h(347) : error C2220: the following warning is treated as an error
C:\buildbot\mlir-x64-windows-ninja\llvm-project\llvm\include\llvm\IR\InlineAsm.h(347) : warning C4715: 'llvm::InlineAsm::Flag::getKindName': not all control paths return a value

nickdesaulniers added a commit that referenced this pull request Sep 11, 2023
@nickdesaulniers
Copy link
Member Author

@NathanielMcVicar thanks for the report. Should be fixed as of
d7acc6e
can you triple check?

@NathanielMcVicar
Copy link
Contributor

Appears to be fixed (now there's another break, but much later)! Thanks so much for the quick resolution.

nickdesaulniers added a commit to nickdesaulniers/llvm-project that referenced this pull request Sep 13, 2023
Similar to
commit 2fad6e6 ("[InlineAsm] wrap Kind in enum class NFC")

Fix the TODOs added in
commit 93bd428 ("[InlineAsm] refactor InlineAsm class NFC (llvm#65649)")
nickdesaulniers added a commit that referenced this pull request Sep 13, 2023
Similar to
commit 2fad6e6 ("[InlineAsm] wrap Kind in enum class NFC")

Fix the TODOs added in
commit 93bd428 ("[InlineAsm] refactor InlineAsm class NFC
(#65649)")
nickdesaulniers added a commit to nickdesaulniers/llvm-project that referenced this pull request Sep 13, 2023
Use multiple Bitfield::Element's to provide more meaningful access to
the same slice of bits. "Data" used in different contexts is confusing.
Try to be as clear as possible, and in that vein, update the comment
block for this class, too.

This was suggested by @bwendling in
llvm#65649 (comment)
and @jyknight in
llvm#65649 (review)
nickdesaulniers added a commit that referenced this pull request Sep 15, 2023
…#66297)

Use multiple Bitfield::Element's to provide more meaningful access to
the same slice of bits. "Data" used in different contexts is confusing.
Try to be as clear as possible, and in that vein, update the comment
block for this class, too.

This was suggested by @bwendling in
#65649 (comment)
and @jyknight in

#65649 (review)
ZijunZhaoCCK pushed a commit to ZijunZhaoCCK/llvm-project that referenced this pull request Sep 19, 2023
I would like to steal one of these bits to denote whether a kind may be
spilled by the register allocator or not, but I'm afraid to touch of any
this code using bitwise operands.

Make flags a first class type using bitfields, rather than launder data
around via `unsigned`.
ZijunZhaoCCK pushed a commit to ZijunZhaoCCK/llvm-project that referenced this pull request Sep 19, 2023
ZijunZhaoCCK pushed a commit to ZijunZhaoCCK/llvm-project that referenced this pull request Sep 19, 2023
Similar to
commit 2fad6e6 ("[InlineAsm] wrap Kind in enum class NFC")

Fix the TODOs added in
commit 93bd428 ("[InlineAsm] refactor InlineAsm class NFC
(llvm#65649)")
ZijunZhaoCCK pushed a commit to ZijunZhaoCCK/llvm-project that referenced this pull request Sep 19, 2023
…llvm#66297)

Use multiple Bitfield::Element's to provide more meaningful access to
the same slice of bits. "Data" used in different contexts is confusing.
Try to be as clear as possible, and in that vein, update the comment
block for this class, too.

This was suggested by @bwendling in
llvm#65649 (comment)
and @jyknight in

llvm#65649 (review)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants