[PATCH] D36636: [GISel][NFC]: Add some constructors for easy creation of MIRBuilders
Aditya Nandakumar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 11 13:28:25 PDT 2017
aditya_nandakumar created this revision.
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);
Repository:
rL LLVM
https://reviews.llvm.org/D36636
Files:
include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h
Index: include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h
===================================================================
--- include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h
+++ include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h
@@ -85,6 +85,14 @@
addUsesFromArgs(MIB, std::forward<UseArgsTy>(Args)...);
}
public:
+ /// Some constructors for easy use.
+ MachineIRBuilder() = default;
+ MachineIRBuilder(MachineFunction &MF) { setMF(MF); }
+ MachineIRBuilder(MachineFunction &MF, MachineInstr &MI) {
+ setMF(MF);
+ setInstr(MI);
+ }
+
/// Getter for the function we currently build.
MachineFunction &getMF() {
assert(MF && "MachineFunction is not set");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36636.110797.patch
Type: text/x-patch
Size: 691 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170811/2cb98c8d/attachment.bin>
More information about the llvm-commits
mailing list