Files
FEX-Emu--FEX/External/FEXCore/Source/Interface/IR/PassManager.cpp
T
Stefanos Kornilios Mitsis Poiitidis 93e372c7a4 IR/JITs: Inline Constants Implementation
Based on @phire's idea, Inline constants are constants that can be used as imms in instructions.

This
- Adds OP_INLINECONSTANT to represent them in the IR
- Modifies the ConstProp pass to transform OP_CONSTANT to OP_INLINECONSTANT based on per-platform heuristics
- Modifies the backends to use imms
- Supported opcodes: Add, Sub, Lsl, Lsr, Asr, Ror, Rol
2020-10-22 18:49:17 +03:00

44 lines
1.3 KiB
C++

#include "Interface/IR/Passes.h"
#include "Interface/IR/Passes/RegisterAllocationPass.h"
#include "Interface/IR/PassManager.h"
namespace FEXCore::IR {
void PassManager::AddDefaultPasses(bool InlineConstants) {
InsertPass(CreateContextLoadStoreElimination());
InsertPass(CreateConstProp(InlineConstants));
////// InsertPass(CreateDeadFlagCalculationEliminination());
InsertPass(CreateDeadFlagStoreElimination());
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() {
#if defined(ASSERTIONS_ENABLED) && ASSERTIONS_ENABLED
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);
}
#if defined(ASSERTIONS_ENABLED) && ASSERTIONS_ENABLED
for (auto const &Pass : ValidationPasses) {
Changed |= Pass->Run(IREmit);
}
#endif
return Changed;
}
}