GlobalISel: Improve MachineIRBuilder construction
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Mon, 8 Jun 2020 01:37:29 +0000 (21:37 -0400)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Tue, 9 Jun 2020 19:05:04 +0000 (15:05 -0400)
commitb94c9e3b55ab97f6646018dec2c1d3647c04cda3
treeb3ff6b9de86c7bf5178ca4e87c8bc283c4bbff03
parentbabbf4441b6022a2d76f831316b7c3588ade9e15
GlobalISel: Improve MachineIRBuilder construction

The current relationship between LegalizerHelper and MachineIRBuilder
confuses me, because the LegalizerHelper modifies the MachineIRBuilder
which it does not own. Constructing a LegalizerHelper destroys the
insert point, since the constructor calls setMF, which clears all the
fields. Try to separate these functions, so it's possible to construct
a LegalizerHelper from an existing MachineIRBuilder without losing the
insert point/debug loc.
llvm/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h
llvm/lib/CodeGen/GlobalISel/Legalizer.cpp
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp