-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[WebAssembly] Implement GlobalISel #157161
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
base: main
Are you sure you want to change the base?
Conversation
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
If you want to keep tabs on it, or have any suggestions. Probably going to a little while before there's anything worth seriously reviewing. |
f144903
to
332f108
Compare
I'm getting close to having a MVP for you to review. But in the meanwhile, I have a question (if you don't know, maybe you'll at least know who does). I'm working on the instruction selection phase currently. The compatibility layer works pretty well for importing the existing (SelectionDAG) tblgen patterns to work with GISel. So far one of the biggest issues is that my p0 (LLT; pointers in address space 0) aren't getting matched existing patterns expecting an i32/i64 (LLT s32 or s64?). For instance, G_CONSTANT matches to CONST_I32/CONST_I64 when giving a constant s32 or s64, but fails when providing a p0 (e.g. 0 to represent null pointer). What's the best way to fix this. Do I just have to manually implement Note that regbankselect is already putting them in i32regbank or i64regbank as appropriate, so that's working. Its just isel that isn't matching them. |
Yeah, unfortunately I don't know that much about GIsel specifically. This sounds like a good question to bring up on Discourse. |
@topperc you might find this interesting. |
@dschuff It's obviously not fully complete, but I think its far along enough to warrant a review (does that mean I should un-draft it?). I'm not entirely sure what LLVM's policy is on PR size/completeness, but I get the strong impression the GlobalISel implementation doesn't need to be 100% the first go. Feature wise, here's a list of major things still missing (to my recollection)
Besides those, there are other things that still need adding.
Which of these do you want done before a review, and which do you think should be complete for merging this initial PR. My main focus was to get this in a functional state as quickly as possible, so there's undoubtedly plenty of room for cleanup. Call lowering in particular needs addressing, as I had to copy & paste private code from elsewhere rather than use the higher-level public API, due to WASM's unique value-stack [no phys reg, no stack spilling]. This is also basically my first time working with significantly with the LLVM codebase (short of that one small PR and issue last month), so I'm learning along the way. There seem to be lots of ways to accomplish certain tasks, so it sometimes gets confusing what the correct/optimal approach is. I suppose this is a good a time as any to ask, is there still interest in all of this? How far along does this need to get before others will start working with and improving it? |
…lArguments and CallLowering::lowerReturn
…UNC instead of integer ANYEXT/TRUNC)
53bd43b
to
cb51d03
Compare
A WIP attempt to implement the new GlobalISel system for the WebAssembly backend.
It may not end up being worth the effort in the short term, but hopefully if it works out, it will open the doors to improved code maintainability and future GlobalISel-exclusive optimizations.
Based largely on the AArch GlobalISel, combined with the old SelectionDAG-based (WASM) code.