diff options
Diffstat (limited to 'willow/lib/IR/Function.cpp')
| -rw-r--r-- | willow/lib/IR/Function.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/willow/lib/IR/Function.cpp b/willow/lib/IR/Function.cpp new file mode 100644 index 0000000..500d917 --- /dev/null +++ b/willow/lib/IR/Function.cpp @@ -0,0 +1,26 @@ +#include <willow/IR/Function.h> + +namespace willow { + +BasicBlock *Function::addBlock(std::unique_ptr<BasicBlock> block) { + auto p = block.get(); + blocks.push_back(std::move(block)); + p->setParent(this); + return p; +} + +const BasicBlock *Function::entryBlock() const { + if (blocks.empty()) + return nullptr; + else + return blocks.front().get(); +} + +BasicBlock *Function::entryBlock() { + if (blocks.empty()) + return nullptr; + else + return blocks.front().get(); +} + +}; // namespace willow |