#define INCLUDE__Function_hxx
#include "disassembler/BasicBlock.hxx"
+#include <map>
class Function {
public:
- Function(const std::string& name) {
- this->name = name;
+ Function(const std::string& name, uint64_t start_address)
+ : name(name)
+ , start_address(start_address) {
+ }
+
+ uint64_t getStartAddress() const {
+ return start_address;
}
std::string getName() const {
return name;
}
- BasicBlock * getEntry();
+ void addBasicBlock(BasicBlock* block) {
+ _blocks.insert(std::make_pair(block->getStartAddress(), block));
+ }
+ std::map<uint64_t, BasicBlock*>& blocks() {
+ return _blocks;
+ }
private:
std::string name;
- BasicBlock * start;
+ uint64_t start_address;
+ std::map<uint64_t, BasicBlock*> _blocks;
};
#endif