Add some constructors for easier use of MIRBuilders in backend code/passes.
Currently to use the MIRBuilder, we need
MIRBuilder B;
B.setMF(MF);
B.setInstr(SomeMI);
It would be easier to just do
MIRBuilder B(MF, SomeMI);
Details
- Reviewers
qcolombet dsanders ab t.p.northover
Diff Detail
- Repository
- rL LLVM
Event Timeline
include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h | ||
---|---|---|
91 | We could have a constructor with only MI, if that makes the usage simpler: |
include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h | ||
---|---|---|
91 | You mean - instead of the above two constructors, only have one which takes MI? |
include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h | ||
---|---|---|
91 | No, I mean one with MF, one with MI instead of the pair (MF MI). |
include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h | ||
---|---|---|
91 | I see. One with MI should suffice for now. |
LGTM.
One nit below.
include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h | ||
---|---|---|
92 | I would rather call the MachineIRBuilder(MF) constructor. |
We could have a constructor with only MI, if that makes the usage simpler:
MachineIRBuilder(MI) : MachineIRBuild(MI.getParent()->getParent()) {
setInstr(MI);
}