1 //===-- Transform/Utils/FunctionUtils.h - Function Utils --------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This family of transformations manipulate LLVM functions.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_TRANSFORMS_UTILS_FUNCTION_H
15 #define LLVM_TRANSFORMS_UTILS_FUNCTION_H
17 #include "llvm/ADT/ArrayRef.h"
26 /// \brief Test whether a basic block is a viable candidate for extraction.
28 /// This tests whether a particular basic block is viable for extraction into
29 /// a separate function. It can be used to prune code extraction eagerly
30 /// rather than waiting for one of the Extract* methods below to reject
32 bool isBlockViableForExtraction(const BasicBlock &BB);
34 /// ExtractCodeRegion - Rip out a sequence of basic blocks into a new
37 Function* ExtractCodeRegion(DominatorTree& DT,
38 ArrayRef<BasicBlock*> code,
39 bool AggregateArgs = false);
41 /// ExtractLoop - Rip out a natural loop into a new function.
43 Function* ExtractLoop(DominatorTree& DT, Loop *L,
44 bool AggregateArgs = false);
46 /// ExtractBasicBlock - Rip out a basic block (and the associated landing pad)
47 /// into a new function.
49 Function* ExtractBasicBlock(ArrayRef<BasicBlock*> BBs,
50 bool AggregateArgs = false);