diff --git a/src/PostRA_Scheduler.cpp b/src/PostRA_Scheduler.cpp index 5268a04..efc18dc 100644 --- a/src/PostRA_Scheduler.cpp +++ b/src/PostRA_Scheduler.cpp @@ -1,9 +1,9 @@ #include "PostRA_Scheduler.h" -#include #include #include #include #include +#define MAX_SCHEDULING_BLOCK_SIZE 10000 // 限制调度块大小,避免过大导致性能问题 namespace sysy { @@ -306,6 +306,9 @@ void validateSchedule(const std::vector& instr_list) { void scheduleBlock(MachineBasicBlock* mbb) { auto& instructions = mbb->getInstructions(); if (instructions.size() <= 1) return; + if (instructions.size() > MAX_SCHEDULING_BLOCK_SIZE) { + return; // 跳过超大块,防止卡住 + } std::vector instr_list; for (auto& instr : instructions) {