diff options
author | Ahmed Bougacha <ahmed.bougacha@gmail.com> | 2013-08-21 07:27:59 +0000 |
---|---|---|
committer | Ahmed Bougacha <ahmed.bougacha@gmail.com> | 2013-08-21 07:27:59 +0000 |
commit | 3012ac538725a2b7faff75d0c317b2bd9e99fcf9 (patch) | |
tree | b85ee0f854f8f23af5c7bf401992e2f8f35539e5 /llvm/lib/MC/MCFunction.cpp | |
parent | 7bfc7da6e87abf8ab77a9a04b0ca355a6713b442 (diff) | |
download | bcm5719-llvm-3012ac538725a2b7faff75d0c317b2bd9e99fcf9.tar.gz bcm5719-llvm-3012ac538725a2b7faff75d0c317b2bd9e99fcf9.zip |
MC CFG: Add more MCFunction container methods (find, empty).
llvm-svn: 188876
Diffstat (limited to 'llvm/lib/MC/MCFunction.cpp')
-rw-r--r-- | llvm/lib/MC/MCFunction.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCFunction.cpp b/llvm/lib/MC/MCFunction.cpp index cb2504668a3..5011d5fd6b8 100644 --- a/llvm/lib/MC/MCFunction.cpp +++ b/llvm/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) |