Merge branch 'backend-O1' into deploy-20250819

This commit is contained in:
Lixuanwang
2025-08-19 20:05:59 +08:00
16 changed files with 481 additions and 276 deletions

View File

@@ -11,6 +11,7 @@ namespace sysy {
extern int DEBUG;
extern int DEEPDEBUG;
extern int optLevel;
namespace sysy {

View File

@@ -12,6 +12,7 @@ extern int DEBUG;
extern int DEEPDEBUG;
extern int DEBUGLENGTH; // 用于限制调试输出的长度
extern int DEEPERDEBUG; // 用于更深层次的调试输出
extern int optLevel;
namespace sysy {

View File

@@ -1,24 +0,0 @@
#pragma once
#include "../Pass.h"
namespace sysy {
class LargeArrayToGlobalPass : public OptimizationPass {
public:
static void *ID;
LargeArrayToGlobalPass() : OptimizationPass("LargeArrayToGlobal", Granularity::Module) {}
bool runOnModule(Module *M, AnalysisManager &AM) override;
void *getPassID() const override {
return &ID;
}
private:
unsigned calculateTypeSize(Type *type);
void convertAllocaToGlobal(AllocaInst *alloca, Function *F, Module *M);
std::string generateUniqueGlobalName(AllocaInst *alloca, Function *F);
};
} // namespace sysy

View File

@@ -51,6 +51,7 @@ public:
Module *pModule, IRBuilder *pBuilder);
static void initExternalFunction(Module *pModule, IRBuilder *pBuilder);
static void modify_timefuncname(Module *pModule);
};
class SysYIRGenerator : public SysYBaseVisitor {