diff options
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r-- | llvm/lib/IR/Function.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index 20619167bae..4c7b6b74205 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -194,6 +194,14 @@ LLVMContext &Function::getContext() const { return getType()->getContext(); } +unsigned Function::getInstructionCount() { + unsigned NumInstrs = 0; + for (BasicBlock &BB : BasicBlocks) + NumInstrs += std::distance(BB.instructionsWithoutDebug().begin(), + BB.instructionsWithoutDebug().end()); + return NumInstrs; +} + void Function::removeFromParent() { getParent()->getFunctionList().remove(getIterator()); } |