Index: src/IceCfgNode.cpp |
diff --git a/src/IceCfgNode.cpp b/src/IceCfgNode.cpp |
index 22915b2f37bbe9f72ca06d10bfba912302543a0a..696a2f0b87ad9fb948535f3ded3d0ece2a0ccfe2 100644 |
--- a/src/IceCfgNode.cpp |
+++ b/src/IceCfgNode.cpp |
@@ -191,6 +191,24 @@ void CfgNode::doAddressOpt() { |
} |
} |
+void CfgNode::doNopInsertion() { |
+ TargetLowering *Target = Func->getTarget(); |
+ LoweringContext &Context = Target->getContext(); |
+ Context.init(this); |
+ while (!Context.atEnd()) { |
+ Target->doNopInsertion(); |
+ // Ensure Cur=Next, so that the nops are inserted before the current |
+ // instruction rather than after. |
+ Context.advanceNext(); |
+ Context.advanceCur(); |
+ } |
+ // Insert before all instructions. |
+ Context.setInsertPoint(getInsts().begin()); |
+ Context.advanceNext(); |
+ Context.advanceCur(); |
+ Target->doNopInsertion(); |
+} |
+ |
// Drives the target lowering. Passes the current instruction and the |
// next non-deleted instruction for target lowering. |
void CfgNode::genCode() { |