diff --git a/src/Arch/Loongson/LoongArchRewriter.Alu.cs b/src/Arch/Loongson/LoongArchRewriter.Alu.cs index 0ac6d00975..3d7345727c 100644 --- a/src/Arch/Loongson/LoongArchRewriter.Alu.cs +++ b/src/Arch/Loongson/LoongArchRewriter.Alu.cs @@ -120,9 +120,8 @@ private void RewriteLoadBoundsCheck(PrimitiveType dt, Func - /// Generates an unconditional to a . + /// Generates an unconditional to another instruction inside + /// the current . /// - /// The RtlMicroLabel to go to. - /// A reference to this RtlEmitter. - public RtlEmitter MicroGoto(string microLabel) + /// The index of the target + /// A reference to this . + public RtlEmitter MicroGoto(int index) { - Instructions.Add(new RtlMicroGoto(null, microLabel)); + Instructions.Add(new RtlMicroGoto(null, index)); return this; } /// - /// Generates a conditional to a . + /// Generates a conditional to another instruction inside + /// the current . /// - /// Condition which, when true, causes a transfer to the targetted microlabel - /// That RtlMicroLabel to go to. - /// A reference to this RtlEmitter. - public RtlEmitter MicroBranch(Expression cond, string microLabel) - { - Instructions.Add(new RtlMicroGoto(cond, microLabel)); - return this; - } - - /// - /// Generates a microlabel, only reachable via a corresponding - /// or instruction. - /// - /// - /// A reference to this RtlEmitter. - public RtlEmitter MicroLabel(string name) + /// Condition which, when true, causes a transfer to the targetted instruction + /// The index of the target . + /// A reference to this . + public RtlEmitter MicroBranch(Expression cond, int index) { - Instructions.Add(new RtlMicroLabel(name)); + Instructions.Add(new RtlMicroGoto(cond, index)); return this; } diff --git a/src/Core/Rtl/RtlInstructionMatcher.cs b/src/Core/Rtl/RtlInstructionMatcher.cs index 9b436bd7d3..a2e30a37be 100644 --- a/src/Core/Rtl/RtlInstructionMatcher.cs +++ b/src/Core/Rtl/RtlInstructionMatcher.cs @@ -90,12 +90,6 @@ public bool VisitMicroGoto(RtlMicroGoto mgo, ExpressionMatch m) return mgo.Target == mgPat.Target; } - public bool VisitMicroLabel(RtlMicroLabel mlabel, ExpressionMatch m) - { - return (pattern is RtlMicroLabel mpattern && - mlabel.Name == mpattern.Name); - } - public bool VisitIf(RtlIf rtlIf, ExpressionMatch m) { if (pattern is not RtlIf pIf) diff --git a/src/Core/Rtl/RtlInstructionVisitor.cs b/src/Core/Rtl/RtlInstructionVisitor.cs index 81fb03c05e..fc56ff29c9 100644 --- a/src/Core/Rtl/RtlInstructionVisitor.cs +++ b/src/Core/Rtl/RtlInstructionVisitor.cs @@ -33,7 +33,6 @@ public interface RtlInstructionVisitor T VisitIf(RtlIf rtlIf); T VisitInvalid(RtlInvalid invalid); T VisitMicroGoto(RtlMicroGoto uGoto); - T VisitMicroLabel(RtlMicroLabel uLabel); T VisitNop(RtlNop rtlNop); T VisitReturn(RtlReturn ret); T VisitSideEffect(RtlSideEffect side); @@ -49,7 +48,6 @@ public interface IRtlInstructionVisitor T VisitIf(RtlIf rtlIf, C ctx); T VisitInvalid(RtlInvalid invalid, C ctx); T VisitMicroGoto(RtlMicroGoto uGoto, C ctx); - T VisitMicroLabel(RtlMicroLabel uLabel, C ctx); T VisitNop(RtlNop rtlNop, C ctx); T VisitReturn(RtlReturn ret, C ctx); T VisitSideEffect(RtlSideEffect side, C ctx); diff --git a/src/Core/Rtl/RtlMicroGoto.cs b/src/Core/Rtl/RtlMicroGoto.cs index 860caf0af8..fe528b622e 100644 --- a/src/Core/Rtl/RtlMicroGoto.cs +++ b/src/Core/Rtl/RtlMicroGoto.cs @@ -34,24 +34,22 @@ namespace Reko.Core.Rtl /// control flow in RTL code. /// /// - /// Micro-gotos are restricted to labels within the same . + /// Micro-gotos are restricted to offsets within the same . /// If you want to jump outside of the cluster, you may only jump to the start of a rewritten /// instruction using the instruction. /// public class RtlMicroGoto : RtlInstruction { - public RtlMicroGoto(object microTarget) + public RtlMicroGoto(int indexTarget) { - Debug.Assert(microTarget is string || microTarget is RtlLocation); - this.Target = microTarget; + this.Target = indexTarget; this.Class = InstrClass.Transfer; } - public RtlMicroGoto(Expression? condition, object microTarget) + public RtlMicroGoto(Expression? condition, int indexTarget) { - Debug.Assert(microTarget is string || microTarget is RtlLocation); this.Condition = condition; - this.Target = microTarget; + this.Target = indexTarget; this.Class = InstrClass.ConditionalTransfer; } @@ -62,14 +60,12 @@ public RtlMicroGoto(Expression? condition, object microTarget) public Expression? Condition { get; } /// - /// Name of the microLabelName to jump to. The micro label must be inside + /// Name of the microLabelName to jump to. + /// The target must be an index into the s of the + /// current . /// the current RtlInstructionCluster. /// - /// - /// The target can either be a symbolic string or an RtlLocation. Symbolic - /// strings are translated to RtlLocations during scanning. - /// - public object Target { get; } + public int Target { get; } public override T Accept(RtlInstructionVisitor visitor) { diff --git a/src/Core/Rtl/RtlMicroLabel.cs b/src/Core/Rtl/RtlMicroLabel.cs deleted file mode 100644 index 7fc1bb5a72..0000000000 --- a/src/Core/Rtl/RtlMicroLabel.cs +++ /dev/null @@ -1,58 +0,0 @@ -#region License -/* - * Copyright (C) 1999-2024 John Källén. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - */ -#endregion - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Reko.Core.Rtl -{ - /// - /// This instruction represents "micro-jump"s between s - /// in a . - /// - public class RtlMicroLabel : RtlInstruction - { - public RtlMicroLabel(string name) - { - this.Name = name; - } - - public string Name { get; } - - public override T Accept(RtlInstructionVisitor visitor) - { - return visitor.VisitMicroLabel(this); - } - - public override T Accept(IRtlInstructionVisitor visitor, C context) - { - return visitor.VisitMicroLabel(this, context); - } - - protected override void WriteInner(TextWriter writer) - { - writer.Write("{0}::", Name); - } - } -} diff --git a/src/Decompiler/Scanning/BackwardSlicer.cs b/src/Decompiler/Scanning/BackwardSlicer.cs index 6a8e851b26..ea69c42bf0 100644 --- a/src/Decompiler/Scanning/BackwardSlicer.cs +++ b/src/Decompiler/Scanning/BackwardSlicer.cs @@ -1330,11 +1330,6 @@ public SlicerResult VisitMicroGoto(RtlMicroGoto uGoto) { throw new NotImplementedException(); } - - public SlicerResult VisitMicroLabel(RtlMicroLabel uLabel) - { - throw new NotImplementedException(); - } } public class SlicerResult diff --git a/src/Decompiler/Scanning/BlockConstantPropagator.cs b/src/Decompiler/Scanning/BlockConstantPropagator.cs index 3be5533c8a..f965913fe5 100644 --- a/src/Decompiler/Scanning/BlockConstantPropagator.cs +++ b/src/Decompiler/Scanning/BlockConstantPropagator.cs @@ -23,16 +23,12 @@ using Reko.Core.Memory; using Reko.Core.Operators; using Reko.Core.Rtl; -using Reko.Core.Services; -using Reko.Evaluation; using Reko.Services; using System; using System.Collections.Generic; -using System.ComponentModel; namespace Reko.Scanning { - /// /// Forward analysis that propagates constants, /// but only within a single linear block. @@ -112,11 +108,6 @@ public RtlInstruction VisitMicroGoto(RtlMicroGoto uGoto) return uGoto; } - public RtlInstruction VisitMicroLabel(RtlMicroLabel uLabel) - { - return uLabel; - } - public RtlInstruction VisitNop(RtlNop rtlNop) { return rtlNop; diff --git a/src/Decompiler/Scanning/BlockWorkitem.cs b/src/Decompiler/Scanning/BlockWorkitem.cs index 8b1c41c4ad..5fcd96838e 100644 --- a/src/Decompiler/Scanning/BlockWorkitem.cs +++ b/src/Decompiler/Scanning/BlockWorkitem.cs @@ -865,11 +865,6 @@ public bool VisitMicroGoto(RtlMicroGoto uGoto) throw new NotImplementedException(); } - public bool VisitMicroLabel(RtlMicroLabel uLabel) - { - throw new NotImplementedException(); - } - public bool VisitReturn(RtlReturn ret) { if ((ret.Class & InstrClass.Delay) != 0) diff --git a/src/Decompiler/Scanning/ProcedureGraphBuilder.cs b/src/Decompiler/Scanning/ProcedureGraphBuilder.cs index aa54fc5b99..d307a3ed9a 100644 --- a/src/Decompiler/Scanning/ProcedureGraphBuilder.cs +++ b/src/Decompiler/Scanning/ProcedureGraphBuilder.cs @@ -318,11 +318,6 @@ public Instruction VisitMicroGoto(RtlMicroGoto uGoto, Context ctx) throw new NotImplementedException(); } - public Instruction VisitMicroLabel(RtlMicroLabel uLabel, Context ctx) - { - throw new NotImplementedException(); - } - public Instruction VisitNop(RtlNop rtlNop, Context ctx) { return null!; diff --git a/src/UnitTests/Arch/Loongson/LoongArchRewriterTests.cs b/src/UnitTests/Arch/Loongson/LoongArchRewriterTests.cs index 3b4964917c..e62235f36c 100644 --- a/src/UnitTests/Arch/Loongson/LoongArchRewriterTests.cs +++ b/src/UnitTests/Arch/Loongson/LoongArchRewriterTests.cs @@ -819,11 +819,10 @@ public void LoongArchRw_fldgt_d() { Given_HexString("9F9C7438"); AssertCode( // fldgt.d $f31,$r4,$r7 - "0|L--|0000000000100000(4): 4 instructions", - "1|T--|if (r4 >u r7) micro_goto skip", + "0|L--|0000000000100000(4): 3 instructions", + "1|T--|if (r4 >u r7) micro_goto 2", "2|L--|__raise_exception(0xA<32>)", - "3|---|skip::", - "4|L--|f31 = Mem0[r4:real64]"); + "3|L--|f31 = Mem0[r4:real64]"); } [Test] @@ -831,12 +830,11 @@ public void LoongArchRw_fldgt_s() { Given_HexString("40457438"); AssertCode( // fldgt.s $f0,$r10,$r17 - "0|L--|0000000000100000(4): 5 instructions", - "1|T--|if (r10 >u r17) micro_goto skip", + "0|L--|0000000000100000(4): 4 instructions", + "1|T--|if (r10 >u r17) micro_goto 2", "2|L--|__raise_exception(0xA<32>)", - "3|---|skip::", - "4|L--|v6 = Mem0[r10:real32]", - "5|L--|f0 = SEQ(SLICE(f0, word32, 32), v6)"); + "3|L--|v6 = Mem0[r10:real32]", + "4|L--|f0 = SEQ(SLICE(f0, word32, 32), v6)"); } [Test] @@ -844,11 +842,10 @@ public void LoongArchRw_fldle_d() { Given_HexString("A4E27538"); AssertCode( // fldle.d $f4,$r21,$r24 - "0|L--|0000000000100000(4): 4 instructions", - "1|T--|if (r21 <=u r24) micro_goto skip", + "0|L--|0000000000100000(4): 3 instructions", + "1|T--|if (r21 <=u r24) micro_goto 2", "2|L--|__raise_exception(0xA<32>)", - "3|---|skip::", - "4|L--|f4 = Mem0[r21:real64]"); + "3|L--|f4 = Mem0[r21:real64]"); } [Test] @@ -856,12 +853,11 @@ public void LoongArchRw_fldle_s() { Given_HexString("D14D7538"); AssertCode( // fldle.s $f17,$r14,$r19 - "0|L--|0000000000100000(4): 5 instructions", - "1|T--|if (r14 <=u r19) micro_goto skip", + "0|L--|0000000000100000(4): 4 instructions", + "1|T--|if (r14 <=u r19) micro_goto 2", "2|L--|__raise_exception(0xA<32>)", - "3|---|skip::", - "4|L--|v6 = Mem0[r14:real32]", - "5|L--|f17 = SEQ(SLICE(f17, word32, 32), v6)"); + "3|L--|v6 = Mem0[r14:real32]", + "4|L--|f17 = SEQ(SLICE(f17, word32, 32), v6)"); } [Test] @@ -1044,11 +1040,10 @@ public void LoongArchRw_fstgt_d() { Given_HexString("6BEA7638"); AssertCode( // fstgt.d $f11,$r19,$r26 - "0|L--|0000000000100000(4): 4 instructions", - "1|T--|if (r19 >u r26) micro_goto skip", + "0|L--|0000000000100000(4): 3 instructions", + "1|T--|if (r19 >u r26) micro_goto 2", "2|L--|__raise_exception(0xA<32>)", - "3|---|skip::", - "4|L--|Mem0[r19:real64] = f11"); + "3|L--|Mem0[r19:real64] = f11"); } [Test] @@ -1056,12 +1051,11 @@ public void LoongArchRw_fstgt_s() { Given_HexString("04467638"); AssertCode( // fstgt.s $f4,$r16,$r17 - "0|L--|0000000000100000(4): 5 instructions", + "0|L--|0000000000100000(4): 4 instructions", "1|L--|v4 = SLICE(f4, real32, 0)", - "2|T--|if (r16 >u r17) micro_goto skip", + "2|T--|if (r16 >u r17) micro_goto 3", "3|L--|__raise_exception(0xA<32>)", - "4|---|skip::", - "5|L--|Mem0[r16:real32] = v4"); + "4|L--|Mem0[r16:real32] = v4"); } [Test] @@ -1069,11 +1063,10 @@ public void LoongArchRw_fstle_d() { Given_HexString("2EE87738"); AssertCode( // fstle.d $f14,$r1,$r26 - "0|L--|0000000000100000(4): 4 instructions", - "1|T--|if (r1 <=u r26) micro_goto skip", + "0|L--|0000000000100000(4): 3 instructions", + "1|T--|if (r1 <=u r26) micro_goto 2", "2|L--|__raise_exception(0xA<32>)", - "3|---|skip::", - "4|L--|Mem0[r1:real64] = f14"); + "3|L--|Mem0[r1:real64] = f14"); } [Test] @@ -1081,12 +1074,11 @@ public void LoongArchRw_fstle_s() { Given_HexString("855F7738"); AssertCode( // fstle.s $f5,$r28,$r23 - "0|L--|0000000000100000(4): 5 instructions", + "0|L--|0000000000100000(4): 4 instructions", "1|L--|v4 = SLICE(f5, real32, 0)", - "2|T--|if (r28 <=u r23) micro_goto skip", + "2|T--|if (r28 <=u r23) micro_goto 3", "3|L--|__raise_exception(0xA<32>)", - "4|---|skip::", - "5|L--|Mem0[r28:real32] = v4"); + "4|L--|Mem0[r28:real32] = v4"); } [Test] @@ -1223,12 +1215,11 @@ public void LoongArchRw_ldgt_b() { Given_HexString("20307838"); AssertCode( // ldgt.b $r0,$r1,$r12 - "0|L--|0000000000100000(4): 5 instructions", - "1|T--|if (r1 >u r12) micro_goto skip", + "0|L--|0000000000100000(4): 4 instructions", + "1|T--|if (r1 >u r12) micro_goto 2", "2|L--|__raise_exception(0xA<32>)", - "3|---|skip::", - "4|L--|v6 = Mem0[r1:int8]", - "5|L--|r0 = CONVERT(v6, int8, int64)"); + "3|L--|v6 = Mem0[r1:int8]", + "4|L--|r0 = CONVERT(v6, int8, int64)"); } [Test] @@ -1236,11 +1227,10 @@ public void LoongArchRw_ldgt_d() { Given_HexString("99C97938"); AssertCode( // ldgt.d $r25,$r12,$r18 - "0|L--|0000000000100000(4): 4 instructions", - "1|T--|if (r12 >u r18) micro_goto skip", + "0|L--|0000000000100000(4): 3 instructions", + "1|T--|if (r12 >u r18) micro_goto 2", "2|L--|__raise_exception(0xA<32>)", - "3|---|skip::", - "4|L--|r25 = Mem0[r12:int64]"); + "3|L--|r25 = Mem0[r12:int64]"); } [Test] @@ -1248,12 +1238,11 @@ public void LoongArchRw_ldgt_h() { Given_HexString("37D37838"); AssertCode( // ldgt.h $r23,$r25,$r20 - "0|L--|0000000000100000(4): 5 instructions", - "1|T--|if (r25 >u r20) micro_goto skip", + "0|L--|0000000000100000(4): 4 instructions", + "1|T--|if (r25 >u r20) micro_goto 2", "2|L--|__raise_exception(0xA<32>)", - "3|---|skip::", - "4|L--|v6 = Mem0[r25:int16]", - "5|L--|r23 = CONVERT(v6, int16, int64)"); + "3|L--|v6 = Mem0[r25:int16]", + "4|L--|r23 = CONVERT(v6, int16, int64)"); } [Test] @@ -1261,12 +1250,11 @@ public void LoongArchRw_ldgt_w() { Given_HexString("840F7938"); AssertCode( // ldgt.w $r4,$r28,$r3 - "0|L--|0000000000100000(4): 5 instructions", - "1|T--|if (r28 >u r3) micro_goto skip", + "0|L--|0000000000100000(4): 4 instructions", + "1|T--|if (r28 >u r3) micro_goto 2", "2|L--|__raise_exception(0xA<32>)", - "3|---|skip::", - "4|L--|v6 = Mem0[r28:int32]", - "5|L--|r4 = CONVERT(v6, int32, int64)"); + "3|L--|v6 = Mem0[r28:int32]", + "4|L--|r4 = CONVERT(v6, int32, int64)"); } [Test] @@ -1274,12 +1262,11 @@ public void LoongArchRw_ldle_b() { Given_HexString("E9107A38"); AssertCode( // ldle.b $r9,$r7,$r4 - "0|L--|0000000000100000(4): 5 instructions", - "1|T--|if (r7 <=u r4) micro_goto skip", + "0|L--|0000000000100000(4): 4 instructions", + "1|T--|if (r7 <=u r4) micro_goto 2", "2|L--|__raise_exception(0xA<32>)", - "3|---|skip::", - "4|L--|v6 = Mem0[r7:int8]", - "5|L--|r9 = CONVERT(v6, int8, int64)"); + "3|L--|v6 = Mem0[r7:int8]", + "4|L--|r9 = CONVERT(v6, int8, int64)"); } [Test] @@ -1287,11 +1274,10 @@ public void LoongArchRw_ldle_d() { Given_HexString("B8D97B38"); AssertCode( // ldle.d $r24,$r13,$r22 - "0|L--|0000000000100000(4): 4 instructions", - "1|T--|if (r13 <=u r22) micro_goto skip", + "0|L--|0000000000100000(4): 3 instructions", + "1|T--|if (r13 <=u r22) micro_goto 2", "2|L--|__raise_exception(0xA<32>)", - "3|---|skip::", - "4|L--|r24 = Mem0[r13:int64]"); + "3|L--|r24 = Mem0[r13:int64]"); } [Test] @@ -1299,12 +1285,11 @@ public void LoongArchRw_ldle_h() { Given_HexString("37C77A38"); AssertCode( // ldle.h $r23,$r25,$r17 - "0|L--|0000000000100000(4): 5 instructions", - "1|T--|if (r25 <=u r17) micro_goto skip", + "0|L--|0000000000100000(4): 4 instructions", + "1|T--|if (r25 <=u r17) micro_goto 2", "2|L--|__raise_exception(0xA<32>)", - "3|---|skip::", - "4|L--|v6 = Mem0[r25:int16]", - "5|L--|r23 = CONVERT(v6, int16, int64)"); + "3|L--|v6 = Mem0[r25:int16]", + "4|L--|r23 = CONVERT(v6, int16, int64)"); } [Test] @@ -1312,12 +1297,11 @@ public void LoongArchRw_ldle_w() { Given_HexString("A9377B38"); AssertCode( // ldle.w $r9,$r29,$r13 - "0|L--|0000000000100000(4): 5 instructions", - "1|T--|if (r29 <=u r13) micro_goto skip", + "0|L--|0000000000100000(4): 4 instructions", + "1|T--|if (r29 <=u r13) micro_goto 2", "2|L--|__raise_exception(0xA<32>)", - "3|---|skip::", - "4|L--|v6 = Mem0[r29:int32]", - "5|L--|r9 = CONVERT(v6, int32, int64)"); + "3|L--|v6 = Mem0[r29:int32]", + "4|L--|r9 = CONVERT(v6, int32, int64)"); } [Test] @@ -1877,12 +1861,11 @@ public void LoongArchRw_stgt_b() { Given_HexString("7A7C7C38"); AssertCode( // stgt.b $r26,$r3,$r31 - "0|L--|0000000000100000(4): 5 instructions", + "0|L--|0000000000100000(4): 4 instructions", "1|L--|v4 = SLICE(r26, byte, 0)", - "2|T--|if (r3 >u r31) micro_goto skip", + "2|T--|if (r3 >u r31) micro_goto 3", "3|L--|__raise_exception(0xA<32>)", - "4|---|skip::", - "5|L--|Mem0[r3:byte] = v4"); + "4|L--|Mem0[r3:byte] = v4"); } [Test] @@ -1890,11 +1873,10 @@ public void LoongArchRw_stgt_d() { Given_HexString("CD8E7D38"); AssertCode( // stgt.d $r13,$r22,$r3 - "0|L--|0000000000100000(4): 4 instructions", - "1|T--|if (r22 >u r3) micro_goto skip", + "0|L--|0000000000100000(4): 3 instructions", + "1|T--|if (r22 >u r3) micro_goto 2", "2|L--|__raise_exception(0xA<32>)", - "3|---|skip::", - "4|L--|Mem0[r22:word64] = r13"); + "3|L--|Mem0[r22:word64] = r13"); } [Test] @@ -1902,12 +1884,11 @@ public void LoongArchRw_stgt_h() { Given_HexString("149F7C38"); AssertCode( // stgt.h $r20,$r24,$r7 - "0|L--|0000000000100000(4): 5 instructions", + "0|L--|0000000000100000(4): 4 instructions", "1|L--|v4 = SLICE(r20, word16, 0)", - "2|T--|if (r24 >u r7) micro_goto skip", + "2|T--|if (r24 >u r7) micro_goto 3", "3|L--|__raise_exception(0xA<32>)", - "4|---|skip::", - "5|L--|Mem0[r24:word16] = v4"); + "4|L--|Mem0[r24:word16] = v4"); } [Test] @@ -1915,12 +1896,11 @@ public void LoongArchRw_stle_b() { Given_HexString("4D017E38"); AssertCode( // stle.b $r13,$r10,$r0 - "0|L--|0000000000100000(4): 5 instructions", + "0|L--|0000000000100000(4): 4 instructions", "1|L--|v4 = SLICE(r13, byte, 0)", - "2|T--|if (r10 <=u r0) micro_goto skip", + "2|T--|if (r10 <=u r0) micro_goto 3", "3|L--|__raise_exception(0xA<32>)", - "4|---|skip::", - "5|L--|Mem0[r10:byte] = v4"); + "4|L--|Mem0[r10:byte] = v4"); } [Test] @@ -1928,11 +1908,10 @@ public void LoongArchRw_stle_d() { Given_HexString("8AC47F38"); AssertCode( // stle.d $r10,$r4,$r17 - "0|L--|0000000000100000(4): 4 instructions", - "1|T--|if (r4 <=u r17) micro_goto skip", + "0|L--|0000000000100000(4): 3 instructions", + "1|T--|if (r4 <=u r17) micro_goto 2", "2|L--|__raise_exception(0xA<32>)", - "3|---|skip::", - "4|L--|Mem0[r4:word64] = r10"); + "3|L--|Mem0[r4:word64] = r10"); } [Test] @@ -1940,12 +1919,11 @@ public void LoongArchRw_stle_h() { Given_HexString("D6C87E38"); AssertCode( // stle.h $r22,$r6,$r18 - "0|L--|0000000000100000(4): 5 instructions", + "0|L--|0000000000100000(4): 4 instructions", "1|L--|v4 = SLICE(r22, word16, 0)", - "2|T--|if (r6 <=u r18) micro_goto skip", + "2|T--|if (r6 <=u r18) micro_goto 3", "3|L--|__raise_exception(0xA<32>)", - "4|---|skip::", - "5|L--|Mem0[r6:word16] = v4"); + "4|L--|Mem0[r6:word16] = v4"); } [Test] @@ -1953,12 +1931,11 @@ public void LoongArchRw_stle_w() { Given_HexString("4C767F38"); AssertCode( // stle.w $r12,$r18,$r29 - "0|L--|0000000000100000(4): 5 instructions", + "0|L--|0000000000100000(4): 4 instructions", "1|L--|v4 = SLICE(r12, word32, 0)", - "2|T--|if (r18 <=u r29) micro_goto skip", + "2|T--|if (r18 <=u r29) micro_goto 3", "3|L--|__raise_exception(0xA<32>)", - "4|---|skip::", - "5|L--|Mem0[r18:word32] = v4"); + "4|L--|Mem0[r18:word32] = v4"); } [Test] diff --git a/subjects/regression.log b/subjects/regression.log index de96cecde4..c6b48aee8b 100644 --- a/subjects/regression.log +++ b/subjects/regression.log @@ -1135,8 +1135,8 @@ Signature of 'Microsoft Visual C++ 8' detected. *** Elf\AVR32\ls fn00008FF2: error: An error occurred while rewriting procedure to high-level language. Can't collapse fn00008FF2_entry (Tail) => l00008FF0_thunk_fn00008FF2) in procedure fn00008FF2 - at Reko.Structure.StructureAnalysis.CollapseToTailRegion(Region from, Region to, AbsynStatement stm) in d:\dev\uxmal\reko\master\src\Decompiler\Structure\StructureAnalysis.cs:line 960 - at Reko.Structure.StructureAnalysis.VirtualizeEdge(VirtualEdge vEdge) in d:\dev\uxmal\reko\master\src\Decompiler\Structure\StructureAnalysis.cs:line 906 + at Reko.Structure.StructureAnalysis.CollapseToTailRegion(Region from, Region to, AbsynStatement stm) in d:\dev\uxmal\reko\master\src\Decompiler\Structure\StructureAnalysis.cs:line 982 + at Reko.Structure.StructureAnalysis.VirtualizeEdge(VirtualEdge vEdge) in d:\dev\uxmal\reko\master\src\Decompiler\Structure\StructureAnalysis.cs:line 932 at Reko.Structure.StructureAnalysis.VirtualizeReturn(Region n) in d:\dev\uxmal\reko\master\src\Decompiler\Structure\StructureAnalysis.cs:line 312 at Reko.Structure.StructureAnalysis.ProcessUnresolvedRegions() in d:\dev\uxmal\reko\master\src\Decompiler\Structure\StructureAnalysis.cs:line 285 at Reko.Structure.StructureAnalysis.Execute() in d:\dev\uxmal\reko\master\src\Decompiler\Structure\StructureAnalysis.cs:line 172 @@ -1419,7 +1419,9 @@ fn0001B1D0: warning: Structure analysis stopped making progress, quitting. Pleas fn0001B1F8: warning: Structure analysis stopped making progress, quitting. Please report this issue at https://github.com/uxmal/reko fn0001B2AC: error: An error occurred while rewriting procedure to high-level language. Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index') - at Reko.Structure.CompoundConditionCoalescer.MaybeCoalesce(Block block) in d:\dev\uxmal\reko\master\src\Decompiler\Structure\CompoundConditionCoalescer.cs:line 95 + at System.Collections.Generic.List`1.get_Item(Int32 index) + at Reko.Core.Block.get_ThenBlock() in d:\dev\uxmal\reko\master\src\Core\Block.cs:line 92 + at Reko.Structure.CompoundConditionCoalescer.MaybeCoalesce(Block block) in d:\dev\uxmal\reko\master\src\Decompiler\Structure\CompoundConditionCoalescer.cs:line 96 at Reko.Structure.CompoundConditionCoalescer.Transform() in d:\dev\uxmal\reko\master\src\Decompiler\Structure\CompoundConditionCoalescer.cs:line 62 at Reko.Structure.StructureAnalysis.Structure() in d:\dev\uxmal\reko\master\src\Decompiler\Structure\StructureAnalysis.cs:line 78 at Reko.Decompiler.StructureProgram() in d:\dev\uxmal\reko\master\src\Decompiler\Decompiler.cs:line 592 @@ -1500,7 +1502,8 @@ finish: error: An error occurred while renaming variables. at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at Reko.Analysis.SsaLivenessAnalysis.LiveOutAtBlock(Block b, SsaIdentifier v) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\SsaLiveness.cs:line 170 at Reko.Analysis.SsaLivenessAnalysis.BuildInterferenceGraph(SsaIdentifierCollection ssaIds) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\SsaLiveness.cs:line 100 - at Reko.Analysis.LiveCopyInserter..ctor(SsaState ssa) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\LiveCopyInserter.cs:line 43 + at Reko.Analysis.SsaLivenessAnalysis..ctor(SsaState ssa) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\SsaLiveness.cs:line 62 + at Reko.Analysis.LiveCopyInserter..ctor(SsaState ssa) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\LiveCopyInserter.cs:line 41 at Reko.Analysis.WebBuilder.Worker.Transform() in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\WebBuilder.cs:line 136 l00401628: warning: Non-integral switch expression l00401614: warning: Non-integral switch expression @@ -1616,6 +1619,7 @@ fn0800_2688: error: An error occurred while renaming variables. The given key 'l0800_2729' was not present in the dictionary. at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at Reko.Analysis.SsaLivenessAnalysis.IsLiveIn(Identifier id, Statement stm) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\SsaLiveness.cs:line 129 + at Reko.Analysis.LiveCopyInserter.IsLiveAtCopyPoint(Identifier id, Block b) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\LiveCopyInserter.cs:line 91 at Reko.Analysis.LiveCopyInserter.Transform(Statement stm, PhiAssignment phi) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\LiveCopyInserter.cs:line 119 at Reko.Analysis.LiveCopyInserter.Transform() in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\LiveCopyInserter.cs:line 106 at Reko.Analysis.WebBuilder.Worker.Transform() in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\WebBuilder.cs:line 136 @@ -1623,6 +1627,7 @@ fn0800_67BF: error: An error occurred while renaming variables. The given key 'l0800_6A7C' was not present in the dictionary. at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at Reko.Analysis.SsaLivenessAnalysis.IsLiveIn(Identifier id, Statement stm) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\SsaLiveness.cs:line 129 + at Reko.Analysis.LiveCopyInserter.IsLiveAtCopyPoint(Identifier id, Block b) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\LiveCopyInserter.cs:line 91 at Reko.Analysis.LiveCopyInserter.Transform(Statement stm, PhiAssignment phi) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\LiveCopyInserter.cs:line 119 at Reko.Analysis.LiveCopyInserter.Transform() in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\LiveCopyInserter.cs:line 106 at Reko.Analysis.WebBuilder.Worker.Transform() in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\WebBuilder.cs:line 136 @@ -1630,6 +1635,7 @@ fn0800_4F2C: error: An error occurred while renaming variables. The given key 'l0800_4F67' was not present in the dictionary. at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at Reko.Analysis.SsaLivenessAnalysis.IsLiveIn(Identifier id, Statement stm) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\SsaLiveness.cs:line 129 + at Reko.Analysis.LiveCopyInserter.IsLiveAtCopyPoint(Identifier id, Block b) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\LiveCopyInserter.cs:line 91 at Reko.Analysis.LiveCopyInserter.Transform(Statement stm, PhiAssignment phi) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\LiveCopyInserter.cs:line 119 at Reko.Analysis.LiveCopyInserter.Transform() in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\LiveCopyInserter.cs:line 106 at Reko.Analysis.WebBuilder.Worker.Transform() in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\WebBuilder.cs:line 136 @@ -1637,6 +1643,7 @@ fn0800_C177: error: An error occurred while renaming variables. The given key 'l0800_C22D' was not present in the dictionary. at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at Reko.Analysis.SsaLivenessAnalysis.IsLiveIn(Identifier id, Statement stm) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\SsaLiveness.cs:line 129 + at Reko.Analysis.LiveCopyInserter.IsLiveAtCopyPoint(Identifier id, Block b) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\LiveCopyInserter.cs:line 91 at Reko.Analysis.LiveCopyInserter.Transform(Statement stm, PhiAssignment phi) in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\LiveCopyInserter.cs:line 119 at Reko.Analysis.LiveCopyInserter.Transform() in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\LiveCopyInserter.cs:line 106 at Reko.Analysis.WebBuilder.Worker.Transform() in d:\dev\uxmal\reko\master\src\Decompiler\Analysis\WebBuilder.cs:line 136 @@ -2471,7 +2478,7 @@ fn0000802E: error: An error occurred while rewriting procedure to high-level lan The given key 'l00008318' was not present in the dictionary. at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at Reko.Core.Graphs.DominatorGraph`1.BuildDominanceFrontiers(DirectedGraph`1 graph, Dictionary`2 idoms) in d:\dev\uxmal\reko\master\src\Core\Graphs\DominatorGraph.cs:line 193 - at Reko.Core.Graphs.DominatorGraph`1..ctor(DirectedGraph`1 graph, T entryNode) in d:\dev\uxmal\reko\master\src\Core\Graphs\DominatorGraph.cs:line 47 + at Reko.Core.Graphs.DominatorGraph`1..ctor(DirectedGraph`1 graph, T entryNode) in d:\dev\uxmal\reko\master\src\Core\Graphs\DominatorGraph.cs:line 46 at Reko.Structure.StructureAnalysis.Execute() in d:\dev\uxmal\reko\master\src\Decompiler\Structure\StructureAnalysis.cs:line 147 at Reko.Structure.StructureAnalysis.Structure() in d:\dev\uxmal\reko\master\src\Decompiler\Structure\StructureAnalysis.cs:line 80 at Reko.Decompiler.StructureProgram() in d:\dev\uxmal\reko\master\src\Decompiler\Decompiler.cs:line 592 @@ -2479,7 +2486,7 @@ fn00009746: error: An error occurred while rewriting procedure to high-level lan The given key 'l0000985B' was not present in the dictionary. at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at Reko.Core.Graphs.DominatorGraph`1.BuildDominanceFrontiers(DirectedGraph`1 graph, Dictionary`2 idoms) in d:\dev\uxmal\reko\master\src\Core\Graphs\DominatorGraph.cs:line 193 - at Reko.Core.Graphs.DominatorGraph`1..ctor(DirectedGraph`1 graph, T entryNode) in d:\dev\uxmal\reko\master\src\Core\Graphs\DominatorGraph.cs:line 47 + at Reko.Core.Graphs.DominatorGraph`1..ctor(DirectedGraph`1 graph, T entryNode) in d:\dev\uxmal\reko\master\src\Core\Graphs\DominatorGraph.cs:line 46 at Reko.Structure.StructureAnalysis.Execute() in d:\dev\uxmal\reko\master\src\Decompiler\Structure\StructureAnalysis.cs:line 147 at Reko.Structure.StructureAnalysis.Structure() in d:\dev\uxmal\reko\master\src\Decompiler\Structure\StructureAnalysis.cs:line 80 at Reko.Decompiler.StructureProgram() in d:\dev\uxmal\reko\master\src\Decompiler\Decompiler.cs:line 592 @@ -2579,4 +2586,4 @@ PE Debug type 14 not supported yet. === PE\x86\VCExeSample\VCExeSample Signature of 'Microsoft Visual C++ 8' detected. -Decompiled 92 binaries in 90.13 seconds. +Decompiled 92 binaries in 58.06 seconds.