Skip to content

Commit e583e32

Browse files
committed
Fix: crashes in CSkyCallingConvention.Is*Argument
1 parent 3551561 commit e583e32

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/Environments/SysV/ArchSpecific/CSkyCallingConvention.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,22 @@ public override void Generate(ICallingConventionBuilder ccr, int retAddressOnSta
146146
}
147147
}
148148

149+
/// <inheritdoc/>
149150
public override bool IsArgument(Storage stg)
150151
{
151-
throw new System.NotImplementedException();
152+
if (stg is RegisterStorage regStg)
153+
{
154+
return (uint) regStg.Number <= 3;
155+
}
156+
return stg is StackStorage stk &&
157+
stk.StackOffset >= 0;
152158
}
153159

160+
/// <inheritdoc/>
154161
public override bool IsOutArgument(Storage stg)
155162
{
156-
throw new System.NotImplementedException();
163+
return stg is RegisterStorage reg &&
164+
(uint) reg.Number <= 1;
157165
}
158166
}
159167
}

0 commit comments

Comments
 (0)