Jlm
TransformationSequenceTests.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2025 Nico Reißmann <nico.reissmann@gmail.com>
3  * See COPYING for terms of redistribution.
4  */
5 
6 #include <gtest/gtest.h>
7 
10 
12 {
13 public:
15  : Transformation("TestTransformation")
16  {}
17 
18  void
21  {}
22 };
23 
25 {
26 protected:
27  void
29  {}
30 
31  void
33  const jlm::rvsdg::Node & rvsdgNode,
35  jlm::util::graph::Graph * typeGraph) override
36  {}
37 
38  void
39  AnnotateEdge(const jlm::rvsdg::Input & rvsdgInput, jlm::util::graph::Edge & edge) override
40  {}
41 
42  void
44  const jlm::rvsdg::RegionArgument & regionArgument,
46  jlm::util::graph::Graph * typeGraph) override
47  {}
48 };
49 
50 TEST(ArgumentTests, RvsdgDumping)
51 {
52  using namespace jlm::rvsdg;
53  using namespace jlm::util;
54 
55  // Arrange
56  RvsdgModule rvsdgModule(FilePath("/tmp/mySource"));
57 
58  const StatisticsCollectorSettings statisticsCollectorSettings({}, FilePath("/tmp"), "moduleName");
59  StatisticsCollector statisticsCollector(statisticsCollectorSettings);
60 
61  TestDotWriter dotWriter;
62  auto testTransformation = std::make_shared<TestTransformation>();
63 
64  // Act
66  rvsdgModule,
68  { testTransformation },
69  dotWriter,
70  true);
71 
72  // Assert
73  EXPECT_TRUE(std::filesystem::exists("/tmp/000-Pristine.json"));
74  EXPECT_TRUE(std::filesystem::exists("/tmp/001-AfterTestTransformation.json"));
75 }
static jlm::util::StatisticsCollector statisticsCollector
TEST(ArgumentTests, RvsdgDumping)
void AnnotateRegionArgument(const jlm::rvsdg::RegionArgument &regionArgument, jlm::util::graph::Node &node, jlm::util::graph::Graph *typeGraph) override
void AnnotateEdge(const jlm::rvsdg::Input &rvsdgInput, jlm::util::graph::Edge &edge) override
void AnnotateTypeGraphNode(const jlm::rvsdg::Type &type, jlm::util::graph::Node &node) override
void AnnotateGraphNode(const jlm::rvsdg::Node &rvsdgNode, jlm::util::graph::Node &node, jlm::util::graph::Graph *typeGraph) override
void Run(jlm::rvsdg::RvsdgModule &module, jlm::util::StatisticsCollector &statisticsCollector) override
Perform RVSDG transformation.
Represents the argument of a region.
Definition: region.hpp:41
static void CreateAndRun(RvsdgModule &rvsdgModule, util::StatisticsCollector &statisticsCollector, std::vector< std::shared_ptr< Transformation >> transformations, DotWriter &dotWriter, const bool dumpRvsdgGraphs)
Creates a transformation sequence and invokes its Run() method.
Represents an RVSDG transformation.
Transformation(std::string_view Name)