mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-10-01 12:30:00 +02:00
61634dd415
* Initial cache memory allocator implementation * Get rid of CallFlag * Perform cache cleanup on exit * Basic cache invalidation * Thats not how conditionals works in C# it seems * Set PTC version to PR number * Address PR feedback * Update InstEmitFlowHelper.cs * Flag clear on address is no longer needed * Do not include exit block in function size calculation * Dispose jump table * For future use * InternalVersion = 1519 (force retest). Co-authored-by: LDj3SNuD <35856442+LDj3SNuD@users.noreply.github.com>
63 lines
No EOL
1.8 KiB
C#
63 lines
No EOL
1.8 KiB
C#
using ARMeilleure.CodeGen;
|
|
using ARMeilleure.CodeGen.X86;
|
|
using ARMeilleure.Diagnostics;
|
|
using ARMeilleure.IntermediateRepresentation;
|
|
using ARMeilleure.Translation.Cache;
|
|
using ARMeilleure.Translation.PTC;
|
|
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace ARMeilleure.Translation
|
|
{
|
|
static class Compiler
|
|
{
|
|
public static T Compile<T>(
|
|
ControlFlowGraph cfg,
|
|
OperandType[] argTypes,
|
|
OperandType retType,
|
|
CompilerOptions options,
|
|
PtcInfo ptcInfo = null)
|
|
{
|
|
CompiledFunction func = Compile(cfg, argTypes, retType, options, ptcInfo);
|
|
|
|
IntPtr codePtr = JitCache.Map(func);
|
|
|
|
return Marshal.GetDelegateForFunctionPointer<T>(codePtr);
|
|
}
|
|
|
|
public static CompiledFunction Compile(
|
|
ControlFlowGraph cfg,
|
|
OperandType[] argTypes,
|
|
OperandType retType,
|
|
CompilerOptions options,
|
|
PtcInfo ptcInfo = null)
|
|
{
|
|
Logger.StartPass(PassName.Dominance);
|
|
|
|
if ((options & CompilerOptions.SsaForm) != 0)
|
|
{
|
|
Dominance.FindDominators(cfg);
|
|
Dominance.FindDominanceFrontiers(cfg);
|
|
}
|
|
|
|
Logger.EndPass(PassName.Dominance);
|
|
|
|
Logger.StartPass(PassName.SsaConstruction);
|
|
|
|
if ((options & CompilerOptions.SsaForm) != 0)
|
|
{
|
|
Ssa.Construct(cfg);
|
|
}
|
|
else
|
|
{
|
|
RegisterToLocal.Rename(cfg);
|
|
}
|
|
|
|
Logger.EndPass(PassName.SsaConstruction, cfg);
|
|
|
|
CompilerContext cctx = new CompilerContext(cfg, argTypes, retType, options);
|
|
|
|
return CodeGenerator.Generate(cctx, ptcInfo);
|
|
}
|
|
}
|
|
} |