Skip to content

Commit

Permalink
[RISCV][GISEL][NFC] Make MRI a member in RISCVInstructionSelector
Browse files Browse the repository at this point in the history
It was requested in llvm#110782 (comment)
that MRI be made a member of RISCVInstructionSelector.

RISCVInstructionSelector is created in the RISCVSubtarget, independent of
MachineFunction. So it cannot be passed by reference during construction of
RISCVInstructionSelector.

The MachineRegisterInfo object belongs to each MachineFunction, so we will
set it as we enter `select`, which is the only public function to
RISCVInstructionSelector. We don't need to worry about clearing it before
returning from `select`, since there is no other entry point.

I'm not sure this is any better than what we have today. Not sure whether
we should take this change or not. If in the future we have other public
functions of RISCVInstructionSelector, we will need to be more careful about
checking that MRI is set and clearing it where appropriate.
  • Loading branch information
michaelmaitland committed Oct 2, 2024
1 parent 40b8a0f commit fc9e0f3
Showing 1 changed file with 91 additions and 116 deletions.
Loading

0 comments on commit fc9e0f3

Please sign in to comment.