Commit Graph
91 Commits
Author SHA1 Message Date
Ryan Houdek afdbd9ebdc Fixes issues with PSLLDQ and PSRLDQ
These are whole vector shift instructions and they shift by bytes rather
than bits.
You only get an immediate offset for the instruction.
Implements two new IR ops to account for these instructions

This also doesn't match AArch64 behaviour 100%, requires two
instructions to emulate rather than the single one on the x86-side
2020-03-06 07:55:59 +02:00
Ryan Houdek af6eefb495 Fixes crash in IR Interpreter that can occur with large functions
If the tmp space grew too large and had to resize then we would have
stale pointers.
Keep around the offset instead so we don't store invalid pointers.
2020-03-06 07:55:59 +02:00
Ryan Houdek 3568cdb03b Adds VBITCast to IR Interpreter 2020-03-06 07:55:59 +02:00
Ryan Houdek 33ebeef246 Fixes IR Interpreter
Updates it to support the IR style and branching requirements.
2020-03-06 07:55:59 +02:00
Ryan Houdek 41ed7ca126 Fixes compile failures
Didn't get caught previously because of my dirty build directory
2020-03-06 07:55:59 +02:00
Ryan Houdek bc294164e3 Updates project to allow it to be installed
Installs as both a static library and a shared library
2020-03-06 07:55:59 +02:00
Ryan Houdek 939e210a68 Updates SonicUtils
Makes changes to match latest changes
2020-03-06 07:55:54 +02:00
Ryan Houdek 9e910520c6 Adds placeholder Guest call/ret IROps
Will be used in the future
2020-03-06 07:55:46 +02:00
Ryan Houdek b58b5687e0 Fixes AArch64 custom ASM dispatcher 2020-03-06 07:55:46 +02:00
Ryan Houdek 6e72a365d9 Fixes for the AArch64 JIT
Custom dispatcher isn't fully working yet, but fixes a few other bugs.
2020-03-06 07:55:46 +02:00
Ryan Houdek cb81d0a1af Fixes CondJump on AArch64 JIT 2020-03-06 07:55:46 +02:00
Ryan Houdek efdf490c3c Adds support for ARM on the LLVM JIT 2020-03-06 07:55:46 +02:00
Scott Mansell a9d36dda6c Fix mmapping of subregions 2020-03-06 07:55:45 +02:00
Scott Mansell 20fc6a489e Fix STOS to not load SSA regs across blocks 2020-03-06 07:55:45 +02:00
Ryan Houdek 87e6b7108f Adds an unsafe disabled flag elimination pass
This is a very useful optimization, but may only become "safe" once we
recompile a full function.
2020-03-06 07:55:45 +02:00
Ryan Houdek ee53b70bfe Actually enable LLVM optimization passes in the LLVM JIT
We were using whatever was the LLVM default before.
2020-03-06 07:55:45 +02:00
Ryan Houdek 9e132e107a Adds alignment information to the mem loadstore IR ops
Allows us to not always emit unaligned loadstore ops for these
2020-03-06 07:55:45 +02:00
Ryan Houdek f697da77b6 Splits up, documents, and extends the RCLE pass
Splits this pass in to three parts.
First function is to remove StoreContext-LoadContext pairs that are
redundant. Removes the Load that has occured after a store-load pair.

Second function is to remove LoadContext instructions that are redundant
due to no other stores to that location

Third function is to remove StoreContext instructions that are redundant
due to no load happening between them (Relies on previous functions)
2020-03-06 07:55:45 +02:00
Ryan Houdek 6dc7d2e679 Extends IR Validation to check exit to be correct
Checks to ensure the last op in a block is EndBlock.
Checks to ensure the last instruction before that one is one of the ops
that exit correctly. So ExitFunction, Jump, CondJump, or Break.
2020-03-06 07:55:45 +02:00
Ryan Houdek f8b858e7fc Removes the EndFunction IR Op 2020-03-06 07:55:45 +02:00
Ryan Houdek 9218df31c2 Re-enables RCLE pass since it works with the better IR now 2020-03-06 07:55:44 +02:00
Ryan Houdek e2bce88eb0 Adds aligned XMM tracking to RCLE pass 2020-03-06 07:55:44 +02:00
Ryan Houdek db7b3d415d Adds VBitcast IR op
Casts vector to a integer of the same width as the vector
2020-03-06 07:55:44 +02:00
Ryan Houdek 3eb55d5f9f Fixes LLVM JIT with multiblock 2020-03-06 07:55:44 +02:00
Ryan Houdek 435357e06e Fixes a bug in STOS 2020-03-06 07:55:44 +02:00
Ryan Houdek 4e5d9452f7 Syscall doesn't end a block 2020-03-06 07:55:44 +02:00
Ryan Houdek a8d2cb4a9f Fixes LLVM JIT
Doesn't yet work with multiblock
2020-03-06 07:55:44 +02:00
Ryan Houdek 3a041c3b1c Fixes bug in block creation for any block containing RET.
Would have a redundant StoreContext after the RET which broke IR
analysis
2020-03-06 07:55:44 +02:00
Ryan Houdek e1cecbcfe3 Changes to the new multiblock frontend decoder
Simple linear scan forward of instruction decoding isn't viable to do.
We need to break up the decoding at the block boundaries.
Otherwise our decoding gets in to the weeds and decodes trash.
2020-03-06 07:55:37 +02:00
Ryan Houdek 5db8de625a Adds a few new instructions to the X86Tables
I managed to hit these when messing with Multiblock.
2020-03-06 07:55:37 +02:00
Ryan Houdek 704b8f9679 Disables Redundant Context Load Elimination pass.
It's currently broken (Due to not 100% valid IR?)
2020-03-06 07:55:37 +02:00
Ryan Houdek b199ce70e9 Changes over IRValidation to the new format.
We still can't pass this validation pass
2020-03-06 07:55:37 +02:00
Ryan Houdek b7c7a34cf6 Changes (aggressively) how branching is handled in the frontend.
This changes over CondJump to have a defined True and False branch path.
Additionally needing to change over everything to handle this.
This now means that a false branch condition will no longer assume
fallthrough past this instruction.
Currently the x86-64 JIT generates an additional jmp instruction on
fallthrough that isn't optimized away.

This is working towards improvements in our IR branching model and
improving IRValidation in doing so.
This is working towards the model that IRBlocks can only have 0-2
successors.
Ret/Exit - 0 successors
Jump - 2 successors
CondJump - 2 successors

TBD:
Syscall/CPUID - Breaking block?
2020-03-06 07:55:37 +02:00
Ryan Houdek fc8c6c80fb Makes sure in Frontend we say that Entry and ConditionalJump fallthroughs are JumpTargets 2020-03-06 07:55:37 +02:00
Ryan Houdek 7da7880a41 Splits X86Table definitions in to multiple files
Allows YouCompleteMe to handle these files and makes recompiling less of
a pain when one line is changed.
2020-03-06 07:55:36 +02:00
Scott Mansell 86fc779f81 Add getcwd syscall 2020-03-06 07:55:36 +02:00
Scott Mansell 597ee06243 Add ConstProp for Mul 2020-03-06 07:55:36 +02:00
Scott Mansell 5263f94d84 Elimitate loads before const prop 2020-03-06 07:55:36 +02:00
Scott Mansell b148afef4b Add Dead Code Elimitation pass
Refactor the previous WIP to use NumUses
2020-03-06 07:55:36 +02:00
Scott Mansell b34465544a Fix Incorrect tracking during Redudent Flag pass 2020-03-06 07:55:36 +02:00
Scott Mansell 8e34a74030 Keep node usage when compacting 2020-03-06 07:55:36 +02:00
Scott Mansell d1f2d85d0c Fix up usage tracking of Args.
Make sure we keep them up to date when removing
nodes.
2020-03-06 07:55:36 +02:00
Scott Mansell b054807270 WIP Dead Code Elimitation pass 2020-03-06 07:55:36 +02:00
Ryan Houdek aabc6f6de2 Extends ConstProp pass a bit more.
Still doesn't cover all the IROps but it hits quite a few more that I
could see.
2020-03-06 07:55:35 +02:00
Ryan Houdek 160240dc23 Adds a few AVX instructions to the X86Tables 2020-03-06 07:55:35 +02:00
Ryan Houdek 6890ae4e20 Adds an inblock time sampling routine to the x86-64 JIT
Useful for a quick overview of the time spent in a function. It isn't
amazing for profiling since it effects the time in the function by
itself.
Only useful as a reference.
2020-03-06 07:55:35 +02:00
Ryan Houdek 0a959475c5 Removes support for non-RA path on x86-64 JIT
RA is now fully working, so this path is no longer necessary
2020-03-06 07:55:35 +02:00
Ryan Houdek 668d392eb7 Adds support for spilling in the AArch64 JIT 2020-03-06 07:55:35 +02:00
Ryan Houdek 0eb86389de Cleans up RA spill slot calculation.
RA spill slots now have live ranges so we can reuse the spill slot.
This can reduce spill stack usage significantly in code ranges with
large live ranges.
2020-03-06 07:55:35 +02:00
Ryan Houdek 012805fd72 Fixes multiblock and a few bugs in RA.
This makes it so multiblock can now be enabled with the JITs.
Results in a decent performance increase by itself.
2020-03-06 07:55:35 +02:00