Jlm
ExportTests.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2021 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/rvsdg/view.hpp>
9 
13 #include <jlm/rvsdg/TestType.hpp>
14 #include <jlm/util/Statistics.hpp>
15 
16 TEST(ExportTests, test)
17 {
18  using namespace jlm::llvm;
19 
21  auto ft = jlm::rvsdg::FunctionType::Create({ vt }, { vt });
22 
24 
25  auto d = DataNode::Create(im.ipgraph(), "d", vt, Linkage::externalLinkage, "", false, 4);
26  auto f = FunctionNode::create(im.ipgraph(), "f", ft, Linkage::externalLinkage);
27 
28  im.create_global_value(d);
29  im.create_variable(f);
30 
33 
34  jlm::rvsdg::view(rvsdgModule->Rvsdg(), stdout);
35 
36  // We should have no exports in the RVSDG. The data and function
37  // node should be converted to RVSDG imports as they do not have
38  // a body, i.e., either a CFG or a initialization.
39  EXPECT_EQ(rvsdgModule->Rvsdg().GetRootRegion().nresults(), 0u);
40 }
static jlm::util::StatisticsCollector statisticsCollector
TEST(ExportTests, test)
Definition: ExportTests.cpp:16
static const auto vt
Definition: PullTests.cpp:16
static DataNode * Create(InterProceduralGraph &clg, const std::string &name, std::shared_ptr< const jlm::rvsdg::Type > valueType, const llvm::Linkage &linkage, std::string section, const bool constant, const size_t alignment)
Definition: ipgraph.hpp:431
static FunctionNode * create(InterProceduralGraph &ipg, const std::string &name, std::shared_ptr< const rvsdg::FunctionType > type, const llvm::Linkage &linkage, const CallingConvention &callingConvention, const AttributeSet &attributes)
Definition: ipgraph.hpp:242
static std::shared_ptr< const FunctionType > Create(std::vector< std::shared_ptr< const jlm::rvsdg::Type >> argumentTypes, std::vector< std::shared_ptr< const jlm::rvsdg::Type >> resultTypes)
static std::shared_ptr< const TestType > createValueType()
Definition: TestType.cpp:67
Global memory state passed between functions.
static std::unique_ptr< LlvmRvsdgModule > ConvertInterProceduralGraphModule(InterProceduralGraphModule &interProceduralGraphModule, InterProceduralGraphToRvsdgStatisticsCollector &statisticsCollector)
std::string view(const rvsdg::Region *region)
Definition: view.cpp:142