[backend]回溯了旧版本的寄存器分配器
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include "RISCv64ISel.h"
|
||||
#include "RISCv64RegAlloc.h"
|
||||
#include "RISCv64LinearScan.h"
|
||||
#include "RISCv64SimpleRegAlloc.h"
|
||||
#include "RISCv64BasicBlockAlloc.h"
|
||||
#include "RISCv64AsmPrinter.h"
|
||||
#include "RISCv64Passes.h"
|
||||
@@ -197,6 +198,8 @@ std::string RISCv64CodeGen::module_gen() {
|
||||
}
|
||||
|
||||
std::string RISCv64CodeGen::function_gen(Function* func) {
|
||||
DEBUG = 0;
|
||||
DEEPDEBUG = 0;
|
||||
// === 完整的后端处理流水线 ===
|
||||
|
||||
// 阶段 1: 指令选择 (sysy::IR -> LLIR with virtual registers)
|
||||
@@ -217,7 +220,7 @@ std::string RISCv64CodeGen::function_gen(Function* func) {
|
||||
EliminateFrameIndicesPass efi_pass;
|
||||
efi_pass.runOnMachineFunction(mfunc.get());
|
||||
|
||||
if (DEBUG) {
|
||||
if (true) {
|
||||
std::cerr << "====== stack info after eliminate frame indices ======\n";
|
||||
mfunc->dumpStackFrameInfo(std::cerr);
|
||||
std::stringstream ss_after_eli;
|
||||
@@ -237,7 +240,17 @@ std::string RISCv64CodeGen::function_gen(Function* func) {
|
||||
// 阶段 3: 物理寄存器分配 (Register Allocation)
|
||||
|
||||
// 首先尝试图着色分配器
|
||||
if (DEBUG) std::cerr << "Attempting Register Allocation with Graph Coloring...\n";
|
||||
// int fooo = 0;
|
||||
int fooo = 0;
|
||||
// DEBUG = 1;
|
||||
// DEEPDEBUG = 1;
|
||||
if (fooo) {
|
||||
RISCv64SimpleRegAlloc simple_alloc(mfunc.get());
|
||||
simple_alloc.run();
|
||||
DEBUG = 0;
|
||||
DEEPDEBUG = 0;
|
||||
} else
|
||||
{if (DEBUG) std::cerr << "Attempting Register Allocation with Graph Coloring...\n";
|
||||
if (!gc_failed) {
|
||||
RISCv64RegAlloc gc_alloc(mfunc.get());
|
||||
|
||||
@@ -296,7 +309,7 @@ std::string RISCv64CodeGen::function_gen(Function* func) {
|
||||
RISCv64BasicBlockAlloc bb_alloc(mfunc.get());
|
||||
bb_alloc.run();
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
||||
|
||||
if (DEBUG) {
|
||||
|
||||
Reference in New Issue
Block a user