diff options
author | FICTURE7 <FICTURE7@gmail.com> | 2021-09-29 03:38:37 +0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-29 01:38:37 +0200 |
commit | 312be74861dae16311f4376e32195f8a4fd372c6 (patch) | |
tree | 43b9937541dc1d3359ab18b3c45533f9de2b1b28 /ARMeilleure/CodeGen/X86/CodeGenerator.cs | |
parent | 1ae690ba2f407042456207d40e425f8b1f900863 (diff) |
Optimize `HybridAllocator` (#2637)
* Store constant `Operand`s in the `LocalInfo`
Since the spill slot and register assigned is fixed, we can just store
the `Operand` reference in the `LocalInfo` struct. This allows skipping
hitting the intern-table for a look up.
* Skip `Uses`/`Assignments` management
Since the `HybridAllocator` is the last pass and we do not care about
uses/assignments we can skip managing that when setting destinations or
sources.
* Make `GetLocalInfo` inlineable
Also fix a possible issue where with numbered locals. See or-assignment
operator in `SetVisited(local)` before patch.
* Do not run `BlockPlacement` in LCQ
With the host mapped memory manager, there is a lot less cold code to
split from hot code. So disabling this in LCQ gives some extra
throughput - where we need it.
* Address Mou-Ikkai's feedback
* Apply suggestions from code review
Co-authored-by: VocalFan <45863583+Mou-Ikkai@users.noreply.github.com>
* Move check to an assert
Co-authored-by: VocalFan <45863583+Mou-Ikkai@users.noreply.github.com>
Diffstat (limited to 'ARMeilleure/CodeGen/X86/CodeGenerator.cs')
-rw-r--r-- | ARMeilleure/CodeGen/X86/CodeGenerator.cs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/ARMeilleure/CodeGen/X86/CodeGenerator.cs b/ARMeilleure/CodeGen/X86/CodeGenerator.cs index 924c113c..ba2df802 100644 --- a/ARMeilleure/CodeGen/X86/CodeGenerator.cs +++ b/ARMeilleure/CodeGen/X86/CodeGenerator.cs @@ -97,16 +97,18 @@ namespace ARMeilleure.CodeGen.X86 Logger.StartPass(PassName.Optimization); - if ((cctx.Options & CompilerOptions.SsaForm) != 0 && - (cctx.Options & CompilerOptions.Optimize) != 0) + if (cctx.Options.HasFlag(CompilerOptions.Optimize)) { - Optimizer.RunPass(cfg); + if (cctx.Options.HasFlag(CompilerOptions.SsaForm)) + { + Optimizer.RunPass(cfg); + } + + BlockPlacement.RunPass(cfg); } X86Optimizer.RunPass(cfg); - BlockPlacement.RunPass(cfg); - Logger.EndPass(PassName.Optimization, cfg); Logger.StartPass(PassName.PreAllocation); @@ -119,14 +121,14 @@ namespace ARMeilleure.CodeGen.X86 Logger.StartPass(PassName.RegisterAllocation); - if ((cctx.Options & CompilerOptions.SsaForm) != 0) + if (cctx.Options.HasFlag(CompilerOptions.SsaForm)) { Ssa.Deconstruct(cfg); } IRegisterAllocator regAlloc; - if ((cctx.Options & CompilerOptions.Lsra) != 0) + if (cctx.Options.HasFlag(CompilerOptions.Lsra)) { regAlloc = new LinearScanAllocator(); } |