diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2018-04-11 14:44:03 -0300 |
|---|---|---|
| committer | gdkchan <gab.dark.100@gmail.com> | 2018-04-11 14:44:03 -0300 |
| commit | 9227b0ea59c6f5f5233bbedf633dc68097275129 (patch) | |
| tree | 591f0e3dbc05d53e92ca8c7e4e7fc23e69ed6a23 /ChocolArm64/Translation | |
| parent | 46548bbc416ed4f5a53dade6a172b9eec2644ba0 (diff) | |
[CPU] Speed up translation a little bit
Diffstat (limited to 'ChocolArm64/Translation')
| -rw-r--r-- | ChocolArm64/Translation/AILEmitter.cs | 10 | ||||
| -rw-r--r-- | ChocolArm64/Translation/AILEmitterCtx.cs | 10 |
2 files changed, 8 insertions, 12 deletions
diff --git a/ChocolArm64/Translation/AILEmitter.cs b/ChocolArm64/Translation/AILEmitter.cs index af37a6c7..55b1751f 100644 --- a/ChocolArm64/Translation/AILEmitter.cs +++ b/ChocolArm64/Translation/AILEmitter.cs @@ -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) { diff --git a/ChocolArm64/Translation/AILEmitterCtx.cs b/ChocolArm64/Translation/AILEmitterCtx.cs index 03b06610..2f4a67e1 100644 --- a/ChocolArm64/Translation/AILEmitterCtx.cs +++ b/ChocolArm64/Translation/AILEmitterCtx.cs @@ -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; } |
