Move the CodeExtractor utility to a dedicated header file / source file,
authorChandler Carruth <chandlerc@gmail.com>
Fri, 4 May 2012 10:18:49 +0000 (10:18 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Fri, 4 May 2012 10:18:49 +0000 (10:18 +0000)
commit99650c9088c5dd4b6788a99b63c82d13e0518961
treeec254839206a3ca624d38af398ba831dbd053cb4
parentfd5abd546e8e035755005a654d60d6f5f74cfe2c
Move the CodeExtractor utility to a dedicated header file / source file,
and expose it as a utility class rather than as free function wrappers.

The simple free-function interface works well for the bugpoint-specific
pass's uses of code extraction, but in an upcoming patch for more
advanced code extraction, they simply don't expose a rich enough
interface. I need to expose various stages of the process of doing the
code extraction and query information to decide whether or not to
actually complete the extraction or give up.

Rather than build up a new predicate model and pass that into these
functions, just take the class that was actually implementing the
functions and lift it up into a proper interface that can be used to
perform code extraction. The interface is cleaned up and re-documented
to work better in a header. It also is now setup to accept the blocks to
be extracted in the constructor rather than in a method.

In passing this essentially reverts my previous commit here exposing
a block-level query for eligibility of extraction. That is no longer
necessary with the more rich interface as clients can query the
extraction object for eligibility directly. This will reduce the number
of walks of the input basic block sequence by quite a bit which is
useful if this enters the normal optimization pipeline.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156163 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Transforms/Utils/CodeExtractor.h [new file with mode: 0644]
include/llvm/Transforms/Utils/FunctionUtils.h [deleted file]
lib/Transforms/IPO/LoopExtractor.cpp
lib/Transforms/IPO/PartialInlining.cpp
lib/Transforms/Utils/CodeExtractor.cpp
tools/bugpoint/ExtractFunction.cpp