diff options
-rw-r--r-- | src/qml/jit/qv4isel_masm.cpp | 2 | ||||
-rw-r--r-- | src/qml/jit/qv4regalloc.cpp | 42 | ||||
-rw-r--r-- | src/qml/jit/qv4registerinfo_p.h | 1 |
3 files changed, 42 insertions, 3 deletions
diff --git a/src/qml/jit/qv4isel_masm.cpp b/src/qml/jit/qv4isel_masm.cpp index b35db9766b..f6c1a03273 100644 --- a/src/qml/jit/qv4isel_masm.cpp +++ b/src/qml/jit/qv4isel_masm.cpp @@ -231,8 +231,8 @@ void InstructionSelection::run(int functionIndex) // No register allocator available for this platform, or env. var was set, so: opt.convertOutOfSSA(); ConvertTemps().toStackSlots(_function); + IR::Optimizer::showMeTheCode(_function); } - IR::Optimizer::showMeTheCode(_function); QSet<IR::Jump *> removableJumps = opt.calculateOptionalJumps(); qSwap(_removableJumps, removableJumps); diff --git a/src/qml/jit/qv4regalloc.cpp b/src/qml/jit/qv4regalloc.cpp index cb24db36b9..a673cd308a 100644 --- a/src/qml/jit/qv4regalloc.cpp +++ b/src/qml/jit/qv4regalloc.cpp @@ -95,6 +95,41 @@ protected: *out << ": "; } }; + +class IRPrinterWithRegisters: public IRPrinterWithPositions +{ + const RegisterInformation &_registerInformation; + QHash<int, const RegisterInfo *> _infoForRegister; + +public: + IRPrinterWithRegisters(QTextStream *out, const LifeTimeIntervals::Ptr &intervals, + const RegisterInformation ®isterInformation) + : IRPrinterWithPositions(out, intervals) + , _registerInformation(registerInformation) + { + for (int i = 0, ei = _registerInformation.size(); i != ei; ++i) + _infoForRegister.insert(_registerInformation.at(i).reg<int>(), + &_registerInformation.at(i)); + } + +protected: + void visitTemp(Temp *e) + { + switch (e->kind) { + case Temp::PhysicalRegister: { + const RegisterInfo *ri = _infoForRegister.value(e->index, 0); + if (ri) { + *out << dumpStart(e); + *out << ri->prettyName(); + *out << dumpEnd(e); + break; + } + } + default: + IRPrinterWithPositions::visitTemp(e); + } + } +}; } class RegAllocInfo: public IRDecoder @@ -1237,10 +1272,13 @@ void RegisterAllocator::run(IR::Function *function, const Optimizer &opt) function->tempCount = *std::max_element(_assignedSpillSlots.begin(), _assignedSpillSlots.end()) + 1; - if (DebugRegAlloc) { + if (DebugRegAlloc) qDebug() << "*** Finished regalloc , result:"; + + static bool showCode = !qgetenv("QV4_SHOW_IR").isNull(); + if (showCode) { QTextStream qout(stdout, QIODevice::WriteOnly); - IRPrinterWithPositions(&qout, _lifeTimeIntervals).print(function); + IRPrinterWithRegisters(&qout, _lifeTimeIntervals, _registerInformation).print(function); } } diff --git a/src/qml/jit/qv4registerinfo_p.h b/src/qml/jit/qv4registerinfo_p.h index b9bef678a3..b8701d72f4 100644 --- a/src/qml/jit/qv4registerinfo_p.h +++ b/src/qml/jit/qv4registerinfo_p.h @@ -75,6 +75,7 @@ public: bool isValid() const { return _reg != InvalidRegister; } template <typename T> T reg() const { return static_cast<T>(_reg); } + QString prettyName() const { return _prettyName; } bool isCallerSaved() const { return _savedBy == CallerSaved; } bool isCalleeSaved() const { return _savedBy == CalleeSaved; } bool isFloatingPoint() const { return _type == FloatingPointRegister; } |