[CPU] Speed up translation a little bit
This commit is contained in:
parent
46548bbc41
commit
9227b0ea59
4 changed files with 48 additions and 33 deletions
|
@ -60,11 +60,11 @@ namespace ChocolArm64.Translation
|
|||
|
||||
public AILBlock GetILBlock(int Index) => ILBlocks[Index];
|
||||
|
||||
public ATranslatedSub GetSubroutine(HashSet<long> Callees)
|
||||
public ATranslatedSub GetSubroutine()
|
||||
{
|
||||
LocalAlloc = new ALocalAlloc(ILBlocks, Root);
|
||||
|
||||
InitSubroutine(Callees);
|
||||
InitSubroutine();
|
||||
InitLocals();
|
||||
|
||||
foreach (AILBlock ILBlock in ILBlocks)
|
||||
|
@ -75,7 +75,7 @@ namespace ChocolArm64.Translation
|
|||
return Subroutine;
|
||||
}
|
||||
|
||||
private void InitSubroutine(HashSet<long> Callees)
|
||||
private void InitSubroutine()
|
||||
{
|
||||
List<ARegister> Params = new List<ARegister>();
|
||||
|
||||
|
@ -99,7 +99,7 @@ namespace ChocolArm64.Translation
|
|||
|
||||
Generator = Mthd.GetILGenerator();
|
||||
|
||||
Subroutine = new ATranslatedSub(Mthd, Params, Callees);
|
||||
Subroutine = new ATranslatedSub(Mthd, Params);
|
||||
}
|
||||
|
||||
private void InitLocals()
|
||||
|
@ -115,7 +115,7 @@ namespace ChocolArm64.Translation
|
|||
Generator.EmitLdarg(Index + ParamsStart);
|
||||
Generator.EmitStloc(GetLocalIndex(Reg));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Type[] GetParamTypes(IList<ARegister> Params)
|
||||
{
|
||||
|
|
|
@ -12,8 +12,6 @@ namespace ChocolArm64.Translation
|
|||
{
|
||||
private ATranslator Translator;
|
||||
|
||||
private HashSet<long> Callees;
|
||||
|
||||
private Dictionary<long, AILLabel> Labels;
|
||||
|
||||
private int BlkIndex;
|
||||
|
@ -66,8 +64,6 @@ namespace ChocolArm64.Translation
|
|||
this.Graph = Graph;
|
||||
this.Root = Root;
|
||||
|
||||
Callees = new HashSet<long>();
|
||||
|
||||
Labels = new Dictionary<long, AILLabel>();
|
||||
|
||||
Emitter = new AILEmitter(Graph, Root, SubName);
|
||||
|
@ -84,7 +80,7 @@ namespace ChocolArm64.Translation
|
|||
|
||||
public ATranslatedSub GetSubroutine()
|
||||
{
|
||||
return Emitter.GetSubroutine(Callees);
|
||||
return Emitter.GetSubroutine();
|
||||
}
|
||||
|
||||
public bool AdvanceOpCode()
|
||||
|
@ -123,8 +119,6 @@ namespace ChocolArm64.Translation
|
|||
|
||||
public bool TryOptEmitSubroutineCall()
|
||||
{
|
||||
Callees.Add(((AOpCodeBImm)CurrOp).Imm);
|
||||
|
||||
if (CurrBlock.Next == null)
|
||||
{
|
||||
return false;
|
||||
|
@ -152,6 +146,8 @@ namespace ChocolArm64.Translation
|
|||
|
||||
EmitCall(Sub.Method);
|
||||
|
||||
Sub.AddCaller(Root.Position);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue