Index: src/IceTargetLowering.h |
diff --git a/src/IceTargetLowering.h b/src/IceTargetLowering.h |
index 045173bff73cc3f236e841a791833c80f484c9b7..3d139c0bc0ce73586a11c6d346eee7b5231c85b0 100644 |
--- a/src/IceTargetLowering.h |
+++ b/src/IceTargetLowering.h |
@@ -23,11 +23,14 @@ |
#ifndef SUBZERO_SRC_ICETARGETLOWERING_H |
#define SUBZERO_SRC_ICETARGETLOWERING_H |
+#include "IceCfgNode.h" |
#include "IceDefs.h" |
#include "IceInst.h" // for the names of the Inst subtypes |
#include "IceOperand.h" |
#include "IceTypes.h" |
+#include <utility> |
+ |
namespace Ice { |
// UnimplementedError is defined as a macro so that we can get actual line |
@@ -72,6 +75,11 @@ public: |
InstList::iterator getNext() const { return Next; } |
InstList::iterator getEnd() const { return End; } |
void insert(Inst *Inst); |
+ template <typename Inst, typename... Args> Inst *insert(Args &&... A) { |
+ auto *New = Inst::create(Node->getCfg(), std::forward<Args>(A)...); |
+ insert(New); |
+ return New; |
+ } |
Inst *getLastInserted() const; |
void advanceCur() { Cur = Next; } |
void advanceNext() { advanceForward(Next); } |
@@ -370,9 +378,9 @@ protected: |
void |
_bundle_lock(InstBundleLock::Option BundleOption = InstBundleLock::Opt_None) { |
- Context.insert(InstBundleLock::create(Func, BundleOption)); |
+ Context.insert<InstBundleLock>(BundleOption); |
} |
- void _bundle_unlock() { Context.insert(InstBundleUnlock::create(Func)); } |
+ void _bundle_unlock() { Context.insert<InstBundleUnlock>(); } |
void _set_dest_redefined() { Context.getLastInserted()->setDestRedefined(); } |
bool shouldOptimizeMemIntrins(); |