switch to O1 flag

This commit is contained in:
ridethepig 2023-05-20 13:33:40 +08:00
parent 375a325899
commit b5e1610047
2 changed files with 16 additions and 3 deletions

View File

@ -96,9 +96,10 @@ int main(int argc, const char **argv) {
std::make_shared<PassBuildCFG>(),
std::make_shared<PassMem2Reg>(),
};
for (auto pass : passes) {
pass->run(visitor.module);
if (flg_O1) {
for (auto pass : passes) {
pass->run(visitor.module);
}
}
if (emit_llvm) {

View File

@ -69,6 +69,18 @@ static void analyze_alloca(InstAllocaPtr_t ai, AllocaInfo &info) {
info.only_in_1_block = false;
}
}
std::cout << "Alloca " << ai->name;
std::cout << " Def: [";
for (auto blk : info.def_blocks) {
std::cout << blk->name << ", ";
}
std::cout << "]\n";
std::cout << " Use: [";
for (auto blk : info.def_blocks) {
std::cout << blk->name << ", ";
}
std::cout << "]\n";
std::cout.flush();
}
// static bool rewrite_single_store(InstAllocaPtr_t ai, AllocaInfo& alloca_info) {