MCPcopy Create free account
hub / github.com/FEX-Emu/FEX / Finalize

Method Finalize

FEXCore/Source/Interface/IR/PassManager.cpp:21–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19class IREmitter;
20
21void PassManager::Finalize() {
22 if (!PassManagerDumpIR()) {
23 // Not configured to dump any IR, just return.
24 return;
25 }
26
27 auto it = Passes.begin();
28 // Walk the passes and add them where asked.
29 if (PassManagerDumpIR() & FEXCore::Config::PassManagerDumpIR::BEFOREOPT) {
30 // Insert at the start.
31 it = InsertAt(it, Debug::CreateIRDumper());
32 ++it; // Skip what we inserted.
33 }
34
35 if ((PassManagerDumpIR() & FEXCore::Config::PassManagerDumpIR::BEFOREPASS) ||
36 (PassManagerDumpIR() & FEXCore::Config::PassManagerDumpIR::AFTERPASS)) {
37
38 bool SkipFirstBefore = PassManagerDumpIR() & FEXCore::Config::PassManagerDumpIR::BEFOREOPT;
39 for (; it != Passes.end();) {
40 if (PassManagerDumpIR() & FEXCore::Config::PassManagerDumpIR::BEFOREPASS) {
41 if (SkipFirstBefore) {
42 // If we need to skip the first one, then continue.
43 SkipFirstBefore = false;
44 ++it;
45 continue;
46 }
47
48 // Insert before
49 it = InsertAt(it, Debug::CreateIRDumper());
50 ++it; // Skip what we inserted.
51 }
52
53 ++it; // Skip current pass.
54 if (PassManagerDumpIR() & FEXCore::Config::PassManagerDumpIR::AFTERPASS) {
55 // Insert after
56 it = InsertAt(it, Debug::CreateIRDumper());
57 ++it; // Skip what we inserted.
58 }
59 }
60 }
61 if (PassManagerDumpIR() & FEXCore::Config::PassManagerDumpIR::AFTEROPT) {
62 if (!(PassManagerDumpIR() & FEXCore::Config::PassManagerDumpIR::AFTERPASS)) {
63 // Insert final IRDumper.
64 InsertAt(Passes.end(), Debug::CreateIRDumper());
65 }
66 }
67}
68
69void PassManager::AddDefaultPasses(FEXCore::Context::ContextImpl* ctx) {
70 FEX_CONFIG_OPT(DisablePasses, O0);

Callers

nothing calls this directly

Calls 3

CreateIRDumperFunction · 0.85
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected