Add a helper to build Copy instructions in MachineIRBuilder

llvm-svn: 315239
This commit is contained in:
Aditya Nandakumar 2017-10-09 20:07:41 +00:00
parent f12e3b848a
commit 4d62ca3ae9
1 changed files with 8 additions and 0 deletions

View File

@ -543,6 +543,10 @@ public:
///
/// \return a MachineInstrBuilder for the newly created instruction.
MachineInstrBuilder buildCopy(unsigned Res, unsigned Op);
template <typename DstType, typename SrcType>
MachineInstrBuilder buildCopy(DstType &&Res, SrcType &&Src) {
return buildCopy(getDestFromArg(Res), getRegFromArg(Src));
}
/// Build and insert `Res<def> = G_LOAD Addr, MMO`.
///
@ -660,6 +664,10 @@ public:
///
/// \return The newly created instruction.
MachineInstrBuilder buildTrunc(unsigned Res, unsigned Op);
template <typename DstType, typename SrcType>
MachineInstrBuilder buildTrunc(DstType &&Res, SrcType &&Src) {
return buildTrunc(getDestFromArg(Res), getRegFromArg(Src));
}
/// Build and insert a \p Res = G_ICMP \p Pred, \p Op0, \p Op1
///