Commit 1f5c48fc authored by nagayama15's avatar nagayama15

2,3番目のBasicBlockのスワップを実装

parent 1ea3bab5
......@@ -5,3 +5,4 @@
*.dll
*.o
*.ll
*.s
......@@ -41,7 +41,20 @@ namespace nykk
bool TestPass::runOnFunction(llvm::Function& func)
{
llvm::errs() << __FUNCTION__ << " : " << func.getName() << "\n";
llvm::errs() << " " << "bbs : " << func.getBasicBlockList().size() << "\n";
return false;
if (func.getBasicBlockList().size() < 3)
{
return false;
}
// Swap 2nd and 3rd basic blocks.
llvm::BasicBlock& entry_bb = func.getEntryBlock();
llvm::BasicBlock* bb1 = entry_bb.getNextNode();
llvm::BasicBlock* bb2 = bb1->getNextNode();
bb1->moveAfter(bb2);
return true;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment