Jlm
Loading...
Searching...
No Matches
basic-block.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2013 2014 Nico Reißmann <nico.reissmann@gmail.com>
3 * See COPYING for terms of redistribution.
4 */
5
8
9#include <sstream>
10
11namespace jlm::llvm
12{
13
14BasicBlock::~BasicBlock() noexcept = default;
15
16bool
17BasicBlock::HasSsaPhiOperation() const
18{
19 return is<SsaPhiOperation>(first());
20}
21
23BasicBlock::insert_before_branch(std::unique_ptr<llvm::ThreeAddressCode> tac)
24{
25 auto it = is<BranchOperation>(last()) ? std::prev(end()) : end();
26 return insert_before(it, std::move(tac));
27}
28
29void
31{
32 auto it = is<BranchOperation>(last()) ? std::prev(end()) : end();
33 insert_before(it, tv);
34}
35
38{
39 std::unique_ptr<BasicBlock> node(new BasicBlock(cfg));
40 return static_cast<BasicBlock *>(cfg.add_node(std::move(node)));
41}
42
43}
ThreeAddressCodeList::const_iterator end() const noexcept
llvm::ThreeAddressCode * insert_before(const ThreeAddressCodeList::const_iterator &it, std::unique_ptr< llvm::ThreeAddressCode > tac)
~BasicBlock() noexcept override
ThreeAddressCode * last() const noexcept
llvm::ThreeAddressCode * insert_before_branch(std::unique_ptr< llvm::ThreeAddressCode > tac)
static BasicBlock * create(ControlFlowGraph &cfg)
ControlFlowGraph & cfg() const noexcept
Definition cfg-node.hpp:106
BasicBlock * add_node(std::unique_ptr< BasicBlock > bb)
Definition cfg.hpp:218
Global memory state passed between functions.
std::vector< std::unique_ptr< llvm::ThreeAddressCode > > tacsvector_t
Definition tac.hpp:202