summaryrefslogtreecommitdiff
path: root/lib/MC/MCFunction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/MC/MCFunction.cpp')
-rw-r--r--lib/MC/MCFunction.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/MC/MCFunction.cpp b/lib/MC/MCFunction.cpp
index cb2504668a..5011d5fd6b 100644
--- a/lib/MC/MCFunction.cpp
+++ b/lib/MC/MCFunction.cpp
@@ -30,6 +30,18 @@ MCBasicBlock &MCFunction::createBlock(const MCTextAtom &TA) {
return *Blocks.back();
}
+const MCBasicBlock *MCFunction::find(uint64_t StartAddr) const {
+ for (const_iterator I = begin(), E = end(); I != E; ++I)
+ if ((*I)->getInsts()->getBeginAddr() == StartAddr)
+ return (*I);
+ return 0;
+}
+
+MCBasicBlock *MCFunction::find(uint64_t StartAddr) {
+ return const_cast<MCBasicBlock *>(
+ const_cast<const MCFunction *>(this)->find(StartAddr));
+}
+
// MCBasicBlock
MCBasicBlock::MCBasicBlock(const MCTextAtom &Insts, MCFunction *Parent)