chore(ir): dump formatını sade yap — NAME=... PARAMS=... SLOTS=...

This commit is contained in:
saqut 2026-06-18 19:29:32 +03:00
parent 4c67f29362
commit 7b8b2398cd
4 changed files with 11 additions and 7 deletions

Binary file not shown.

View File

@ -23,3 +23,6 @@
2 3078 1781799345769137653 CMakeFiles/saqut.dir/src/ir/ir_generator.cpp.o 10a1ed4e1f52e530 2 3078 1781799345769137653 CMakeFiles/saqut.dir/src/ir/ir_generator.cpp.o 10a1ed4e1f52e530
1 636 1781799663202595202 CMakeFiles/saqut.dir/src/ir/ir_function.cpp.o 10f5e8dfd1461d69 1 636 1781799663202595202 CMakeFiles/saqut.dir/src/ir/ir_function.cpp.o 10f5e8dfd1461d69
636 892 1781799663837592468 saqut f2e198803c4dbffb 636 892 1781799663837592468 saqut f2e198803c4dbffb
1 653 1781800137590930314 CMakeFiles/saqut.dir/src/ir/ir_program.cpp.o 9518231d970828da
1 658 1781800137589789659 CMakeFiles/saqut.dir/src/ir/ir_function.cpp.o 10f5e8dfd1461d69
658 919 1781800138246787400 saqut f2e198803c4dbffb

View File

@ -60,17 +60,18 @@ void IRFunction::dump() const {
} }
header += " [" + std::to_string(slotCount) + " slot]"; header += " [" + std::to_string(slotCount) + " slot]";
// Üst çizgi // Başlık: NAME=fibonacci PARAMS=1 SLOTS=10
std::cout << "+-" << std::string(header.size(), '-') << "-+\n"; std::cout << "NAME=" << name
std::cout << "|" << header << " |\n"; << " PARAMS=" << paramCount
std::cout << "+-" << std::string(header.size(), '-') << "-+\n"; << " SLOTS=" << slotCount
<< "\n";
// Talimatlar // Talimatlar
for (int i = 0; i < (int)instructions.size(); i++) { for (int i = 0; i < (int)instructions.size(); i++) {
const Instruction& ins = instructions[i]; const Instruction& ins = instructions[i];
// Satır numarası // Satır numarası
std::cout << " " << std::setw(3) << std::right << i << " "; std::cout << " " << std::setw(3) << std::right << i << " ";
// Opcode sütunu (12 karakter genişlik) // Opcode sütunu (12 karakter genişlik)
std::cout << std::left << std::setw(12) << opcodeName(ins.opcode); std::cout << std::left << std::setw(12) << opcodeName(ins.opcode);

View File

@ -2,10 +2,10 @@
#include <iostream> #include <iostream>
void IRProgram::dump() const { void IRProgram::dump() const {
std::cout << "========== IR DUMP ==========\n\n"; std::cout << "IR DUMP\n\n";
for (const auto& name : functionOrder) { for (const auto& name : functionOrder) {
auto it = functions.find(name); auto it = functions.find(name);
if (it != functions.end()) it->second.dump(); if (it != functions.end()) it->second.dump();
} }
std::cout << "=============================\n"; std::cout << "END\n";
} }