void generateToAir(Procedure& procedure, unsigned optLevel) { TimingScope timingScope("generateToAir"); if (shouldDumpIR(B3Mode) && !shouldDumpIRAtEachPhase(B3Mode)) { dataLog("Initial B3:\n"); dataLog(procedure); } // We don't require the incoming IR to have predecessors computed. procedure.resetReachability(); if (shouldValidateIR()) validate(procedure); if (optLevel >= 1) { reduceDoubleToFloat(procedure); reduceStrength(procedure); eliminateCommonSubexpressions(procedure); inferSwitches(procedure); duplicateTails(procedure); fixSSA(procedure); foldPathConstants(procedure); // FIXME: Add more optimizations here. // https://bugs.webkit.org/show_bug.cgi?id=150507 } lowerMacros(procedure); if (optLevel >= 1) { reduceStrength(procedure); // FIXME: Add more optimizations here. // https://bugs.webkit.org/show_bug.cgi?id=150507 } lowerMacrosAfterOptimizations(procedure); legalizeMemoryOffsets(procedure); moveConstants(procedure); // FIXME: We should run pureCSE here to clean up some platform specific changes from the previous phases. // https://bugs.webkit.org/show_bug.cgi?id=164873 if (shouldValidateIR()) validate(procedure); // If we're doing super verbose dumping, the phase scope of any phase will already do a dump. // Note that lowerToAir() acts like a phase in this regard. if (shouldDumpIR(B3Mode) && !shouldDumpIRAtEachPhase(B3Mode)) { dataLog("B3 after ", procedure.lastPhaseName(), ", before generation:\n"); dataLog(procedure); } lowerToAir(procedure); }
void duplicateTails(Procedure& proc) { PhaseScope phaseScope(proc, "duplicateTails"); DuplicateTails duplicateTails(proc); duplicateTails.run(); }