[PATCH] D35516: [GISel]: Split buildSources part of buildInstr separately
Aditya Nandakumar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 17 16:31:18 PDT 2017
aditya_nandakumar created this revision.
For cases where there are no arguments (creating IMPLICIT_DEF), don't attempt to create zero sized arrays.
Repository:
rL LLVM
https://reviews.llvm.org/D35516
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
@@ -76,6 +76,13 @@
return MIB->getOperand(0).getReg();
}
+ void buildSources(MachineInstrBuilder &MIB) { }
+ template<typename ... UseArgsTy>
+ void buildSources(MachineInstrBuilder &MIB, UseArgsTy &&... Args) {
+ unsigned It[] = {(getRegFromArg(Args))...};
+ for (const auto &i : It)
+ MIB.addUse(i);
+ }
public:
/// Getter for the function we currently build.
MachineFunction &getMF() {
@@ -146,9 +153,7 @@
MachineInstrBuilder buildInstr(unsigned Opc, DstTy &&Ty,
UseArgsTy &&... Args) {
auto MIB = buildInstr(Opc).addDef(getDestFromArg(Ty));
- unsigned It[] = {(getRegFromArg(Args))...};
- for (const auto &i : It)
- MIB.addUse(i);
+ buildSources(MIB, std::forward<UseArgsTy>(Args)...);
return MIB;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35516.106974.patch
Type: text/x-patch
Size: 1038 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170717/885e1393/attachment.bin>
More information about the llvm-commits
mailing list