This change is actually NFC. I will post a pass that uses the virtual register naming code from MIRCanonicalizatioPass to only rename vregs for the purposes of making MIR tests more readable.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
This is just code movement, but still a couple of nits/questions.
Only thing I think that I'd really like to see here is some documentation in the header file for functions, classes, etc. If this is going to be shared between some passes, I think it makes sense to document what each thing does, and how these things fit together.
And, since we're moving it all anyway, I guess it'd be worth making function/variable names fit the standard style while we're here.
llvm/lib/CodeGen/MIRVRegNamerUtils.cpp | ||
---|---|---|
15–20 ↗ | (On Diff #218488) |
|
21 ↗ | (On Diff #218488) | Now that this isn't fully tied to the canonicalizer, I think it would make sense to give it a more descriptive name? E.g. findInstructionsWithSideEffects or something? |
51 ↗ | (On Diff #218488) | Same thing here? Basically, anything with "candidate" makes less sense outside the context of a specific pass. (Maybe it would make sense to pack all of this into a Renamer struct/class or something. I don't have any strong opinions there though.) |
llvm/lib/CodeGen/MIRVRegNamerUtils.h | ||
29 ↗ | (On Diff #218488) | I guess from the name, in concept it's obvious what this class *is*, but it would be nice to have a Doxygen comment documenting what its purpose is etc. |
30 ↗ | (On Diff #218488) | While we're here, might as well rename things to fit the style guide? e.g. Type, Reg, etc. |
31 ↗ | (On Diff #218488) | Use Register instead of unsigned? Or is this your own thing? (We started using Register instead of unsigned for registers recently.) |
50 ↗ | (On Diff #218488) | This class could use a Doxygen comment as well. It's a little less obvious what it does. |
57 ↗ | (On Diff #218488) | skipVRegs |
63 ↗ | (On Diff #218488) | Why 1000? |
100 ↗ | (On Diff #218488) | getVRegRenameMap |
llvm/lib/CodeGen/MIRVRegNamerUtils.h | ||
---|---|---|
29 ↗ | (On Diff #218488) | Actually at second glance, I dont think these need to be exposed outside of the .cpp file. |
Moving the guts of the candidate walk loop into the reusable MIRVRegNamer.cpp library
llvm/lib/CodeGen/MIRVRegNamerUtils.cpp | ||
---|---|---|
21 ↗ | (On Diff #218488) | I've decided to isolate these from the header file. So for now the names can remain without confusion. |
51 ↗ | (On Diff #218488) | Agreed. I can consider changing everything named "candidate" to something else, but I'd rather do it in another commit. I've wrapped most of the functions into an anonymous namespace in the cpp file at this point. |
llvm/lib/CodeGen/MIRVRegNamerUtils.h | ||
---|---|---|
63 ↗ | (On Diff #218488) | It's used as a default value for skipping indices between BBs and side-effect tree roots. I've made it an optional parameter of the NamedVRegCursor. |