[llvm] r315239 - Add a helper to build Copy instructions in MachineIRBuilder
Aditya Nandakumar via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 9 13:07:41 PDT 2017
Author: aditya_nandakumar
Date: Mon Oct 9 13:07:41 2017
New Revision: 315239
URL: http://llvm.org/viewvc/llvm-project?rev=315239&view=rev
Log:
Add a helper to build Copy instructions in MachineIRBuilder
Modified:
llvm/trunk/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h
Modified: llvm/trunk/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h?rev=315239&r1=315238&r2=315239&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h (original)
+++ llvm/trunk/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h Mon Oct 9 13:07:41 2017
@@ -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
///
More information about the llvm-commits
mailing list