/// <summary> /// Inserts an instruction before the current instruction. /// </summary> /// <returns></returns> public Context InsertBefore() { int label = Label; int beforeIndex = -1; if (IsFirstInstruction) { Debug.Assert(BasicBlock != null, @"Cannot insert before first instruction without basic block"); Debug.Assert(BasicBlock.Index == index, @"Cannot be first instruction since basic block does not start here"); beforeIndex = instructionSet.InsertBefore(index); BasicBlock.Index = beforeIndex; } else beforeIndex = instructionSet.InsertBefore(index); Context ctx = new Context(instructionSet, beforeIndex); ctx.Clear(); ctx.Label = label; return ctx; }
/// <summary> /// Inserts an instruction before the current instruction. /// </summary> /// <returns></returns> public Context InsertBefore() { Debug.Assert(!IsBlockStartInstruction); int label = Label; int beforeIndex = instructionSet.InsertBefore(index); Context ctx = new Context(instructionSet, beforeIndex); ctx.Clear(); ctx.Label = label; // assign label to this new node return ctx; }