mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-13 19:00:43 +02:00
The Passmanager passes need very little or zero x86 knowledge to do their work. They don't need the x86 OpDispatcher handling code at all. Convert this entirely over to using the IREmitter class so it can actually optimize IR code from the IRLoader frontend
43 lines
1.2 KiB
C++
43 lines
1.2 KiB
C++
#include "Interface/IR/Passes.h"
|
|
#include "Interface/IR/Passes/RegisterAllocationPass.h"
|
|
#include "Interface/IR/PassManager.h"
|
|
|
|
namespace FEXCore::IR {
|
|
|
|
void PassManager::AddDefaultPasses() {
|
|
InsertPass(CreateContextLoadStoreElimination());
|
|
InsertPass(CreateConstProp());
|
|
////// InsertPass(CreateDeadFlagCalculationEliminination());
|
|
InsertPass(CreateSyscallOptimization());
|
|
InsertPass(CreatePassDeadCodeElimination());
|
|
|
|
// If the IR is compacted post-RA then the node indexing gets messed up and the backend isn't able to find the register assigned to a node
|
|
// Compact before IR, don't worry about RA generating spills/fills
|
|
InsertPass(CreateIRCompaction());
|
|
}
|
|
|
|
void PassManager::AddDefaultValidationPasses() {
|
|
#ifndef NDEBUG
|
|
InsertValidationPass(Validation::CreatePhiValidation());
|
|
InsertValidationPass(Validation::CreateIRValidation());
|
|
InsertValidationPass(Validation::CreateValueDominanceValidation());
|
|
#endif
|
|
}
|
|
|
|
bool PassManager::Run(IREmitter *IREmit) {
|
|
bool Changed = false;
|
|
for (auto const &Pass : Passes) {
|
|
Changed |= Pass->Run(IREmit);
|
|
}
|
|
|
|
#ifndef NDEBUG
|
|
for (auto const &Pass : ValidationPasses) {
|
|
Changed |= Pass->Run(IREmit);
|
|
}
|
|
#endif
|
|
|
|
return Changed;
|
|
}
|
|
|
|
}
|