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,10 +96,11 @@ int main(int argc, const char **argv) {
std::make_shared<PassBuildCFG>(), std::make_shared<PassBuildCFG>(),
std::make_shared<PassMem2Reg>(), std::make_shared<PassMem2Reg>(),
}; };
if (flg_O1) {
for (auto pass : passes) { for (auto pass : passes) {
pass->run(visitor.module); pass->run(visitor.module);
} }
}
if (emit_llvm) { if (emit_llvm) {
auto llir_file = output_file.substr(0, output_file.rfind(".")) + ".ll"; auto llir_file = output_file.substr(0, output_file.rfind(".")) + ".ll";

View File

@ -69,6 +69,18 @@ static void analyze_alloca(InstAllocaPtr_t ai, AllocaInfo &info) {
info.only_in_1_block = false; 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) { // static bool rewrite_single_store(InstAllocaPtr_t ai, AllocaInfo& alloca_info) {