From c2d4209f85f46cc91163bc47cc43db252c94acf6 Mon Sep 17 00:00:00 2001 From: Stefan Weigl-Bosker Date: Thu, 19 Feb 2026 18:51:48 -0500 Subject: [willow]: more cleanup, tests (#12) --- willow/lib/IR/Function.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 willow/lib/IR/Function.cpp (limited to 'willow/lib/IR/Function.cpp') 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 + +namespace willow { + +BasicBlock *Function::addBlock(std::unique_ptr 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 -- cgit v1.2.3