From c58f7728035c29774cccbced8fe835a0c69cdff9 Mon Sep 17 00:00:00 2001 From: Misha Brukman Date: Tue, 2 Mar 2004 00:20:57 +0000 Subject: [PATCH] Implement ExtractCodeRegion() llvm-svn: 12070 --- lib/Transforms/Utils/CodeExtractor.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/Transforms/Utils/CodeExtractor.cpp b/lib/Transforms/Utils/CodeExtractor.cpp index 530d2f66b73..7de30066806 100644 --- a/lib/Transforms/Utils/CodeExtractor.cpp +++ b/lib/Transforms/Utils/CodeExtractor.cpp @@ -443,7 +443,7 @@ CodeExtractor::emitCallAndSwitchStatement(Function *newFunction, brInst); } - // Rewrite branches into exists which return a value based on which + // Rewrite branches into exits which return a value based on which // exit we take from this function if (brInst->isUnconditional()) { if (!contains(code, brInst->getSuccessor(0))) { @@ -566,6 +566,14 @@ Function *CodeExtractor::ExtractCodeRegion(const std::vector &code) return newFunction; } +/// ExtractCodeRegion - slurp a sequence of basic blocks into a brand new +/// function +/// +Function* llvm::ExtractCodeRegion(const std::vector &code) { + CodeExtractor CE; + return CE.ExtractCodeRegion(code); +} + /// ExtractBasicBlock - slurp a natural loop into a brand new function /// Function* llvm::ExtractLoop(Loop *L) {