diff --git a/src/backend/RISCv64/RISCv64Backend.cpp b/src/backend/RISCv64/RISCv64Backend.cpp index bd447fd..57fb690 100644 --- a/src/backend/RISCv64/RISCv64Backend.cpp +++ b/src/backend/RISCv64/RISCv64Backend.cpp @@ -256,7 +256,7 @@ std::string RISCv64CodeGen::function_gen(Function* func) { << ss_after_eli.str(); } - if (optLevel > 0) { + if (optLevel == 0) { // 阶段 2.1: 除法强度削弱优化 (Division Strength Reduction) DivStrengthReduction div_strength_reduction; div_strength_reduction.runOnMachineFunction(mfunc.get()); @@ -372,7 +372,7 @@ std::string RISCv64CodeGen::function_gen(Function* func) { mfunc->dumpStackFrameInfo(std::cerr); } - if (optLevel > 0) { + if (optLevel == 0) { // 阶段 4: 窥孔优化 (Peephole Optimization) PeepholeOptimizer peephole; peephole.runOnMachineFunction(mfunc.get()); diff --git a/src/sysyc.cpp b/src/sysyc.cpp index 7ef22f9..129eae5 100644 --- a/src/sysyc.cpp +++ b/src/sysyc.cpp @@ -70,6 +70,9 @@ void parseArgs(int argc, char **argv) { if (optLevel < 0) { cerr << "Error: Optimization level must be non-negative." << endl; usage(EXIT_FAILURE); + } else if (optLevel > 0) { + cerr << "Debugging, set optLevel to 0...\n"; + optLevel = 0; } } catch (const std::invalid_argument& ia) { cerr << "Error: Invalid argument for -O: " << optarg << endl;