From 3444540e65f7217363c9bd8452c4957b2e14514a Mon Sep 17 00:00:00 2001 From: Aditya Nandakumar Date: Mon, 9 Oct 2017 20:07:41 +0000 Subject: [PATCH] Add a helper to build Copy instructions in MachineIRBuilder git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315239 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h b/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h index 5534c39a1ea..214314cdd8e 100644 --- a/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h +++ b/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h @@ -543,6 +543,10 @@ public: /// /// \return a MachineInstrBuilder for the newly created instruction. MachineInstrBuilder buildCopy(unsigned Res, unsigned Op); + template + MachineInstrBuilder buildCopy(DstType &&Res, SrcType &&Src) { + return buildCopy(getDestFromArg(Res), getRegFromArg(Src)); + } /// Build and insert `Res = G_LOAD Addr, MMO`. /// @@ -660,6 +664,10 @@ public: /// /// \return The newly created instruction. MachineInstrBuilder buildTrunc(unsigned Res, unsigned Op); + template + 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 /// -- 2.40.0