aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Transforms/Utils/CodeExtractor.h
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-05-04 11:20:27 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-05-04 11:20:27 +0000
commit90cb7089e364fdf09058bfb6a89a250fd7a871fb (patch)
treec14c41fbd3388846d4c31b6079c7787867f0a14f /include/llvm/Transforms/Utils/CodeExtractor.h
parent50955031b81ef1abd54fecd587bee7959f7fa19d (diff)
downloadexternal_llvm-90cb7089e364fdf09058bfb6a89a250fd7a871fb.zip
external_llvm-90cb7089e364fdf09058bfb6a89a250fd7a871fb.tar.gz
external_llvm-90cb7089e364fdf09058bfb6a89a250fd7a871fb.tar.bz2
Factor the computation of input and output sets into a public interface
of the CodeExtractor utility. This allows speculatively computing input and output sets to measure the likely size impact of the code extraction. These sets cannot be reused sadly -- we mutate the function prior to forming the final sets used by the actual extraction. The interface has been revamped slightly to make it easier to use correctly by making the interface const and sinking the computation of the number of exit blocks into the full extraction function and away from the rest of this logic which just computed two output parameters. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156168 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Transforms/Utils/CodeExtractor.h')
-rw-r--r--include/llvm/Transforms/Utils/CodeExtractor.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/include/llvm/Transforms/Utils/CodeExtractor.h b/include/llvm/Transforms/Utils/CodeExtractor.h
index 7268a3c..dafe730 100644
--- a/include/llvm/Transforms/Utils/CodeExtractor.h
+++ b/include/llvm/Transforms/Utils/CodeExtractor.h
@@ -84,12 +84,21 @@ namespace llvm {
///
/// Based on the blocks used when constructing the code extractor,
/// determine whether it is eligible for extraction.
- bool isEligible() { return !Blocks.empty(); };
+ bool isEligible() const { return !Blocks.empty(); };
+
+ /// \brief Compute the set of input values and output values for the code.
+ ///
+ /// These can be used either when performing the extraction or to evaluate
+ /// the expected size of a call to the extracted function. Note that this
+ /// work cannot be cached between the two as once we decide to extract
+ /// a code sequence, that sequence is modified, including changing these
+ /// sets, before extraction occurs. These modifications won't have any
+ /// significant impact on the cost however.
+ void findInputsOutputs(ValueSet &Inputs, ValueSet &Outputs) const;
private:
void severSplitPHINodes(BasicBlock *&Header);
void splitReturnBlocks();
- void findInputsOutputs(ValueSet &inputs, ValueSet &outputs);
Function *constructFunction(const ValueSet &inputs,
const ValueSet &outputs,