Jlm
CfgNodeTests.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2020 Nico Reißmann <nico.reissmann@gmail.com>
3  * See COPYING for terms of redistribution.
4  */
5 
6 #include <gtest/gtest.h>
7 
8 #include <jlm/llvm/ir/cfg.hpp>
10 #include <jlm/llvm/ir/print.hpp>
11 
12 TEST(ControlFlowGraphNodeTests, test_divert_inedges)
13 {
14  using namespace jlm::llvm;
15 
16  // Arrange
18 
19  ControlFlowGraph cfg(im);
20 
21  auto bb0 = BasicBlock::create(cfg);
22 
23  cfg.exit()->divert_inedges(bb0);
24  bb0->add_outedge(bb0);
25  bb0->add_outedge(cfg.exit());
26 
27  std::cout << ControlFlowGraph::ToAscii(cfg) << std::flush;
28 
29  /* verify inedge diversion */
30 
31  bb0->divert_inedges(bb0);
32 }
TEST(ControlFlowGraphNodeTests, test_divert_inedges)
static BasicBlock * create(ControlFlowGraph &cfg)
Definition: basic-block.cpp:37
void divert_inedges(llvm::ControlFlowGraphNode *new_successor)
Definition: cfg-node.hpp:171
static std::string ToAscii(const ControlFlowGraph &controlFlowGraph)
Definition: cfg.cpp:151
ExitNode * exit() const noexcept
Definition: cfg.hpp:212
Global memory state passed between functions.