Skip to content

Commit

Permalink
Merge pull request #17852 from unknownbrackets/riscv-centralize
Browse files Browse the repository at this point in the history
IR: centralize common parts of native backend
  • Loading branch information
hrydgard authored Aug 6, 2023
2 parents 68a15f4 + 93e3d35 commit ea65931
Show file tree
Hide file tree
Showing 20 changed files with 913 additions and 653 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1556,6 +1556,8 @@ set(CoreExtra ${CoreExtra}
Core/MIPS/IR/IRInterpreter.h
Core/MIPS/IR/IRJit.cpp
Core/MIPS/IR/IRJit.h
Core/MIPS/IR/IRNativeCommon.cpp
Core/MIPS/IR/IRNativeCommon.h
Core/MIPS/IR/IRPassSimplify.cpp
Core/MIPS/IR/IRPassSimplify.h
Core/MIPS/IR/IRRegCache.cpp
Expand Down
2 changes: 1 addition & 1 deletion Common/CodeBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class CodeBlockCommon {

virtual const u8 *GetCodePtr() const = 0;

u8 *GetBasePtr() {
u8 *GetBasePtr() const {
return region;
}

Expand Down
2 changes: 2 additions & 0 deletions Core/Core.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@
<ClCompile Include="MIPS\IR\IRInst.cpp" />
<ClCompile Include="MIPS\IR\IRInterpreter.cpp" />
<ClCompile Include="MIPS\IR\IRJit.cpp" />
<ClCompile Include="MIPS\IR\IRNativeCommon.cpp" />
<ClCompile Include="MIPS\IR\IRPassSimplify.cpp" />
<ClCompile Include="MIPS\IR\IRRegCache.cpp" />
<ClCompile Include="MIPS\MIPSVFPUFallbacks.cpp" />
Expand Down Expand Up @@ -1170,6 +1171,7 @@
<ClInclude Include="MIPS\IR\IRInst.h" />
<ClInclude Include="MIPS\IR\IRInterpreter.h" />
<ClInclude Include="MIPS\IR\IRJit.h" />
<ClInclude Include="MIPS\IR\IRNativeCommon.h" />
<ClInclude Include="MIPS\IR\IRPassSimplify.h" />
<ClInclude Include="MIPS\IR\IRRegCache.h" />
<ClInclude Include="MIPS\MIPSVFPUFallbacks.h" />
Expand Down
6 changes: 6 additions & 0 deletions Core/Core.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,9 @@
<ClCompile Include="MIPS\IR\IRAnalysis.cpp">
<Filter>MIPS\IR</Filter>
</ClCompile>
<ClCompile Include="MIPS\IR\IRNativeCommon.cpp">
<Filter>MIPS\IR</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="ELF\ElfReader.h">
Expand Down Expand Up @@ -1998,6 +2001,9 @@
<ClInclude Include="MIPS\IR\IRAnalysis.h">
<Filter>MIPS\IR</Filter>
</ClInclude>
<ClInclude Include="MIPS\IR\IRNativeCommon.h">
<Filter>MIPS\IR</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\LICENSE.TXT" />
Expand Down
9 changes: 8 additions & 1 deletion Core/MIPS/IR/IRJit.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ class IRBlockCache : public JitBlockCacheDebugInterface {
return nullptr;
}
}
const IRBlock *GetBlock(int i) const {
if (i >= 0 && i < (int)blocks_.size()) {
return &blocks_[i];
} else {
return nullptr;
}
}

int FindPreloadBlock(u32 em_address);
int FindByCookie(int cookie);
Expand Down Expand Up @@ -180,7 +187,7 @@ class IRJit : public JitInterface {
void UnlinkBlock(u8 *checkedEntry, u32 originalAddress) override;

protected:
virtual bool CompileBlock(u32 em_address, std::vector<IRInst> &instructions, u32 &mipsBytes, bool preload);
bool CompileBlock(u32 em_address, std::vector<IRInst> &instructions, u32 &mipsBytes, bool preload);
virtual bool CompileTargetBlock(IRBlock *block, int block_num, bool preload) { return true; }

JitOptions jo;
Expand Down
Loading

0 comments on commit ea65931

Please sign in to comment.