Skip to content

Commit da9c78d

Browse files
committed
Introduced instruction lookahead in CodeGenerator.
1 parent 740239a commit da9c78d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Src/ILGPU/Frontend/CodeGenerator/CodeGenerator.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ---------------------------------------------------------------------------------------
22
// ILGPU
3-
// Copyright (c) 2018-2023 ILGPU Project
3+
// Copyright (c) 2018-2025 ILGPU Project
44
// www.ilgpu.net
55
//
66
// File: CodeGenerator.cs
@@ -36,6 +36,7 @@ sealed partial class CodeGenerator
3636
private readonly Dictionary<VariableRef, (TypeNode, ConvertFlags)>
3737
variableTypes =
3838
new Dictionary<VariableRef, (TypeNode, ConvertFlags)>();
39+
private ILInstruction? nextInstruction;
3940

4041
/// <summary>
4142
/// Constructs a new code generator.
@@ -329,6 +330,7 @@ private void GenerateCodeForBlock()
329330
for (int i = Block.InstructionOffset; i < endOffset; ++i)
330331
{
331332
var instruction = DisassembledMethod[i];
333+
nextInstruction = i + 1 < endOffset ? DisassembledMethod[i + 1] : null;
332334

333335
// Setup debug information
334336
Location = instruction.Location;

0 commit comments

Comments
 (0)